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

[PATCH] constify rtc_class_ops: update drivers

Update RTC framework so that drivers can constify their method tables, moving
them from ".data" to ".rodata". Then update the drivers.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

David Brownell and committed by
Linus Torvalds
ff8371ac db621f17

+26 -26
+1 -1
drivers/rtc/class.c
··· 39 39 * Returns the pointer to the new struct class device. 40 40 */ 41 41 struct rtc_device *rtc_device_register(const char *name, struct device *dev, 42 - struct rtc_class_ops *ops, 42 + const struct rtc_class_ops *ops, 43 43 struct module *owner) 44 44 { 45 45 struct rtc_device *rtc;
+1 -1
drivers/rtc/rtc-at91.c
··· 267 267 return IRQ_NONE; /* not handled */ 268 268 } 269 269 270 - static struct rtc_class_ops at91_rtc_ops = { 270 + static const struct rtc_class_ops at91_rtc_ops = { 271 271 .ioctl = at91_rtc_ioctl, 272 272 .read_time = at91_rtc_readtime, 273 273 .set_time = at91_rtc_settime,
+2 -2
drivers/rtc/rtc-dev.c
··· 24 24 int err; 25 25 struct rtc_device *rtc = container_of(inode->i_cdev, 26 26 struct rtc_device, char_dev); 27 - struct rtc_class_ops *ops = rtc->ops; 27 + const struct rtc_class_ops *ops = rtc->ops; 28 28 29 29 /* We keep the lock as long as the device is in use 30 30 * and return immediately if busy ··· 209 209 int err = 0; 210 210 struct class_device *class_dev = file->private_data; 211 211 struct rtc_device *rtc = to_rtc_device(class_dev); 212 - struct rtc_class_ops *ops = rtc->ops; 212 + const struct rtc_class_ops *ops = rtc->ops; 213 213 struct rtc_time tm; 214 214 struct rtc_wkalrm alarm; 215 215 void __user *uarg = (void __user *) arg;
+1 -1
drivers/rtc/rtc-ds1307.c
··· 178 178 return 0; 179 179 } 180 180 181 - static struct rtc_class_ops ds13xx_rtc_ops = { 181 + static const struct rtc_class_ops ds13xx_rtc_ops = { 182 182 .read_time = ds1307_get_time, 183 183 .set_time = ds1307_set_time, 184 184 };
+1 -1
drivers/rtc/rtc-ds1553.c
··· 250 250 return 0; 251 251 } 252 252 253 - static struct rtc_class_ops ds1553_rtc_ops = { 253 + static const struct rtc_class_ops ds1553_rtc_ops = { 254 254 .read_time = ds1553_rtc_read_time, 255 255 .set_time = ds1553_rtc_set_time, 256 256 .read_alarm = ds1553_rtc_read_alarm,
+1 -1
drivers/rtc/rtc-ds1672.c
··· 156 156 } 157 157 static DEVICE_ATTR(control, S_IRUGO, show_control, NULL); 158 158 159 - static struct rtc_class_ops ds1672_rtc_ops = { 159 + static const struct rtc_class_ops ds1672_rtc_ops = { 160 160 .read_time = ds1672_rtc_read_time, 161 161 .set_time = ds1672_rtc_set_time, 162 162 .set_mmss = ds1672_rtc_set_mmss,
+1 -1
drivers/rtc/rtc-ds1742.c
··· 116 116 return 0; 117 117 } 118 118 119 - static struct rtc_class_ops ds1742_rtc_ops = { 119 + static const struct rtc_class_ops ds1742_rtc_ops = { 120 120 .read_time = ds1742_rtc_read_time, 121 121 .set_time = ds1742_rtc_set_time, 122 122 };
+1 -1
drivers/rtc/rtc-ep93xx.c
··· 73 73 return 0; 74 74 } 75 75 76 - static struct rtc_class_ops ep93xx_rtc_ops = { 76 + static const struct rtc_class_ops ep93xx_rtc_ops = { 77 77 .read_time = ep93xx_rtc_read_time, 78 78 .set_time = ep93xx_rtc_set_time, 79 79 .set_mmss = ep93xx_rtc_set_mmss,
+1 -1
drivers/rtc/rtc-isl1208.c
··· 390 390 return isl1208_i2c_read_alarm(to_i2c_client(dev), alarm); 391 391 } 392 392 393 - static struct rtc_class_ops isl1208_rtc_ops = { 393 + static const struct rtc_class_ops isl1208_rtc_ops = { 394 394 .proc = isl1208_rtc_proc, 395 395 .read_time = isl1208_rtc_read_time, 396 396 .set_time = isl1208_rtc_set_time,
+1 -1
drivers/rtc/rtc-m48t86.c
··· 138 138 return 0; 139 139 } 140 140 141 - static struct rtc_class_ops m48t86_rtc_ops = { 141 + static const struct rtc_class_ops m48t86_rtc_ops = { 142 142 .read_time = m48t86_rtc_read_time, 143 143 .set_time = m48t86_rtc_set_time, 144 144 .proc = m48t86_rtc_proc,
+1 -1
drivers/rtc/rtc-max6902.c
··· 207 207 return max6902_set_datetime(dev, tm); 208 208 } 209 209 210 - static struct rtc_class_ops max6902_rtc_ops = { 210 + static const struct rtc_class_ops max6902_rtc_ops = { 211 211 .read_time = max6902_read_time, 212 212 .set_time = max6902_set_time, 213 213 };
+1 -1
drivers/rtc/rtc-pcf8563.c
··· 227 227 return pcf8563_set_datetime(to_i2c_client(dev), tm); 228 228 } 229 229 230 - static struct rtc_class_ops pcf8563_rtc_ops = { 230 + static const struct rtc_class_ops pcf8563_rtc_ops = { 231 231 .read_time = pcf8563_rtc_read_time, 232 232 .set_time = pcf8563_rtc_set_time, 233 233 };
+1 -1
drivers/rtc/rtc-pcf8583.c
··· 273 273 return ret; 274 274 } 275 275 276 - static struct rtc_class_ops pcf8583_rtc_ops = { 276 + static const struct rtc_class_ops pcf8583_rtc_ops = { 277 277 .read_time = pcf8583_rtc_read_time, 278 278 .set_time = pcf8583_rtc_set_time, 279 279 };
+1 -1
drivers/rtc/rtc-pl031.c
··· 128 128 return 0; 129 129 } 130 130 131 - static struct rtc_class_ops pl031_ops = { 131 + static const struct rtc_class_ops pl031_ops = { 132 132 .open = pl031_open, 133 133 .release = pl031_release, 134 134 .ioctl = pl031_ioctl,
+1 -1
drivers/rtc/rtc-proc.c
··· 23 23 { 24 24 int err; 25 25 struct class_device *class_dev = seq->private; 26 - struct rtc_class_ops *ops = to_rtc_device(class_dev)->ops; 26 + const struct rtc_class_ops *ops = to_rtc_device(class_dev)->ops; 27 27 struct rtc_wkalrm alrm; 28 28 struct rtc_time tm; 29 29
+1 -1
drivers/rtc/rtc-rs5c348.c
··· 140 140 return 0; 141 141 } 142 142 143 - static struct rtc_class_ops rs5c348_rtc_ops = { 143 + static const struct rtc_class_ops rs5c348_rtc_ops = { 144 144 .read_time = rs5c348_rtc_read_time, 145 145 .set_time = rs5c348_rtc_set_time, 146 146 };
+1 -1
drivers/rtc/rtc-rs5c372.c
··· 160 160 return 0; 161 161 } 162 162 163 - static struct rtc_class_ops rs5c372_rtc_ops = { 163 + static const struct rtc_class_ops rs5c372_rtc_ops = { 164 164 .proc = rs5c372_rtc_proc, 165 165 .read_time = rs5c372_rtc_read_time, 166 166 .set_time = rs5c372_rtc_set_time,
+1 -1
drivers/rtc/rtc-s3c.c
··· 386 386 free_irq(s3c_rtc_tickno, rtc_dev); 387 387 } 388 388 389 - static struct rtc_class_ops s3c_rtcops = { 389 + static const struct rtc_class_ops s3c_rtcops = { 390 390 .open = s3c_rtc_open, 391 391 .release = s3c_rtc_release, 392 392 .ioctl = s3c_rtc_ioctl,
+1 -1
drivers/rtc/rtc-sa1100.c
··· 303 303 return 0; 304 304 } 305 305 306 - static struct rtc_class_ops sa1100_rtc_ops = { 306 + static const struct rtc_class_ops sa1100_rtc_ops = { 307 307 .open = sa1100_rtc_open, 308 308 .read_callback = sa1100_rtc_read_callback, 309 309 .release = sa1100_rtc_release,
+1 -1
drivers/rtc/rtc-test.c
··· 75 75 } 76 76 } 77 77 78 - static struct rtc_class_ops test_rtc_ops = { 78 + static const struct rtc_class_ops test_rtc_ops = { 79 79 .proc = test_rtc_proc, 80 80 .read_time = test_rtc_read_time, 81 81 .set_time = test_rtc_set_time,
+1 -1
drivers/rtc/rtc-v3020.c
··· 149 149 return 0; 150 150 } 151 151 152 - static struct rtc_class_ops v3020_rtc_ops = { 152 + static const struct rtc_class_ops v3020_rtc_ops = { 153 153 .read_time = v3020_read_time, 154 154 .set_time = v3020_set_time, 155 155 };
+1 -1
drivers/rtc/rtc-vr41xx.c
··· 296 296 return IRQ_HANDLED; 297 297 } 298 298 299 - static struct rtc_class_ops vr41xx_rtc_ops = { 299 + static const struct rtc_class_ops vr41xx_rtc_ops = { 300 300 .release = vr41xx_rtc_release, 301 301 .ioctl = vr41xx_rtc_ioctl, 302 302 .read_time = vr41xx_rtc_read_time,
+1 -1
drivers/rtc/rtc-x1205.c
··· 460 460 return 0; 461 461 } 462 462 463 - static struct rtc_class_ops x1205_rtc_ops = { 463 + static const struct rtc_class_ops x1205_rtc_ops = { 464 464 .proc = x1205_rtc_proc, 465 465 .read_time = x1205_rtc_read_time, 466 466 .set_time = x1205_rtc_set_time,
+2 -2
include/linux/rtc.h
··· 141 141 int id; 142 142 char name[RTC_DEVICE_NAME_SIZE]; 143 143 144 - struct rtc_class_ops *ops; 144 + const struct rtc_class_ops *ops; 145 145 struct mutex ops_lock; 146 146 147 147 struct class_device *rtc_dev; ··· 172 172 173 173 extern struct rtc_device *rtc_device_register(const char *name, 174 174 struct device *dev, 175 - struct rtc_class_ops *ops, 175 + const struct rtc_class_ops *ops, 176 176 struct module *owner); 177 177 extern void rtc_device_unregister(struct rtc_device *rdev); 178 178 extern int rtc_interface_register(struct class_interface *intf);