@@ -64,18 +64,19 @@ static void gpio_beeper_close(struct input_dev *input)
static int gpio_beeper_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct gpio_beeper *beep;
struct input_dev *input;
- beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL);
+ beep = devm_kzalloc(dev, sizeof(*beep), GFP_KERNEL);
if (!beep)
return -ENOMEM;
- beep->desc = devm_gpiod_get(&pdev->dev, NULL, GPIOD_OUT_LOW);
+ beep->desc = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW);
if (IS_ERR(beep->desc))
return PTR_ERR(beep->desc);
- input = devm_input_allocate_device(&pdev->dev);
+ input = devm_input_allocate_device(dev);
if (!input)
return -ENOMEM;
Using explicit struct device variable makes code a bit more readable. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> --- Note: and it become more usefull one patch later drivers/input/misc/gpio-beeper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)