linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
@ 2015-11-18 16:16 Dan Bogdan Nechita
  2015-11-19  8:22 ` Michael Hennerich
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Bogdan Nechita @ 2015-11-18 16:16 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Michael Hennerich, linux-kernel, Dan Bogdan Nechita

Currently writing the attributes with "echo" will result in comparing:
"enabled\n" with "enabled\0" and attribute is always set to false.

Use the sysfs_streq() instead because it treats both NUL and
new-line-then-NUL as equivalent string terminations.

Signed-off-by: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com>
---
 drivers/misc/ad525x_dpot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 15e8807..4230e6a 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -452,7 +452,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
 	int err;
 
 	if (reg & DPOT_ADDR_OTP_EN) {
-		if (!strncmp(buf, "enabled", sizeof("enabled")))
+		if (sysfs_streq(buf, "enabled"))
 			set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
 		else
 			clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
  2015-11-18 16:16 [PATCH] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes Dan Bogdan Nechita
@ 2015-11-19  8:22 ` Michael Hennerich
  2016-02-22  8:58   ` Michael Hennerich
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Hennerich @ 2015-11-19  8:22 UTC (permalink / raw)
  To: Dan Bogdan Nechita, Arnd Bergmann, Greg Kroah-Hartman; +Cc: linux-kernel

On 11/18/2015 05:16 PM, Dan Bogdan Nechita wrote:
> Currently writing the attributes with "echo" will result in comparing:
> "enabled\n" with "enabled\0" and attribute is always set to false.
>
> Use the sysfs_streq() instead because it treats both NUL and
> new-line-then-NUL as equivalent string terminations.
>
> Signed-off-by: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>   drivers/misc/ad525x_dpot.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
> index 15e8807..4230e6a 100644
> --- a/drivers/misc/ad525x_dpot.c
> +++ b/drivers/misc/ad525x_dpot.c
> @@ -452,7 +452,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
>   	int err;
>
>   	if (reg & DPOT_ADDR_OTP_EN) {
> -		if (!strncmp(buf, "enabled", sizeof("enabled")))
> +		if (sysfs_streq(buf, "enabled"))
>   			set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
>   		else
>   			clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
  2015-11-19  8:22 ` Michael Hennerich
@ 2016-02-22  8:58   ` Michael Hennerich
  2016-02-22 19:45     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Hennerich @ 2016-02-22  8:58 UTC (permalink / raw)
  To: Dan Bogdan Nechita, Arnd Bergmann, Greg Kroah-Hartman; +Cc: linux-kernel

On 11/19/2015 09:22 AM, Michael Hennerich wrote:
> On 11/18/2015 05:16 PM, Dan Bogdan Nechita wrote:
>> Currently writing the attributes with "echo" will result in comparing:
>> "enabled\n" with "enabled\0" and attribute is always set to false.
>>
>> Use the sysfs_streq() instead because it treats both NUL and
>> new-line-then-NUL as equivalent string terminations.
>>
>> Signed-off-by: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com>
>
> Acked-by: Michael Hennerich <michael.hennerich@analog.com>


Looks like to patch got lost?


>
>> ---
>>   drivers/misc/ad525x_dpot.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
>> index 15e8807..4230e6a 100644
>> --- a/drivers/misc/ad525x_dpot.c
>> +++ b/drivers/misc/ad525x_dpot.c
>> @@ -452,7 +452,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
>>       int err;
>>
>>       if (reg & DPOT_ADDR_OTP_EN) {
>> -        if (!strncmp(buf, "enabled", sizeof("enabled")))
>> +        if (sysfs_streq(buf, "enabled"))
>>               set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
>>           else
>>               clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
>>
>
>


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
  2016-02-22  8:58   ` Michael Hennerich
@ 2016-02-22 19:45     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-22 19:45 UTC (permalink / raw)
  To: Michael Hennerich; +Cc: Dan Bogdan Nechita, Arnd Bergmann, linux-kernel

On Mon, Feb 22, 2016 at 09:58:27AM +0100, Michael Hennerich wrote:
> On 11/19/2015 09:22 AM, Michael Hennerich wrote:
> >On 11/18/2015 05:16 PM, Dan Bogdan Nechita wrote:
> >>Currently writing the attributes with "echo" will result in comparing:
> >>"enabled\n" with "enabled\0" and attribute is always set to false.
> >>
> >>Use the sysfs_streq() instead because it treats both NUL and
> >>new-line-then-NUL as equivalent string terminations.
> >>
> >>Signed-off-by: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com>
> >
> >Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> 
> 
> Looks like to patch got lost?

If so, please resend it, I don't see it here in my queue, sorry.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
@ 2016-02-23  9:48 Dan Bogdan Nechita
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Bogdan Nechita @ 2016-02-23  9:48 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Michael Hennerich, linux-kernel, Dan Bogdan Nechita

Currently writing the attributes with "echo" will result in comparing:
"enabled\n" with "enabled\0" and attribute is always set to false.

Use the sysfs_streq() instead because it treats both NUL and
new-line-then-NUL as equivalent string terminations.

Signed-off-by: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com>
---
 drivers/misc/ad525x_dpot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 15e8807..4230e6a 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -452,7 +452,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
 	int err;
 
 	if (reg & DPOT_ADDR_OTP_EN) {
-		if (!strncmp(buf, "enabled", sizeof("enabled")))
+		if (sysfs_streq(buf, "enabled"))
 			set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
 		else
 			clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-23 10:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 16:16 [PATCH] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes Dan Bogdan Nechita
2015-11-19  8:22 ` Michael Hennerich
2016-02-22  8:58   ` Michael Hennerich
2016-02-22 19:45     ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2016-02-23  9:48 Dan Bogdan Nechita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).