All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlo Caione <carlo@caione.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
	maxime.ripard@free-electrons.com, hdegoede@redhat.com,
	emilio@elopez.com.ar, wens@csie.org, sameo@linux.intel.com,
	linux-input@vger.kernel.org, linux-doc@vger.kernel.org,
	lgirdwood@gmail.com, broonie@kernel.org, lee.jones@linaro.org,
	boris.brezillon@free-electrons.com, linux-sunxi@googlegroups.com
Subject: Re: [linux-sunxi] Re: [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
Date: Thu, 17 Apr 2014 14:07:59 +0200	[thread overview]
Message-ID: <CAOQ7t2Z0ESCsPc6K-i9hKCT0YACEzKvzemw+2YHMarZMdSYzsA@mail.gmail.com> (raw)
In-Reply-To: <20140413081701.GB7267@core.coreip.homeip.net>

On Sun, Apr 13, 2014 at 10:17 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

<cut>

>> +static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
>> +                                 char *buf)
>> +{
>> +     struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
>> +     struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
>> +     unsigned int val;
>> +     int ret, i;
>> +
>> +     ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
>> +     if (ret != 0)
>> +             return ret;
>> +
>> +     val &= axp20x_ea->mask;
>> +     val >>= ffs(axp20x_ea->mask) - 1;
>> +
>> +     for (i = 0; i < 4; i++)
>> +             if (val == axp20x_ea->p_time[i].idx)
>> +                     val = axp20x_ea->p_time[i].time;
>> +
>> +     return sprintf(buf, "%ums\n", val);
>
> Please do not print ums and instead document the units in sysfs ABI
> docs.

Ok, I'll fix it.

<cut>

>> +     if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
>> +         device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
>> +             return -ENODEV;
>
> I think you still want to use attribute group here. You also need to
> clean up the attributes when unbinding device. Also, why returning
> -ENODEV instead of the proper error code?

I'll fix the error code and I'll add the clean up code.
I'm still a bit puzzled about the attribute group for the platform
devices. IIRC for the platform devices the default attribute group is
still a bit an issue [1]

[1] http://www.spinics.net/lists/hotplug/msg05775.html

Thanks for the review,

-- 
Carlo Caione

WARNING: multiple messages have this Message-ID (diff)
From: carlo@caione.org (Carlo Caione)
To: linux-arm-kernel@lists.infradead.org
Subject: [linux-sunxi] Re: [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
Date: Thu, 17 Apr 2014 14:07:59 +0200	[thread overview]
Message-ID: <CAOQ7t2Z0ESCsPc6K-i9hKCT0YACEzKvzemw+2YHMarZMdSYzsA@mail.gmail.com> (raw)
In-Reply-To: <20140413081701.GB7267@core.coreip.homeip.net>

On Sun, Apr 13, 2014 at 10:17 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

<cut>

>> +static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
>> +                                 char *buf)
>> +{
>> +     struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
>> +     struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
>> +     unsigned int val;
>> +     int ret, i;
>> +
>> +     ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
>> +     if (ret != 0)
>> +             return ret;
>> +
>> +     val &= axp20x_ea->mask;
>> +     val >>= ffs(axp20x_ea->mask) - 1;
>> +
>> +     for (i = 0; i < 4; i++)
>> +             if (val == axp20x_ea->p_time[i].idx)
>> +                     val = axp20x_ea->p_time[i].time;
>> +
>> +     return sprintf(buf, "%ums\n", val);
>
> Please do not print ums and instead document the units in sysfs ABI
> docs.

Ok, I'll fix it.

<cut>

>> +     if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
>> +         device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
>> +             return -ENODEV;
>
> I think you still want to use attribute group here. You also need to
> clean up the attributes when unbinding device. Also, why returning
> -ENODEV instead of the proper error code?

I'll fix the error code and I'll add the clean up code.
I'm still a bit puzzled about the attribute group for the platform
devices. IIRC for the platform devices the default attribute group is
still a bit an issue [1]

[1] http://www.spinics.net/lists/hotplug/msg05775.html

Thanks for the review,

-- 
Carlo Caione

  reply	other threads:[~2014-04-17 12:07 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  9:38 [PATCH v4 0/9] mfd: AXP20x: Add support for AXP202 and AXP209 Carlo Caione
2014-04-11  9:38 ` Carlo Caione
     [not found] ` <1397209093-10077-1-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11  9:38   ` [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-2-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11 11:25       ` Arnd Bergmann
2014-04-11 11:25         ` Arnd Bergmann
2014-04-11 12:03         ` [linux-sunxi] " Carlo Caione
2014-04-11 12:03           ` Carlo Caione
2014-04-11 12:09         ` Mark Brown
2014-04-11 12:09           ` Mark Brown
     [not found]           ` <20140411120908.GC28800-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-11 13:16             ` Arnd Bergmann
2014-04-11 13:16               ` Arnd Bergmann
2014-04-16 15:43       ` Lee Jones
2014-04-16 15:43         ` Lee Jones
2014-04-16 15:44         ` Lee Jones
2014-04-16 15:44           ` Lee Jones
2014-04-11  9:38   ` [PATCH v4 2/9] dt-bindings: add vendor-prefix for X-Powers Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 3/9] mfd: AXP20x: Add bindings documentation Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-5-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-13  8:17       ` Dmitry Torokhov
2014-04-13  8:17         ` Dmitry Torokhov
2014-04-17 12:07         ` Carlo Caione [this message]
2014-04-17 12:07           ` [linux-sunxi] " Carlo Caione
2014-04-11  9:38   ` [PATCH v4 5/9] input: misc: Add ABI docs for AXP20x PEK Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-7-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11 12:23       ` Mark Brown
2014-04-11 12:23         ` Mark Brown
2014-04-11 12:29         ` [linux-sunxi] " Carlo Caione
2014-04-11 12:29           ` Carlo Caione
2014-05-15 18:03       ` Boris BREZILLON
2014-05-15 18:03         ` Boris BREZILLON
     [not found]         ` <5375015A.10701-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-05-15 18:18           ` Mark Brown
2014-05-15 18:18             ` Mark Brown
2014-05-16  7:40           ` Carlo Caione
2014-05-16  7:40             ` [linux-sunxi] " Carlo Caione
2014-04-11  9:38   ` [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-8-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11 12:29       ` Mark Brown
2014-04-11 12:29         ` Mark Brown
2014-04-11 13:04         ` Carlo Caione
2014-04-11 13:04           ` Carlo Caione
     [not found]           ` <CAOQ7t2Y2B7f+eZApDHKiKm9=bOXo6oUA2RLY7ENn7qPLQEboMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-11 16:18             ` Mark Brown
2014-04-11 16:18               ` Mark Brown
     [not found]               ` <20140411161813.GF28800-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-17 10:06                 ` Carlo Caione
2014-04-17 10:06                   ` Carlo Caione
     [not found]                   ` <CAOQ7t2YO_MjUZkkoEe1Grft+fVttWoOro85Sru2P3LXbx8Kjbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-18 15:15                     ` Mark Brown
2014-04-18 15:15                       ` Mark Brown
     [not found]                       ` <20140418151551.GZ12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-23 20:25                         ` Carlo Caione
2014-04-23 20:25                           ` Carlo Caione
     [not found]                           ` <20140423202546.GA3890-OP/Sd6KM9CusbfqNwF1Yyl6hYfS7NtTn@public.gmane.org>
2014-04-24 13:30                             ` Mark Brown
2014-04-24 13:30                               ` Mark Brown
2014-04-24 16:35                               ` Charles Keepax
2014-04-24 16:35                                 ` Charles Keepax
     [not found]                                 ` <20140424163523.GB25663-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2014-04-24 16:58                                   ` Charles Keepax
2014-04-24 16:58                                     ` Charles Keepax
     [not found]                                     ` <20140424165847.GC25663-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2014-04-24 17:12                                       ` Mark Brown
2014-04-24 17:12                                         ` Mark Brown
2014-04-14  9:52       ` Maxime Ripard
2014-04-14  9:52         ` Maxime Ripard
2014-04-14 10:02         ` Carlo Caione
2014-04-14 10:02           ` [linux-sunxi] " Carlo Caione
     [not found]           ` <CAOQ7t2ZybF=dm-NBQ3niN7gb-Asgwz5CW-VSkOzWR6t2NCaA8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-14 10:20             ` Hans de Goede
2014-04-14 10:20               ` [linux-sunxi] " Hans de Goede
     [not found]               ` <534BB670.8030102-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-14 11:16                 ` Mark Brown
2014-04-14 11:16                   ` [linux-sunxi] " Mark Brown
2014-04-11  9:38   ` [PATCH v4 8/9] ARM: sunxi: Add AXP20x support in defconfig Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 9/9] ARM: sunxi: Add AXP20x support multi_v7_defconfig Carlo Caione
2014-04-11  9:38     ` Carlo Caione

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQ7t2Z0ESCsPc6K-i9hKCT0YACEzKvzemw+2YHMarZMdSYzsA@mail.gmail.com \
    --to=carlo@caione.org \
    --cc=boris.brezillon@free-electrons.com \
    --cc=broonie@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=emilio@elopez.com.ar \
    --cc=hdegoede@redhat.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=sameo@linux.intel.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.