Re: [PATCH 2/2] w1: fix the resume command API

From: Evgeniy Polyakov
Date: Tue Mar 19 2019 - 10:27:39 EST


Hi everyone

Mariusz, thank you for the patch, a small comment on it logic

19.03.2019, 16:21, "Jean-Francois Dagenais" <jeff.dagenais@xxxxxxxxx>:

>> Â---
>> Âdrivers/w1/w1_io.c | 11 +++++++++--
>> Â1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> Âdiff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
>> Âindex 0364d3329c52..4697136b9027 100644
>> Â--- a/drivers/w1/w1_io.c
>> Â+++ b/drivers/w1/w1_io.c
>> Â@@ -432,8 +432,15 @@ int w1_reset_resume_command(struct w1_master *dev)
>> ÂÂÂÂÂÂÂÂÂif (w1_reset_bus(dev))
>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -1;
>>
>> Â- /* This will make only the last matched slave perform a skip ROM. */
>> Â- w1_write_8(dev, W1_RESUME_CMD);
>> Â+ if (dev->slave_count == 1) {
>> Â+ /* Resume Command has to be preceeded with e.g. Match ROM which is
>> Â+ * not happening on single-slave buses, just do a Skip ROM instead
>> Â+ */
>> Â+ w1_write_8(dev, W1_SKIP_ROM);

Looks like this may break the search logic, can you check that with this patch applied
some other single slave device will correctly 'tell' its id and it can be addressed via match rom (like, basically, just reading temperature or something like that)?

>> Â+ } else {
>> Â+ /* This will make only the last matched slave perform a skip ROM. */
>> Â+ w1_write_8(dev, W1_RESUME_CMD);
>> Â+ }
>
> This may be a subsys maintainer's style preference, but perhaps the verbose comments
> might be better suited for the git commit message. Could this then be shorted to
>
> ÂÂÂÂÂÂÂÂif (dev->slave_count == 1)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂw1_write_8(dev, W1_SKIP_ROM);
> ÂÂÂÂÂÂÂÂelse
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂw1_write_8(dev, W1_RESUME_CMD);
>
> Or maybe:
>
> ÂÂÂÂÂÂÂÂw1_write_8(dev, dev->slave_count > 1 ? W1_RESUME_CMD : W1_SKIP_ROM);
>
> I am also ok with this proposed version, hence the "reviewed-by".
>
>> ÂÂÂÂÂÂÂÂÂreturn 0;
>> Â}
>> ÂEXPORT_SYMBOL_GPL(w1_reset_resume_command);
>> Â--
>> Â2.19.0.rc1