Skip to content

Commit

Permalink
drivers/leds/leds-lp5521.c: change some macros to functions
Browse files Browse the repository at this point in the history
Some small macros changed to inline functions to have proper type
checking.

Signed-off-by: Samu Onkalo <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Samu Onkalo authored and torvalds committed Nov 24, 2010
1 parent a0822c5 commit 9fdb18b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9fdb18b

Please sign in to comment.