From: Samu Onkalo Date: Wed, 24 Nov 2010 20:57:02 +0000 (-0800) Subject: drivers/leds/leds-lp5521.c: change some macros to functions X-Git-Tag: v2.6.37-rc4~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fdb18b6cb225fa7a874985fcb4a370cce1ac086;p=platform%2Fkernel%2Flinux-stable.git drivers/leds/leds-lp5521.c: change some macros to functions Some small macros changed to inline functions to have proper type checking. Signed-off-by: Samu Onkalo Cc: Richard Purdie Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 3782f31..fe69e52 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -125,11 +125,22 @@ struct lp5521_chip { u8 num_leds; }; -#define cdev_to_led(c) container_of(c, struct lp5521_led, cdev) -#define engine_to_lp5521(eng) container_of((eng), struct lp5521_chip, \ - engines[(eng)->id - 1]) -#define led_to_lp5521(led) container_of((led), struct lp5521_chip, \ - leds[(led)->id]) +static inline struct lp5521_led *cdev_to_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct lp5521_led, cdev); +} + +static inline struct lp5521_chip *engine_to_lp5521(struct lp5521_engine *engine) +{ + return container_of(engine, struct lp5521_chip, + engines[engine->id - 1]); +} + +static inline struct lp5521_chip *led_to_lp5521(struct lp5521_led *led) +{ + return container_of(led, struct lp5521_chip, + leds[led->id]); +} static void lp5521_led_brightness_work(struct work_struct *work);