Staging: greybus: Convert macro definitions to
Subsystems (4)
cover Staging: greybus: Convert macro definitions to
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.
Sumitra Sharma (3):
Staging: greybus: Convert macro gpio_chip_to_gb_gpio_controller to an
inline function
Staging: greybus: Convert macro struct gb_audio_manager_module to an
inline function
Staging: greybus: Convert macro struct pwm_chip_to_gb_pwm_chip to an
inline function
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 1/3 Staging: greybus: Convert macro gpio_chip_to_gb_gpio_controller to an inline function
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 2/3 Staging: greybus: Convert macro struct gb_audio_manager_module to an inline function
In reply to Sumitra SharmaConvert 'struct 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 3/3 Staging: greybus: Convert macro struct pwm_chip_to_gb_pwm_chip to an inline function
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
Quoted 11 lines · 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.
Sumitra Sharma (3):
Staging: greybus: Convert macrogpio_chip_to_gb_gpio_controllerto an
inline function
Staging: greybus: Convert macro structgb_audio_manager_moduleto an
inline function
Staging: greybus: Convert macro structpwm_chip_to_gb_pwm_chipto an
inline function
Hi Sumitra,
Please review:
https://kernelnewbies.org/Outreachyfirstpatch#:~:text=Following%20the%20Driver%20commit%20style
That is the section on 'Following the driver commit style'.
Cover letter Subject seems to be needlessly truncated.
Alison
Quoted 10 lines
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