PCI: shpchp: Constify hpc_ops structure
authorJulia Lawall <Julia.Lawall@lip6.fr>
Wed, 23 Dec 2015 20:35:35 +0000 (21:35 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 8 Jan 2016 18:10:00 +0000 (12:10 -0600)
The hpc_ops structure is never modified, so declare it as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/shpchp.h
drivers/pci/hotplug/shpchp_hpc.c

index 821227f415e4918a89ed6afcec144c06d179220d..4da8fc601467beedb9971f51dd90a670ee2b5a09 100644 (file)
@@ -84,7 +84,7 @@ struct slot {
        u8 presence_save;
        u8 pwr_save;
        struct controller *ctrl;
-       struct hpc_ops *hpc_ops;
+       const struct hpc_ops *hpc_ops;
        struct hotplug_slot *hotplug_slot;
        struct list_head        slot_list;
        struct delayed_work work;       /* work for button event */
@@ -106,7 +106,7 @@ struct controller {
        int slot_num_inc;               /* 1 or -1 */
        struct pci_dev *pci_dev;
        struct list_head slot_list;
-       struct hpc_ops *hpc_ops;
+       const struct hpc_ops *hpc_ops;
        wait_queue_head_t queue;        /* sleep & wake process */
        u8 slot_device_offset;
        u32 pcix_misc2_reg;     /* for amd pogo errata */
index e03341c95745715d9602eeeadbfd239ebe2e2cc1..de0ea474fb73897f88a19dc2aacb615250ebed60 100644 (file)
@@ -910,7 +910,7 @@ static int shpc_get_max_bus_speed(struct controller *ctrl)
        return retval;
 }
 
-static struct hpc_ops shpchp_hpc_ops = {
+static const struct hpc_ops shpchp_hpc_ops = {
        .power_on_slot                  = hpc_power_on_slot,
        .slot_enable                    = hpc_slot_enable,
        .slot_disable                   = hpc_slot_disable,