Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662364 > unrolled thread
| Started by | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| First post | 2017-06-09 14:10 +0200 |
| Last post | 2017-06-11 11:00 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v1] misc: apds990x: Use sysfs_match_string() helper Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-06-09 14:10 +0200
Re: [PATCH v1] misc: apds990x: Use sysfs_match_string() helper Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-11 09:50 +0200
Re: [PATCH v1] misc: apds990x: Use sysfs_match_string() helper Geert Uytterhoeven <geert@linux-m68k.org> - 2017-06-11 11:00 +0200
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Date | 2017-06-09 14:10 +0200 |
| Subject | [PATCH v1] misc: apds990x: Use sysfs_match_string() helper |
| Message-ID | <tQqTL-1lV-17@gated-at.bofh.it> |
Use sysfs_match_string() helper instead of open coded variant.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/misc/apds990x.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index c341164edaad..e9298f9d1588 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -856,13 +856,13 @@ static ssize_t apds990x_prox_reporting_mode_store(struct device *dev,
const char *buf, size_t len)
{
struct apds990x_chip *chip = dev_get_drvdata(dev);
+ int ret;
- if (sysfs_streq(buf, reporting_modes[0]))
- chip->prox_continuous_mode = 0;
- else if (sysfs_streq(buf, reporting_modes[1]))
- chip->prox_continuous_mode = 1;
- else
- return -EINVAL;
+ ret = sysfs_match_string(reporting_modes, buf);
+ if (ret < 0)
+ return ret;
+
+ chip->prox_continuous_mode = ret;
return len;
}
--
2.11.0
[toc] | [next] | [standalone]
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2017-06-11 09:50 +0200 |
| Message-ID | <tR5Nf-2g5-7@gated-at.bofh.it> |
| In reply to | #1662364 |
On Fri, Jun 09, 2017 at 03:07:58PM +0300, Andy Shevchenko wrote: > Use sysfs_match_string() helper instead of open coded variant. > > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/misc/apds990x.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) kbuild is failing :(
[toc] | [prev] | [next] | [standalone]
| From | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| Date | 2017-06-11 11:00 +0200 |
| Message-ID | <tR6SZ-2SQ-1@gated-at.bofh.it> |
| In reply to | #1663071 |
On Sun, Jun 11, 2017 at 9:47 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Fri, Jun 09, 2017 at 03:07:58PM +0300, Andy Shevchenko wrote:
>> Use sysfs_match_string() helper instead of open coded variant.
>>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> ---
>> drivers/misc/apds990x.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> kbuild is failing :(
reporting_modes[] is not an array of string pointers, but an array of
9-byte arrays. Converting it to an array of pointers should fix this.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web