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

nfc: pn533: Constify pn533_phy_ops

Neither the driver or the core modifies the pn533_phy_ops struct, so
make them const to allow the compiler to put the static structs in
read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Rikard Falkeborn and committed by
David S. Miller
bc642817 be5f60d8

+6 -6
+1 -1
drivers/nfc/pn533/i2c.c
··· 156 156 return IRQ_HANDLED; 157 157 } 158 158 159 - static struct pn533_phy_ops i2c_phy_ops = { 159 + static const struct pn533_phy_ops i2c_phy_ops = { 160 160 .send_frame = pn533_i2c_send_frame, 161 161 .send_ack = pn533_i2c_send_ack, 162 162 .abort_cmd = pn533_i2c_abort_cmd,
+1 -1
drivers/nfc/pn533/pn533.c
··· 2733 2733 struct pn533 *pn53x_common_init(u32 device_type, 2734 2734 enum pn533_protocol_type protocol_type, 2735 2735 void *phy, 2736 - struct pn533_phy_ops *phy_ops, 2736 + const struct pn533_phy_ops *phy_ops, 2737 2737 struct pn533_frame_ops *fops, 2738 2738 struct device *dev) 2739 2739 {
+2 -2
drivers/nfc/pn533/pn533.h
··· 177 177 178 178 struct device *dev; 179 179 void *phy; 180 - struct pn533_phy_ops *phy_ops; 180 + const struct pn533_phy_ops *phy_ops; 181 181 }; 182 182 183 183 typedef int (*pn533_send_async_complete_t) (struct pn533 *dev, void *arg, ··· 232 232 struct pn533 *pn53x_common_init(u32 device_type, 233 233 enum pn533_protocol_type protocol_type, 234 234 void *phy, 235 - struct pn533_phy_ops *phy_ops, 235 + const struct pn533_phy_ops *phy_ops, 236 236 struct pn533_frame_ops *fops, 237 237 struct device *dev); 238 238
+1 -1
drivers/nfc/pn533/uart.c
··· 123 123 return 0; 124 124 } 125 125 126 - static struct pn533_phy_ops uart_phy_ops = { 126 + static const struct pn533_phy_ops uart_phy_ops = { 127 127 .send_frame = pn532_uart_send_frame, 128 128 .send_ack = pn532_uart_send_ack, 129 129 .abort_cmd = pn532_uart_abort_cmd,
+1 -1
drivers/nfc/pn533/usb.c
··· 429 429 } 430 430 } 431 431 432 - static struct pn533_phy_ops usb_phy_ops = { 432 + static const struct pn533_phy_ops usb_phy_ops = { 433 433 .send_frame = pn533_usb_send_frame, 434 434 .send_ack = pn533_usb_send_ack, 435 435 .abort_cmd = pn533_usb_abort_cmd,