From: "Ognjen Galić" <smclt30p@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
"Len Brown" <lenb@kernel.org>,
"Robert Moore" <robert.moore@intel.com>,
"Lv Zheng" <lv.zheng@intel.com>,
"ACPI Devel Maling List" <linux-acpi@vger.kernel.org>,
devel@acpica.org, "Darren Hart" <dvhart@infradead.org>,
"Andy Shevchenko" <andy@infradead.org>,
"Henrique de Moraes Holschuh" <ibm-acpi@hmh.eng.br>,
"Sebastian Reichel" <sre@kernel.org>,
"Platform Driver" <platform-driver-x86@vger.kernel.org>,
ibm-acpi-devel@lists.sourceforge.net,
"Linux PM" <linux-pm@vger.kernel.org>,
"Christoph Böhmwalder" <christoph@boehmwalder.at>,
"Kevin Locke" <kevin@kevinlocke.name>
Subject: Re: [PATCH v10 2/4] pm: add to_power_supply macro to the API
Date: Sat, 30 Dec 2017 00:49:45 +0100 [thread overview]
Message-ID: <1514591385.9667.0.camel@gmail.com> (raw)
In-Reply-To: <CAHp75VcpuQz4n_wRJ+f-OKf4VAVVhXzKAC+FD0EE52cs+Zv22Q@mail.gmail.com>
On Čet, 2017-12-28 at 10:19 +0200, Andy Shevchenko wrote:
> On Sat, Dec 23, 2017 at 12:53 PM, Ognjen Galic <smclt30p@gmail.com>
> wrote:
> >
> > This patch adds the to_power_supply macro to upcast
> > a device to a power_supply struct.
> >
> > This is needed because the same piece of code using
> > container_of is used in various other places, so we
> > abstract away such low-level operations via a macro.
> >
> > ---
> This is wrong! You have to use *existing* --- line below. Otherwise
> all mail parsers will cut this out including your SoB tag.
>
My bad I guess. Want another patch revision with that fixed or
something?
> >
> >
> > v9:
> > * Split the pm changes from the thinkpad_acpi patch
> > into its own patch
> >
> > v10:
> > * No changes in this patch in v10
> >
> > Signed-off-by: Ognjen Galic <smclt30p@gmail.com>
> Missed:
>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> >
> > ---
> > drivers/power/supply/power_supply_core.c | 2 +-
> > include/linux/power_supply.h | 2 ++
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/power/supply/power_supply_core.c
> > b/drivers/power/supply/power_supply_core.c
> > index 82f998a..feac7b0 100644
> > --- a/drivers/power/supply/power_supply_core.c
> > +++ b/drivers/power/supply/power_supply_core.c
> > @@ -668,7 +668,7 @@ EXPORT_SYMBOL_GPL(power_supply_powers);
> >
> > static void power_supply_dev_release(struct device *dev)
> > {
> > - struct power_supply *psy = container_of(dev, struct
> > power_supply, dev);
> > + struct power_supply *psy = to_power_supply(dev);
> > dev_dbg(dev, "%s\n", __func__);
> > kfree(psy);
> > }
> > diff --git a/include/linux/power_supply.h
> > b/include/linux/power_supply.h
> > index 79e90b3..f0139b4 100644
> > --- a/include/linux/power_supply.h
> > +++ b/include/linux/power_supply.h
> > @@ -371,6 +371,8 @@ devm_power_supply_register_no_ws(struct device
> > *parent,
> > extern void power_supply_unregister(struct power_supply *psy);
> > extern int power_supply_powers(struct power_supply *psy, struct
> > device *dev);
> >
> > +#define to_power_supply(device) container_of(device, struct
> > power_supply, dev)
> > +
> > extern void *power_supply_get_drvdata(struct power_supply *psy);
> > /* For APM emulation, think legacy userspace. */
> > extern struct class *power_supply_class;
> Should fold in the changes you sent as a separate patch.
>
next prev parent reply other threads:[~2017-12-29 23:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-23 10:53 [PATCH v10 2/4] pm: add to_power_supply macro to the API Ognjen Galic
2017-12-28 8:19 ` Andy Shevchenko
2017-12-29 23:49 ` Ognjen Galić [this message]
2017-12-31 9:37 ` Andy Shevchenko
2017-12-31 11:17 ` Rafael J. Wysocki
2017-12-31 12:40 ` Andy Shevchenko
2017-12-31 12:54 ` Ognjen Galić
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=1514591385.9667.0.camel@gmail.com \
--to=smclt30p@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@infradead.org \
--cc=christoph@boehmwalder.at \
--cc=devel@acpica.org \
--cc=dvhart@infradead.org \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ibm-acpi@hmh.eng.br \
--cc=kevin@kevinlocke.name \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@intel.com \
--cc=sre@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 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).