diff options
author | Lukas Wunner <lukas@wunner.de> | 2018-09-08 03:59:01 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2018-09-18 18:52:15 -0400 |
commit | 81c4b5bf30de01a0f6b43ccaa1d220f4a0a5d99c (patch) | |
tree | 275be529eee5898b58dd9457b58cc07344692ece | |
parent | d758714235e7abb7984468370c912ca2f4dc4e57 (diff) |
PCI: hotplug: Constify hotplug_slot_ops
Hotplug drivers cannot declare their hotplug_slot_ops const, making them
attractive targets for attackers, because upon registration of a hotplug
slot, __pci_hp_initialize() writes to the "owner" and "mod_name" members
in that struct.
Fix by moving these members to struct hotplug_slot and constify every
driver's hotplug_slot_ops except for pciehp.
pciehp constructs its hotplug_slot_ops at runtime based on the PCIe
port's capabilities, hence cannot declare them const. It can be
converted to __write_rarely once that's mainlined:
http://www.openwall.com/lists/kernel-hardening/2016/11/16/3
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> # drivers/pci/hotplug/rpa*
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> # drivers/platform/x86
Cc: Len Brown <lenb@kernel.org>
Cc: Scott Murray <scott@spiteful.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Oliver OHalloran <oliveroh@au1.ibm.com>
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Corentin Chary <corentin.chary@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>
-rw-r--r-- | drivers/pci/hotplug/acpiphp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpci_hotplug_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp.h | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug_core.c | 27 | ||||
-rw-r--r-- | drivers/pci/hotplug/pnv_php.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp.h | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/s390_pci_hpc.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/sgi_hotplug.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/pci.c | 4 | ||||
-rw-r--r-- | drivers/pci/slot.c | 2 | ||||
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 3 | ||||
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 3 | ||||
-rw-r--r-- | include/linux/pci_hotplug.h | 10 |
17 files changed, 35 insertions, 36 deletions
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index ad32ffbc4b91..e883cef0f3bc 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -57,7 +57,7 @@ static int get_attention_status(struct hotplug_slot *slot, u8 *value); | |||
57 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); | 57 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
58 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); | 58 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
59 | 59 | ||
60 | static struct hotplug_slot_ops acpi_hotplug_slot_ops = { | 60 | static const struct hotplug_slot_ops acpi_hotplug_slot_ops = { |
61 | .enable_slot = enable_slot, | 61 | .enable_slot = enable_slot, |
62 | .disable_slot = disable_slot, | 62 | .disable_slot = disable_slot, |
63 | .set_attention_status = set_attention_status, | 63 | .set_attention_status = set_attention_status, |
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 52a339baf06c..97c32e4c74c8 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c | |||
@@ -57,7 +57,7 @@ static int get_attention_status(struct hotplug_slot *slot, u8 *value); | |||
57 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); | 57 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
58 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); | 58 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
59 | 59 | ||
60 | static struct hotplug_slot_ops cpci_hotplug_slot_ops = { | 60 | static const struct hotplug_slot_ops cpci_hotplug_slot_ops = { |
61 | .enable_slot = enable_slot, | 61 | .enable_slot = enable_slot, |
62 | .disable_slot = disable_slot, | 62 | .disable_slot = disable_slot, |
63 | .set_attention_status = set_attention_status, | 63 | .set_attention_status = set_attention_status, |
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index 5a06636e910a..3409b62fceac 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -560,7 +560,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
560 | return 0; | 560 | return 0; |
561 | } | 561 | } |
562 | 562 | ||
563 | static struct hotplug_slot_ops cpqphp_hotplug_slot_ops = { | 563 | static const struct hotplug_slot_ops cpqphp_hotplug_slot_ops = { |
564 | .set_attention_status = set_attention_status, | 564 | .set_attention_status = set_attention_status, |
565 | .enable_slot = process_SI, | 565 | .enable_slot = process_SI, |
566 | .disable_slot = process_SS, | 566 | .disable_slot = process_SS, |
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h index fddb78606c74..db387e10581e 100644 --- a/drivers/pci/hotplug/ibmphp.h +++ b/drivers/pci/hotplug/ibmphp.h | |||
@@ -740,7 +740,7 @@ int ibmphp_do_disable_slot(struct slot *slot_cur); | |||
740 | int ibmphp_update_slot_info(struct slot *); /* This function is called from HPC, so we need it to not be be static */ | 740 | int ibmphp_update_slot_info(struct slot *); /* This function is called from HPC, so we need it to not be be static */ |
741 | int ibmphp_configure_card(struct pci_func *, u8); | 741 | int ibmphp_configure_card(struct pci_func *, u8); |
742 | int ibmphp_unconfigure_card(struct slot **, int); | 742 | int ibmphp_unconfigure_card(struct slot **, int); |
743 | extern struct hotplug_slot_ops ibmphp_hotplug_slot_ops; | 743 | extern const struct hotplug_slot_ops ibmphp_hotplug_slot_ops; |
744 | 744 | ||
745 | #endif //__IBMPHP_H | 745 | #endif //__IBMPHP_H |
746 | 746 | ||
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 4ea57e9019f1..b82fdc17040d 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
@@ -1259,7 +1259,7 @@ error: | |||
1259 | goto exit; | 1259 | goto exit; |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | struct hotplug_slot_ops ibmphp_hotplug_slot_ops = { | 1262 | const struct hotplug_slot_ops ibmphp_hotplug_slot_ops = { |
1263 | .set_attention_status = set_attention_status, | 1263 | .set_attention_status = set_attention_status, |
1264 | .enable_slot = enable_slot, | 1264 | .enable_slot = enable_slot, |
1265 | .disable_slot = ibmphp_disable_slot, | 1265 | .disable_slot = ibmphp_disable_slot, |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 90fde5f106d8..ede2ed6f4ce0 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -49,15 +49,15 @@ static DEFINE_MUTEX(pci_hp_mutex); | |||
49 | #define GET_STATUS(name, type) \ | 49 | #define GET_STATUS(name, type) \ |
50 | static int get_##name(struct hotplug_slot *slot, type *value) \ | 50 | static int get_##name(struct hotplug_slot *slot, type *value) \ |
51 | { \ | 51 | { \ |
52 | struct hotplug_slot_ops *ops = slot->ops; \ | 52 | const struct hotplug_slot_ops *ops = slot->ops; \ |
53 | int retval = 0; \ | 53 | int retval = 0; \ |
54 | if (!try_module_get(ops->owner)) \ | 54 | if (!try_module_get(slot->owner)) \ |
55 | return -ENODEV; \ | 55 | return -ENODEV; \ |
56 | if (ops->get_##name) \ | 56 | if (ops->get_##name) \ |
57 | retval = ops->get_##name(slot, value); \ | 57 | retval = ops->get_##name(slot, value); \ |
58 | else \ | 58 | else \ |
59 | *value = slot->info->name; \ | 59 | *value = slot->info->name; \ |
60 | module_put(ops->owner); \ | 60 | module_put(slot->owner); \ |
61 | return retval; \ | 61 | return retval; \ |
62 | } | 62 | } |
63 | 63 | ||
@@ -90,7 +90,7 @@ static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf, | |||
90 | power = (u8)(lpower & 0xff); | 90 | power = (u8)(lpower & 0xff); |
91 | dbg("power = %d\n", power); | 91 | dbg("power = %d\n", power); |
92 | 92 | ||
93 | if (!try_module_get(slot->ops->owner)) { | 93 | if (!try_module_get(slot->owner)) { |
94 | retval = -ENODEV; | 94 | retval = -ENODEV; |
95 | goto exit; | 95 | goto exit; |
96 | } | 96 | } |
@@ -109,7 +109,7 @@ static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf, | |||
109 | err("Illegal value specified for power\n"); | 109 | err("Illegal value specified for power\n"); |
110 | retval = -EINVAL; | 110 | retval = -EINVAL; |
111 | } | 111 | } |
112 | module_put(slot->ops->owner); | 112 | module_put(slot->owner); |
113 | 113 | ||
114 | exit: | 114 | exit: |
115 | if (retval) | 115 | if (retval) |
@@ -138,7 +138,8 @@ static ssize_t attention_read_file(struct pci_slot *pci_slot, char *buf) | |||
138 | static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf, | 138 | static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf, |
139 | size_t count) | 139 | size_t count) |
140 | { | 140 | { |
141 | struct hotplug_slot_ops *ops = pci_slot->hotplug->ops; | 141 | struct hotplug_slot *slot = pci_slot->hotplug; |
142 | const struct hotplug_slot_ops *ops = slot->ops; | ||
142 | unsigned long lattention; | 143 | unsigned long lattention; |
143 | u8 attention; | 144 | u8 attention; |
144 | int retval = 0; | 145 | int retval = 0; |
@@ -147,13 +148,13 @@ static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf, | |||
147 | attention = (u8)(lattention & 0xff); | 148 | attention = (u8)(lattention & 0xff); |
148 | dbg(" - attention = %d\n", attention); | 149 | dbg(" - attention = %d\n", attention); |
149 | 150 | ||
150 | if (!try_module_get(ops->owner)) { | 151 | if (!try_module_get(slot->owner)) { |
151 | retval = -ENODEV; | 152 | retval = -ENODEV; |
152 | goto exit; | 153 | goto exit; |
153 | } | 154 | } |
154 | if (ops->set_attention_status) | 155 | if (ops->set_attention_status) |
155 | retval = ops->set_attention_status(pci_slot->hotplug, attention); | 156 | retval = ops->set_attention_status(slot, attention); |
156 | module_put(ops->owner); | 157 | module_put(slot->owner); |
157 | 158 | ||
158 | exit: | 159 | exit: |
159 | if (retval) | 160 | if (retval) |
@@ -213,13 +214,13 @@ static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, | |||
213 | test = (u32)(ltest & 0xffffffff); | 214 | test = (u32)(ltest & 0xffffffff); |
214 | dbg("test = %d\n", test); | 215 | dbg("test = %d\n", test); |
215 | 216 | ||
216 | if (!try_module_get(slot->ops->owner)) { | 217 | if (!try_module_get(slot->owner)) { |
217 | retval = -ENODEV; | 218 | retval = -ENODEV; |
218 | goto exit; | 219 | goto exit; |
219 | } | 220 | } |
220 | if (slot->ops->hardware_test) | 221 | if (slot->ops->hardware_test) |
221 | retval = slot->ops->hardware_test(slot, test); | 222 | retval = slot->ops->hardware_test(slot, test); |
222 | module_put(slot->ops->owner); | 223 | module_put(slot->owner); |
223 | 224 | ||
224 | exit: | 225 | exit: |
225 | if (retval) | 226 | if (retval) |
@@ -447,8 +448,8 @@ int __pci_hp_initialize(struct hotplug_slot *slot, struct pci_bus *bus, | |||
447 | if ((slot->info == NULL) || (slot->ops == NULL)) | 448 | if ((slot->info == NULL) || (slot->ops == NULL)) |
448 | return -EINVAL; | 449 | return -EINVAL; |
449 | 450 | ||
450 | slot->ops->owner = owner; | 451 | slot->owner = owner; |
451 | slot->ops->mod_name = mod_name; | 452 | slot->mod_name = mod_name; |
452 | 453 | ||
453 | /* | 454 | /* |
454 | * No problems if we call this interface from both ACPI_PCI_SLOT | 455 | * No problems if we call this interface from both ACPI_PCI_SLOT |
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 3276a5e4c430..12b92a0ff688 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c | |||
@@ -530,7 +530,7 @@ static int pnv_php_disable_slot(struct hotplug_slot *slot) | |||
530 | return ret; | 530 | return ret; |
531 | } | 531 | } |
532 | 532 | ||
533 | static struct hotplug_slot_ops php_slot_ops = { | 533 | static const struct hotplug_slot_ops php_slot_ops = { |
534 | .get_power_status = pnv_php_get_power_state, | 534 | .get_power_status = pnv_php_get_power_state, |
535 | .get_adapter_status = pnv_php_get_adapter_state, | 535 | .get_adapter_status = pnv_php_get_adapter_state, |
536 | .set_attention_status = pnv_php_set_attention_state, | 536 | .set_attention_status = pnv_php_set_attention_state, |
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h index c8311724bd76..f83347819f7b 100644 --- a/drivers/pci/hotplug/rpaphp.h +++ b/drivers/pci/hotplug/rpaphp.h | |||
@@ -70,7 +70,7 @@ struct slot { | |||
70 | struct hotplug_slot *hotplug_slot; | 70 | struct hotplug_slot *hotplug_slot; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | extern struct hotplug_slot_ops rpaphp_hotplug_slot_ops; | 73 | extern const struct hotplug_slot_ops rpaphp_hotplug_slot_ops; |
74 | extern struct list_head rpaphp_slot_head; | 74 | extern struct list_head rpaphp_slot_head; |
75 | 75 | ||
76 | /* function prototypes */ | 76 | /* function prototypes */ |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 857c358b727b..8620a3f8c987 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -477,7 +477,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
477 | return 0; | 477 | return 0; |
478 | } | 478 | } |
479 | 479 | ||
480 | struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { | 480 | const struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { |
481 | .enable_slot = enable_slot, | 481 | .enable_slot = enable_slot, |
482 | .disable_slot = disable_slot, | 482 | .disable_slot = disable_slot, |
483 | .set_attention_status = set_attention_status, | 483 | .set_attention_status = set_attention_status, |
diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c index 93b5341d282c..5bd45fd4a92a 100644 --- a/drivers/pci/hotplug/s390_pci_hpc.c +++ b/drivers/pci/hotplug/s390_pci_hpc.c | |||
@@ -130,7 +130,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | 132 | ||
133 | static struct hotplug_slot_ops s390_hotplug_slot_ops = { | 133 | static const struct hotplug_slot_ops s390_hotplug_slot_ops = { |
134 | .enable_slot = enable_slot, | 134 | .enable_slot = enable_slot, |
135 | .disable_slot = disable_slot, | 135 | .disable_slot = disable_slot, |
136 | .get_power_status = get_power_status, | 136 | .get_power_status = get_power_status, |
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index babd23409f61..af4c28c574dd 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -80,7 +80,7 @@ static int enable_slot(struct hotplug_slot *slot); | |||
80 | static int disable_slot(struct hotplug_slot *slot); | 80 | static int disable_slot(struct hotplug_slot *slot); |
81 | static inline int get_power_status(struct hotplug_slot *slot, u8 *value); | 81 | static inline int get_power_status(struct hotplug_slot *slot, u8 *value); |
82 | 82 | ||
83 | static struct hotplug_slot_ops sn_hotplug_slot_ops = { | 83 | static const struct hotplug_slot_ops sn_hotplug_slot_ops = { |
84 | .enable_slot = enable_slot, | 84 | .enable_slot = enable_slot, |
85 | .disable_slot = disable_slot, | 85 | .disable_slot = disable_slot, |
86 | .get_power_status = get_power_status, | 86 | .get_power_status = get_power_status, |
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 97cee23f3d51..26cbea04237c 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -51,7 +51,7 @@ static int get_attention_status(struct hotplug_slot *slot, u8 *value); | |||
51 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); | 51 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
52 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); | 52 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
53 | 53 | ||
54 | static struct hotplug_slot_ops shpchp_hotplug_slot_ops = { | 54 | static const struct hotplug_slot_ops shpchp_hotplug_slot_ops = { |
55 | .set_attention_status = set_attention_status, | 55 | .set_attention_status = set_attention_status, |
56 | .enable_slot = enable_slot, | 56 | .enable_slot = enable_slot, |
57 | .disable_slot = disable_slot, | 57 | .disable_slot = disable_slot, |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1835f3a7aa8d..0e54588825cb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -4571,13 +4571,13 @@ static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe) | |||
4571 | { | 4571 | { |
4572 | int rc = -ENOTTY; | 4572 | int rc = -ENOTTY; |
4573 | 4573 | ||
4574 | if (!hotplug || !try_module_get(hotplug->ops->owner)) | 4574 | if (!hotplug || !try_module_get(hotplug->owner)) |
4575 | return rc; | 4575 | return rc; |
4576 | 4576 | ||
4577 | if (hotplug->ops->reset_slot) | 4577 | if (hotplug->ops->reset_slot) |
4578 | rc = hotplug->ops->reset_slot(hotplug, probe); | 4578 | rc = hotplug->ops->reset_slot(hotplug, probe); |
4579 | 4579 | ||
4580 | module_put(hotplug->ops->owner); | 4580 | module_put(hotplug->owner); |
4581 | 4581 | ||
4582 | return rc; | 4582 | return rc; |
4583 | } | 4583 | } |
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index e634229ece89..145cd953b518 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -371,7 +371,7 @@ void pci_hp_create_module_link(struct pci_slot *pci_slot) | |||
371 | 371 | ||
372 | if (!slot || !slot->ops) | 372 | if (!slot || !slot->ops) |
373 | return; | 373 | return; |
374 | kobj = kset_find_obj(module_kset, slot->ops->mod_name); | 374 | kobj = kset_find_obj(module_kset, slot->mod_name); |
375 | if (!kobj) | 375 | if (!kobj) |
376 | return; | 376 | return; |
377 | ret = sysfs_create_link(&pci_slot->kobj, kobj, "module"); | 377 | ret = sysfs_create_link(&pci_slot->kobj, kobj, "module"); |
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 2d6e272315a8..a8aa2eadfd82 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -868,8 +868,7 @@ static int asus_get_adapter_status(struct hotplug_slot *hotplug_slot, | |||
868 | return 0; | 868 | return 0; |
869 | } | 869 | } |
870 | 870 | ||
871 | static struct hotplug_slot_ops asus_hotplug_slot_ops = { | 871 | static const struct hotplug_slot_ops asus_hotplug_slot_ops = { |
872 | .owner = THIS_MODULE, | ||
873 | .get_adapter_status = asus_get_adapter_status, | 872 | .get_adapter_status = asus_get_adapter_status, |
874 | .get_power_status = asus_get_adapter_status, | 873 | .get_power_status = asus_get_adapter_status, |
875 | }; | 874 | }; |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index a4bbf6ecd1f0..41a364376e91 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -726,8 +726,7 @@ static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, | |||
726 | return 0; | 726 | return 0; |
727 | } | 727 | } |
728 | 728 | ||
729 | static struct hotplug_slot_ops eeepc_hotplug_slot_ops = { | 729 | static const struct hotplug_slot_ops eeepc_hotplug_slot_ops = { |
730 | .owner = THIS_MODULE, | ||
731 | .get_adapter_status = eeepc_get_adapter_status, | 730 | .get_adapter_status = eeepc_get_adapter_status, |
732 | .get_power_status = eeepc_get_adapter_status, | 731 | .get_power_status = eeepc_get_adapter_status, |
733 | }; | 732 | }; |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index a6d6650a0490..372dbe95c207 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
@@ -16,8 +16,6 @@ | |||
16 | 16 | ||
17 | /** | 17 | /** |
18 | * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use | 18 | * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use |
19 | * @owner: The module owner of this structure | ||
20 | * @mod_name: The module name (KBUILD_MODNAME) of this structure | ||
21 | * @enable_slot: Called when the user wants to enable a specific pci slot | 19 | * @enable_slot: Called when the user wants to enable a specific pci slot |
22 | * @disable_slot: Called when the user wants to disable a specific pci slot | 20 | * @disable_slot: Called when the user wants to disable a specific pci slot |
23 | * @set_attention_status: Called to set the specific slot's attention LED to | 21 | * @set_attention_status: Called to set the specific slot's attention LED to |
@@ -46,8 +44,6 @@ | |||
46 | * set an LED, enable / disable power, etc.) | 44 | * set an LED, enable / disable power, etc.) |
47 | */ | 45 | */ |
48 | struct hotplug_slot_ops { | 46 | struct hotplug_slot_ops { |
49 | struct module *owner; | ||
50 | const char *mod_name; | ||
51 | int (*enable_slot) (struct hotplug_slot *slot); | 47 | int (*enable_slot) (struct hotplug_slot *slot); |
52 | int (*disable_slot) (struct hotplug_slot *slot); | 48 | int (*disable_slot) (struct hotplug_slot *slot); |
53 | int (*set_attention_status) (struct hotplug_slot *slot, u8 value); | 49 | int (*set_attention_status) (struct hotplug_slot *slot, u8 value); |
@@ -82,15 +78,19 @@ struct hotplug_slot_info { | |||
82 | * this slot. | 78 | * this slot. |
83 | * @private: used by the hotplug pci controller driver to store whatever it | 79 | * @private: used by the hotplug pci controller driver to store whatever it |
84 | * needs. | 80 | * needs. |
81 | * @owner: The module owner of this structure | ||
82 | * @mod_name: The module name (KBUILD_MODNAME) of this structure | ||
85 | */ | 83 | */ |
86 | struct hotplug_slot { | 84 | struct hotplug_slot { |
87 | struct hotplug_slot_ops *ops; | 85 | const struct hotplug_slot_ops *ops; |
88 | struct hotplug_slot_info *info; | 86 | struct hotplug_slot_info *info; |
89 | void *private; | 87 | void *private; |
90 | 88 | ||
91 | /* Variables below this are for use only by the hotplug pci core. */ | 89 | /* Variables below this are for use only by the hotplug pci core. */ |
92 | struct list_head slot_list; | 90 | struct list_head slot_list; |
93 | struct pci_slot *pci_slot; | 91 | struct pci_slot *pci_slot; |
92 | struct module *owner; | ||
93 | const char *mod_name; | ||
94 | }; | 94 | }; |
95 | 95 | ||
96 | static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) | 96 | static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) |