Convert 'pwm_chip_to_gb_pwm_chip' from a macro to a static
inline function, to make the relevant types apparent in the
definition and to benefit from the type checking performed by
the compiler at call sites.
Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
---
drivers/staging/greybus/pwm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
index 3fda172239d2..88da1d796f13 100644
--- a/drivers/staging/greybus/pwm.c
+++ b/drivers/staging/greybus/pwm.c
@@ -21,9 +21,11 @@ struct gb_pwm_chip {
struct pwm_chip chip;
struct pwm_chip *pwm;
};
-#define pwm_chip_to_gb_pwm_chip(chip) \
- container_of(chip, struct gb_pwm_chip, chip)
+static inline struct gb_pwm_chip *pwm_chip_to_gb_pwm_chip(struct pwm_chip *chip)
+{
+ return container_of(chip, struct gb_pwm_chip, chip);
+}
static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc)
{
--
2.25.1
On Sat, Mar 25, 2023 at 01:31:10AM -0700, Sumitra Sharma wrote:
> Convert 'pwm_chip_to_gb_pwm_chip' from a macro to a static
> inline function, to make the relevant types apparent in the
> definition and to benefit from the type checking performed by
> the compiler at call sites.
>
> Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
> ---
> drivers/staging/greybus/pwm.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
> index 3fda172239d2..88da1d796f13 100644
> --- a/drivers/staging/greybus/pwm.c
> +++ b/drivers/staging/greybus/pwm.c
> @@ -21,9 +21,11 @@ struct gb_pwm_chip {
> struct pwm_chip chip;
> struct pwm_chip *pwm;
> };
> -#define pwm_chip_to_gb_pwm_chip(chip) \
> - container_of(chip, struct gb_pwm_chip, chip)
>
> +static inline struct gb_pwm_chip *pwm_chip_to_gb_pwm_chip(struct pwm_chip *chip)
> +{
> + return container_of(chip, struct gb_pwm_chip, chip);
> +}
>
> static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc)
> {
> --
> 2.25.1
>
>
This patch didn't apply due to changes made in my tree by a patch from
someone else before yours. Can you rebase it and resend?
thanks,
greg k-h
On Sat, Mar 25, 2023 at 09:55:45AM +0100, Greg KH wrote:
> On Sat, Mar 25, 2023 at 01:31:10AM -0700, Sumitra Sharma wrote:
> > Convert 'pwm_chip_to_gb_pwm_chip' from a macro to a static
> > inline function, to make the relevant types apparent in the
> > definition and to benefit from the type checking performed by
> > the compiler at call sites.
> >
> > Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
> > ---
> > drivers/staging/greybus/pwm.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
> > index 3fda172239d2..88da1d796f13 100644
> > --- a/drivers/staging/greybus/pwm.c
> > +++ b/drivers/staging/greybus/pwm.c
> > @@ -21,9 +21,11 @@ struct gb_pwm_chip {
> > struct pwm_chip chip;
> > struct pwm_chip *pwm;
> > };
> > -#define pwm_chip_to_gb_pwm_chip(chip) \
> > - container_of(chip, struct gb_pwm_chip, chip)
> >
> > +static inline struct gb_pwm_chip *pwm_chip_to_gb_pwm_chip(struct pwm_chip *chip)
> > +{
> > + return container_of(chip, struct gb_pwm_chip, chip);
> > +}
> >
> > static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc)
> > {
> > --
> > 2.25.1
> >
> >
>
> This patch didn't apply due to changes made in my tree by a patch from
> someone else before yours. Can you rebase it and resend?
>
Hi greg,
I am confused, will that be a totally new patch or a new version(v4 in
this case)?
Regards,
Sumitra
> thanks,
>
> greg k-h
On Sat, 25 Mar 2023, Sumitra Sharma wrote:
> On Sat, Mar 25, 2023 at 09:55:45AM +0100, Greg KH wrote:
> > On Sat, Mar 25, 2023 at 01:31:10AM -0700, Sumitra Sharma wrote:
> > > Convert 'pwm_chip_to_gb_pwm_chip' from a macro to a static
> > > inline function, to make the relevant types apparent in the
> > > definition and to benefit from the type checking performed by
> > > the compiler at call sites.
> > >
> > > Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
> > > ---
> > > drivers/staging/greybus/pwm.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
> > > index 3fda172239d2..88da1d796f13 100644
> > > --- a/drivers/staging/greybus/pwm.c
> > > +++ b/drivers/staging/greybus/pwm.c
> > > @@ -21,9 +21,11 @@ struct gb_pwm_chip {
> > > struct pwm_chip chip;
> > > struct pwm_chip *pwm;
> > > };
> > > -#define pwm_chip_to_gb_pwm_chip(chip) \
> > > - container_of(chip, struct gb_pwm_chip, chip)
> > >
> > > +static inline struct gb_pwm_chip *pwm_chip_to_gb_pwm_chip(struct pwm_chip *chip)
> > > +{
> > > + return container_of(chip, struct gb_pwm_chip, chip);
> > > +}
> > >
> > > static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc)
> > > {
> > > --
> > > 2.25.1
> > >
> > >
> >
> > This patch didn't apply due to changes made in my tree by a patch from
> > someone else before yours. Can you rebase it and resend?
> >
>
> Hi greg,
>
> I am confused, will that be a totally new patch or a new version(v4 in
> this case)?
New version.
julia
>
> Regards,
>
> Sumitra
>
> > thanks,
> >
> > greg k-h
>
>
On Sun, Mar 26, 2023 at 07:51:50AM +0200, Julia Lawall wrote:
>
>
> On Sat, 25 Mar 2023, Sumitra Sharma wrote:
>
> > On Sat, Mar 25, 2023 at 09:55:45AM +0100, Greg KH wrote:
> > > On Sat, Mar 25, 2023 at 01:31:10AM -0700, Sumitra Sharma wrote:
> > > > Convert 'pwm_chip_to_gb_pwm_chip' from a macro to a static
> > > > inline function, to make the relevant types apparent in the
> > > > definition and to benefit from the type checking performed by
> > > > the compiler at call sites.
> > > >
> > > > Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
> > > > ---
> > > > drivers/staging/greybus/pwm.c | 6 ++++--
> > > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c
> > > > index 3fda172239d2..88da1d796f13 100644
> > > > --- a/drivers/staging/greybus/pwm.c
> > > > +++ b/drivers/staging/greybus/pwm.c
> > > > @@ -21,9 +21,11 @@ struct gb_pwm_chip {
> > > > struct pwm_chip chip;
> > > > struct pwm_chip *pwm;
> > > > };
> > > > -#define pwm_chip_to_gb_pwm_chip(chip) \
> > > > - container_of(chip, struct gb_pwm_chip, chip)
> > > >
> > > > +static inline struct gb_pwm_chip *pwm_chip_to_gb_pwm_chip(struct pwm_chip *chip)
> > > > +{
> > > > + return container_of(chip, struct gb_pwm_chip, chip);
> > > > +}
> > > >
> > > > static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc)
> > > > {
> > > > --
> > > > 2.25.1
> > > >
> > > >
> > >
> > > This patch didn't apply due to changes made in my tree by a patch from
> > > someone else before yours. Can you rebase it and resend?
> > >
> >
> > Hi greg,
> >
> > I am confused, will that be a totally new patch or a new version(v4 in
> > this case)?
>
> New version.
>
Thank you julia.
Regards
Sumitra
> julia
>
> >
> > Regards,
> >
> > Sumitra
> >
> > > thanks,
> > >
> > > greg k-h
> >
> >
© 2016 - 2026 Red Hat, Inc.