All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: cw00.choi@samsung.com
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	"myungjoo.ham@samsung.com" <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH 1/4] extcon: Modify the device name as extcon[X] for sysfs
Date: Thu, 30 Apr 2015 10:30:16 +0100	[thread overview]
Message-ID: <20150430093016.GM3480@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <CAGTfZH3=_nMtDaL3Awic4WrZYZTOHygccZmoR3bPtsyBo66q6Q@mail.gmail.com>

On Thu, Apr 30, 2015 at 12:31:06AM +0900, Chanwoo Choi wrote:
> Hi Charles,
> 
> On Tue, Apr 28, 2015 at 11:17 PM, Charles Keepax
> <ckeepax@opensource.wolfsonmicro.com> wrote:
> > On Mon, Apr 27, 2015 at 09:13:35PM +0900, Chanwoo Choi wrote:
> >> This patch modify the device name as extcon[X] for sysfs by using the 'extcon'
> >> prefix word instead of separate device name. On user-space aspect, user would
> >> find the some extcon drvier with extcon[X] pattern. So, this patch modify the
> >> device name as following:
> >> - /sys/class/extcon/[device name] -> /sys/class/extcon/extcon[X]
> >>
> >> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> >> ---
> >>  drivers/extcon/extcon.c | 8 +++++---
> >>  1 file changed, 5 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> >> index 4c9f165..1a93229 100644
> >> --- a/drivers/extcon/extcon.c
> >> +++ b/drivers/extcon/extcon.c
> >> @@ -163,7 +163,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr,
> >>                       return ret;
> >>       }
> >>
> >> -     return sprintf(buf, "%s\n", dev_name(&edev->dev));
> >> +     return sprintf(buf, "%s\n", edev->name);
> >>  }
> >>  static DEVICE_ATTR_RO(name);
> >>
> >> @@ -701,6 +701,7 @@ EXPORT_SYMBOL_GPL(devm_extcon_dev_free);
> >>  int extcon_dev_register(struct extcon_dev *edev)
> >>  {
> >>       int ret, index = 0;
> >> +     static atomic_t edev_no = ATOMIC_INIT(-1);
> >>
> >>       if (!extcon_class) {
> >>               ret = create_extcon_class();
> >> @@ -725,13 +726,14 @@ int extcon_dev_register(struct extcon_dev *edev)
> >>       edev->dev.class = extcon_class;
> >>       edev->dev.release = extcon_dev_release;
> >>
> >> -     edev->name = edev->name ? edev->name : dev_name(edev->dev.parent);
> >> +     edev->name = dev_name(edev->dev.parent);
> >>       if (IS_ERR_OR_NULL(edev->name)) {
> >>               dev_err(&edev->dev,
> >>                       "extcon device name is null\n");
> >>               return -EINVAL;
> >>       }
> >> -     dev_set_name(&edev->dev, "%s", edev->name);
> >> +     dev_set_name(&edev->dev, "extcon%lu",
> >> +                     (unsigned long)atomic_inc_return(&edev_no));
> >>
> >>       if (edev->max_supported) {
> >>               char buf[10];
> >> --
> >> 1.8.5.5
> >>
> >
> > I am not quite sure I see the advantage of this. Why is naming
> > the node extcon[X] better than the old system? Seems like the
> > older more descriptive names are better on the face of it, unless
> > there is some problem with them I am missing.
> 
> In the older method for device name, if some board have the
> two more same extcon h/w, extcon driver will fail to probe because
> of same device name. There is definitely critical problem with older method.

Hmm... ok that is probably reasonable enough reason to change the
ABI. I will add my ack to the Arizona patch.

Thanks,
Charles


  reply	other threads:[~2015-04-30  9:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 12:13 [PATCH 0/4] extcon: Modify the device name for sysfs entry and add extcon_get_edev_name() Chanwoo Choi
2015-04-27 12:13 ` [PATCH 1/4] extcon: Modify the device name as extcon[X] for sysfs Chanwoo Choi
2015-04-28 14:17   ` Charles Keepax
2015-04-29 15:31     ` Chanwoo Choi
2015-04-30  9:30       ` Charles Keepax [this message]
2015-04-27 12:13 ` [PATCH 2/4] extcon: Add extcon_get_edev_name() API to get the extcon device name Chanwoo Choi
2015-04-27 12:13 ` [PATCH 3/4] extcon: Fix the checkpatch warning and minor coding style issue Chanwoo Choi
2015-04-27 12:13 ` [PATCH 4/4] extcon: arizona: Remove the setting of device name Chanwoo Choi
2015-04-30  9:30   ` Charles Keepax

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=20150430093016.GM3480@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=cw00.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    /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.