rtc: ds2404: remove ds2404_chip_ops
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 19 Apr 2019 08:25:00 +0000 (10:25 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 19 Apr 2019 20:37:17 +0000 (22:37 +0200)
There is only one ds2404_chip_ops struct that is implemented, remove the
unnecessary indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-ds2404.c

index 89402ac11cfaba7136c259cd2e6e1b132e70d94c..c6b73dcf9d6297934acbe1500a840b16157607a8 100644 (file)
 #define DS2404_COPY_SCRATCHPAD_CMD 0x55
 #define DS2404_READ_MEMORY_CMD 0xf0
 
-struct ds2404;
-
-struct ds2404_chip_ops {
-       int (*map_io)(struct ds2404 *chip, struct platform_device *pdev,
-                     struct ds2404_platform_data *pdata);
-       void (*unmap_io)(struct ds2404 *chip);
-};
-
 #define DS2404_RST     0
 #define DS2404_CLK     1
 #define DS2404_DQ      2
@@ -42,7 +34,6 @@ struct ds2404_gpio {
 
 struct ds2404 {
        struct ds2404_gpio *gpio;
-       const struct ds2404_chip_ops *ops;
        struct rtc_device *rtc;
 };
 
@@ -89,11 +80,6 @@ static void ds2404_gpio_unmap(struct ds2404 *chip)
                gpio_free(ds2404_gpio[i].gpio);
 }
 
-static const struct ds2404_chip_ops ds2404_gpio_ops = {
-       .map_io         = ds2404_gpio_map,
-       .unmap_io       = ds2404_gpio_unmap,
-};
-
 static void ds2404_reset(struct device *dev)
 {
        gpio_set_value(ds2404_gpio[DS2404_RST].gpio, 0);
@@ -226,13 +212,11 @@ static int rtc_probe(struct platform_device *pdev)
        if (!chip)
                return -ENOMEM;
 
-       chip->ops = &ds2404_gpio_ops;
-
        chip->rtc = devm_rtc_allocate_device(&pdev->dev);
        if (IS_ERR(chip->rtc))
                return PTR_ERR(chip->rtc);
 
-       retval = chip->ops->map_io(chip, pdev, pdata);
+       retval = ds2404_gpio_map(chip, pdev, pdata);
        if (retval)
                goto err_chip;
 
@@ -253,7 +237,7 @@ static int rtc_probe(struct platform_device *pdev)
        return 0;
 
 err_io:
-       chip->ops->unmap_io(chip);
+       ds2404_gpio_unmap(chip);
 err_chip:
        return retval;
 }
@@ -262,7 +246,7 @@ static int rtc_remove(struct platform_device *dev)
 {
        struct ds2404 *chip = platform_get_drvdata(dev);
 
-       chip->ops->unmap_io(chip);
+       ds2404_gpio_unmap(chip);
 
        return 0;
 }