staging: greybus: Use Inline fuctions
Subsystems (4)
v3 cover staging: greybus: Use Inline fuctions
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 <[email protected]>
Changes in v3: Change patch subjects to length 80 chars, noted by Alison Schofield <[email protected]>
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(-)
Signature · 1 line
2.25.1
PATCH v3 1/3 staging: greybus: Inline gpio_chip_to_gb_gpio_controller()
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.
--- drivers/staging/greybus/gpio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/greybus/gpio.c +5 -2
@@ -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) {
Signature · 1 line
2.25.1
PATCH v3 2/3 staging: greybus: Inline gb_audio_manager_module()
In reply to Sumitra SharmaConvert '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.
--- drivers/staging/greybus/audio_manager_module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/greybus/audio_manager_module.c +5 -2
@@ -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;
Signature · 1 line
2.25.1
PATCH v3 3/3 staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
In reply to Sumitra SharmaConvert '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.
--- drivers/staging/greybus/pwm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/greybus/pwm.c +4 -2
@@ -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) {
Signature · 1 line
2.25.1
Greg KH
maintainerRe: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
Quoted 32 lines · 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 <[email protected]>--- drivers/staging/greybus/pwm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/greybus/pwm.c +4
-2@@ -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) {Signature · 1 line
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
Re: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
Quoted 27 lines · Greg KH
Quoted 26 lines · 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 <[email protected]>--- drivers/staging/greybus/pwm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/greybus/pwm.c +4
-2@@ -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); +}
Quoted 10 lines
Quoted 6 lines
drivers/staging/greybus/pwm.c +0
-0static int gb_pwm_count_operation (struct gb_pwm_chip *pwmc) {Signature · 1 line
2.25.1This 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
Quoted 3 lines
thanks,
greg k-h
Re: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
Quoted 39 lines · Sumitra Sharma
Quoted 27 lines · Greg KH
Quoted 26 lines · 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 <[email protected]>--- drivers/staging/greybus/pwm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/greybus/pwm.c +4
-2@@ -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); +}Quoted 10 lines
Quoted 6 lines
drivers/staging/greybus/pwm.c +0
-1static 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?
Quoted 4 lines
Hi greg,
I am confused, will that be a totally new patch or a new version(v4 in this case)?
New version.
julia
Quoted 10 lines
Regards,
Sumitra
Quoted 3 lines
thanks,
greg k-h
Re: [PATCH v3 3/3] staging: greybus: Inline pwm_chip_to_gb_pwm_chip()
Quoted 43 lines · Julia Lawall
Quoted 39 lines · Sumitra Sharma
Quoted 37 lines · Greg KH
Quoted 29 lines · 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 <[email protected]>--- drivers/staging/greybus/pwm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/greybus/pwm.c +4
-3@@ -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) { --Quoted 3 lines
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?
Quoted 7 lines
Quoted 4 lines
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
Quoted 12 lines
julia
Quoted 10 lines
Regards,
Sumitra
Quoted 3 lines
thanks,
greg k-h