Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: ds2404: remove ds2404_chip_ops

There is only one ds2404_chip_ops struct that is implemented, remove the
unnecessary indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

+3 -19
+3 -19
drivers/rtc/rtc-ds2404.c
··· 23 23 #define DS2404_COPY_SCRATCHPAD_CMD 0x55 24 24 #define DS2404_READ_MEMORY_CMD 0xf0 25 25 26 - struct ds2404; 27 - 28 - struct ds2404_chip_ops { 29 - int (*map_io)(struct ds2404 *chip, struct platform_device *pdev, 30 - struct ds2404_platform_data *pdata); 31 - void (*unmap_io)(struct ds2404 *chip); 32 - }; 33 - 34 26 #define DS2404_RST 0 35 27 #define DS2404_CLK 1 36 28 #define DS2404_DQ 2 ··· 34 42 35 43 struct ds2404 { 36 44 struct ds2404_gpio *gpio; 37 - const struct ds2404_chip_ops *ops; 38 45 struct rtc_device *rtc; 39 46 }; 40 47 ··· 79 88 for (i = 0; i < ARRAY_SIZE(ds2404_gpio); i++) 80 89 gpio_free(ds2404_gpio[i].gpio); 81 90 } 82 - 83 - static const struct ds2404_chip_ops ds2404_gpio_ops = { 84 - .map_io = ds2404_gpio_map, 85 - .unmap_io = ds2404_gpio_unmap, 86 - }; 87 91 88 92 static void ds2404_reset(struct device *dev) 89 93 { ··· 212 226 if (!chip) 213 227 return -ENOMEM; 214 228 215 - chip->ops = &ds2404_gpio_ops; 216 - 217 229 chip->rtc = devm_rtc_allocate_device(&pdev->dev); 218 230 if (IS_ERR(chip->rtc)) 219 231 return PTR_ERR(chip->rtc); 220 232 221 - retval = chip->ops->map_io(chip, pdev, pdata); 233 + retval = ds2404_gpio_map(chip, pdev, pdata); 222 234 if (retval) 223 235 goto err_chip; 224 236 ··· 237 253 return 0; 238 254 239 255 err_io: 240 - chip->ops->unmap_io(chip); 256 + ds2404_gpio_unmap(chip); 241 257 err_chip: 242 258 return retval; 243 259 } ··· 246 262 { 247 263 struct ds2404 *chip = platform_get_drvdata(dev); 248 264 249 - chip->ops->unmap_io(chip); 265 + ds2404_gpio_unmap(chip); 250 266 251 267 return 0; 252 268 }