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

rtc: ep93xx: use rtc_add_group

Use rtc_add_group to add the sysfs group in a race free manner.
This has the side effect of moving the files to their proper location.

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

+4 -16
+4 -16
drivers/rtc/rtc-ep93xx.c
··· 94 94 { 95 95 unsigned short preload; 96 96 97 - ep93xx_rtc_get_swcomp(dev, &preload, NULL); 97 + ep93xx_rtc_get_swcomp(dev->parent, &preload, NULL); 98 98 99 99 return sprintf(buf, "%d\n", preload); 100 100 } ··· 105 105 { 106 106 unsigned short delete; 107 107 108 - ep93xx_rtc_get_swcomp(dev, NULL, &delete); 108 + ep93xx_rtc_get_swcomp(dev->parent, NULL, &delete); 109 109 110 110 return sprintf(buf, "%d\n", delete); 111 111 } ··· 144 144 145 145 ep93xx_rtc->rtc->ops = &ep93xx_rtc_ops; 146 146 147 - err = rtc_register_device(ep93xx_rtc->rtc); 147 + err = rtc_add_group(ep93xx_rtc->rtc, &ep93xx_rtc_sysfs_files); 148 148 if (err) 149 149 return err; 150 150 151 - err = sysfs_create_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files); 152 - if (err) 153 - return err; 154 - 155 - return 0; 156 - } 157 - 158 - static int ep93xx_rtc_remove(struct platform_device *pdev) 159 - { 160 - sysfs_remove_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files); 161 - 162 - return 0; 151 + return rtc_register_device(ep93xx_rtc->rtc); 163 152 } 164 153 165 154 static struct platform_driver ep93xx_rtc_driver = { ··· 156 167 .name = "ep93xx-rtc", 157 168 }, 158 169 .probe = ep93xx_rtc_probe, 159 - .remove = ep93xx_rtc_remove, 160 170 }; 161 171 162 172 module_platform_driver(ep93xx_rtc_driver);