From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ognjen =?UTF-8?Q?Gali=C4=87?= Subject: Re: [PATCH v10 2/4] pm: add to_power_supply macro to the API Date: Sat, 30 Dec 2017 00:49:45 +0100 Message-ID: <1514591385.9667.0.camel@gmail.com> References: <20171223105316.GA4352@thinkpad> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Sender: platform-driver-x86-owner@vger.kernel.org To: Andy Shevchenko Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Len Brown , Robert Moore , Lv Zheng , ACPI Devel Maling List , devel@acpica.org, Darren Hart , Andy Shevchenko , Henrique de Moraes Holschuh , Sebastian Reichel , Platform Driver , ibm-acpi-devel@lists.sourceforge.net, Linux PM , Christoph =?ISO-8859-1?Q?B=F6hmwalder?= , Kevin Locke List-Id: linux-pm@vger.kernel.org On Čet, 2017-12-28 at 10:19 +0200, Andy Shevchenko wrote: > On Sat, Dec 23, 2017 at 12:53 PM, Ognjen Galic > 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 > Missed: > > Suggested-by: Andy Shevchenko > > > > > --- > >  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. >