linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] staging: greybus: Use Inline fuctions
@ 2023-03-25  8:23 Sumitra Sharma
  2023-03-25  8:23 ` [PATCH v3 1/3] staging: greybus: Inline gpio_chip_to_gb_gpio_controller() Sumitra Sharma
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sumitra Sharma @ 2023-03-25  8:23 UTC (permalink / raw)
  To: outreachy
  Cc: johan, elder, gregkh, greybus-dev, linux-staging, linux-kernel,
	Sumitra Sharma

Convert macros 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.

Changes in v2: Change patch subjects, noted by Alison Schofield
<alison.schofield@intel.com>

Changes in v3: Change patch subjects to length 80 chars,      
noted by Alison Schofield <alison.schofield@intel.com>

Sumitra Sharma (3):
  staging: greybus: Inline gpio_chip_to_gb_gpio_controller()
  staging: greybus: Inline gb_audio_manager_module()
  staging: greybus: Inline pwm_chip_to_gb_pwm_chip()

 drivers/staging/greybus/audio_manager_module.c | 7 +++++--
 drivers/staging/greybus/gpio.c                 | 7 +++++--
 drivers/staging/greybus/pwm.c                  | 6 ++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/3] staging: greybus: Inline gpio_chip_to_gb_gpio_controller()
  2023-03-25  8:23 [PATCH v3 0/3] staging: greybus: Use Inline fuctions Sumitra Sharma
@ 2023-03-25  8:23 ` Sumitra Sharma
  2023-03-25  8:31 ` [PATCH v3 2/3] staging: greybus: Inline gb_audio_manager_module() Sumitra Sharma
  2023-03-25  8:31 ` [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip() Sumitra Sharma
  2 siblings, 0 replies; 8+ messages in thread
From: Sumitra Sharma @ 2023-03-25  8:23 UTC (permalink / raw)
  To: outreachy
  Cc: johan, elder, gregkh, greybus-dev, linux-staging, linux-kernel,
	Sumitra Sharma

Convert 'gpio_chip_to_gb_gpio_controller' 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/gpio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index d729b922a750..2a115a8fc263 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -41,8 +41,11 @@ struct gb_gpio_controller {
 	struct irq_chip		irqc;
 	struct mutex		irq_lock;
 };
-#define gpio_chip_to_gb_gpio_controller(chip) \
-	container_of(chip, struct gb_gpio_controller, chip)
+
+static inline struct gb_gpio_controller *gpio_chip_to_gb_gpio_controller(struct gpio_chip *chip)
+{
+	return container_of(chip, struct gb_gpio_controller, chip);
+}
 
 static struct gpio_chip *irq_data_to_gpio_chip(struct irq_data *d)
 {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/3] staging: greybus: Inline gb_audio_manager_module()
  2023-03-25  8:23 [PATCH v3 0/3] staging: greybus: Use Inline fuctions Sumitra Sharma
  2023-03-25  8:23 ` [PATCH v3 1/3] staging: greybus: Inline gpio_chip_to_gb_gpio_controller() Sumitra Sharma
@ 2023-03-25  8:31 ` Sumitra Sharma
  2023-03-25  8:31 ` [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip() Sumitra Sharma
  2 siblings, 0 replies; 8+ messages in thread
From: Sumitra Sharma @ 2023-03-25  8:31 UTC (permalink / raw)
  To: outreachy
  Cc: johan, elder, gregkh, greybus-dev, linux-staging, linux-kernel,
	Sumitra Sharma

Convert 'gb_audio_manager_module' 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/audio_manager_module.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
index 81b4ba607a0e..5f9dcbdbc191 100644
--- a/drivers/staging/greybus/audio_manager_module.c
+++ b/drivers/staging/greybus/audio_manager_module.c
@@ -12,8 +12,11 @@
 
 #define to_gb_audio_module_attr(x)	\
 		container_of(x, struct gb_audio_manager_module_attribute, attr)
-#define to_gb_audio_module(x)		\
-		container_of(x, struct gb_audio_manager_module, kobj)
+
+static inline struct gb_audio_manager_module *to_gb_audio_module(struct kobject *kobj)
+{
+	return container_of(kobj, struct gb_audio_manager_module, kobj);
+}
 
 struct gb_audio_manager_module_attribute {
 	struct attribute attr;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
  2023-03-25  8:23 [PATCH v3 0/3] staging: greybus: Use Inline fuctions Sumitra Sharma
  2023-03-25  8:23 ` [PATCH v3 1/3] staging: greybus: Inline gpio_chip_to_gb_gpio_controller() Sumitra Sharma
  2023-03-25  8:31 ` [PATCH v3 2/3] staging: greybus: Inline gb_audio_manager_module() Sumitra Sharma
@ 2023-03-25  8:31 ` Sumitra Sharma
  2023-03-25  8:55   ` Greg KH
  2 siblings, 1 reply; 8+ messages in thread
From: Sumitra Sharma @ 2023-03-25  8:31 UTC (permalink / raw)
  To: outreachy
  Cc: johan, elder, gregkh, greybus-dev, linux-staging, linux-kernel,
	Sumitra Sharma

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
  2023-03-25  8:31 ` [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip() Sumitra Sharma
@ 2023-03-25  8:55   ` Greg KH
  2023-03-26  5:24     ` Sumitra Sharma
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2023-03-25  8:55 UTC (permalink / raw)
  To: Sumitra Sharma
  Cc: outreachy, johan, elder, greybus-dev, linux-staging, linux-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
  2023-03-25  8:55   ` Greg KH
@ 2023-03-26  5:24     ` Sumitra Sharma
  2023-03-26  5:51       ` Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Sumitra Sharma @ 2023-03-26  5:24 UTC (permalink / raw)
  To: Greg KH; +Cc: outreachy, johan, elder, greybus-dev, linux-staging, linux-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
  2023-03-26  5:24     ` Sumitra Sharma
@ 2023-03-26  5:51       ` Julia Lawall
  2023-03-26  6:38         ` Sumitra Sharma
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2023-03-26  5:51 UTC (permalink / raw)
  To: Sumitra Sharma
  Cc: Greg KH, outreachy, johan, elder, greybus-dev, linux-staging,
	linux-kernel



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
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
  2023-03-26  5:51       ` Julia Lawall
@ 2023-03-26  6:38         ` Sumitra Sharma
  0 siblings, 0 replies; 8+ messages in thread
From: Sumitra Sharma @ 2023-03-26  6:38 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Greg KH, outreachy, johan, elder, greybus-dev, linux-staging,
	linux-kernel

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
> >
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-26  6:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-25  8:23 [PATCH v3 0/3] staging: greybus: Use Inline fuctions Sumitra Sharma
2023-03-25  8:23 ` [PATCH v3 1/3] staging: greybus: Inline gpio_chip_to_gb_gpio_controller() Sumitra Sharma
2023-03-25  8:31 ` [PATCH v3 2/3] staging: greybus: Inline gb_audio_manager_module() Sumitra Sharma
2023-03-25  8:31 ` [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip() Sumitra Sharma
2023-03-25  8:55   ` Greg KH
2023-03-26  5:24     ` Sumitra Sharma
2023-03-26  5:51       ` Julia Lawall
2023-03-26  6:38         ` Sumitra Sharma

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).