All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Reid <preid@electromag.com.au>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: linux-pm@vger.kernel.org
Subject: Re: RFI: devm_power_supply_register and sys/class name
Date: Thu, 9 Jun 2016 23:45:37 +0800	[thread overview]
Message-ID: <122dc217-0257-1f76-3db8-e4d90d7bedae@electromag.com.au> (raw)
In-Reply-To: <CAJKOXPdJ=9gKs=HrmaxxbRMSw6Q6PqZJ-RFuUQ=YSmJKUfy9Sg@mail.gmail.com>

On 9/06/2016 18:22, Krzysztof Kozlowski wrote:
> On Thu, Jun 9, 2016 at 11:39 AM, Phil Reid <preid@electromag.com.au> wrote:
>> G'day All,
>>
>> I'm implementing a driver for a sbs manager chip (ltc1760) and running into
>> a problem.
>> This is a dual smart battery charger ic.
>>
>> Our hard has two of these connected via a i2c / smbus mux.
>>
>> One registering the second device with devm_power_supply_register  I am
>> getting a warning
>> in regards duplicate sysfs entries.
>> The first device creates this entry
>> /sys/class/power_supply/sbs-manager/
>>
>> The second device also creates the same entry.
>>
>> This name appears to come from power_supply_desc .name field.
>>
>> Which needs to exists for the lifetime of the driver.
>> So I'm assuming I need to allocate local memory for this struct in the
>> driver and set a unique name.
>>
>> Is this the correct way to go or should devm_power_supply_register be made
>> more
>> flexible to ensure unique names?
>
> Hi,
>
> You need to provide one power_supply_desc per power supply instance.
> So in your case - you need two of them (with different names). Look at
> other drivers doing this.
>

G'day Krzysztof,

The driver I was following max8998_charger.c used a static struct power_supply_desc.
So I wasn't 100% sure.
Thanks for clarifying.


-- 
Regards
Phil Reid


      reply	other threads:[~2016-06-09 15:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09  9:39 RFI: devm_power_supply_register and sys/class name Phil Reid
2016-06-09 10:22 ` Krzysztof Kozlowski
2016-06-09 15:45   ` Phil Reid [this message]

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=122dc217-0257-1f76-3db8-e4d90d7bedae@electromag.com.au \
    --to=preid@electromag.com.au \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-pm@vger.kernel.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.