firewire: mark some structs const
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Sun, 14 Jan 2007 14:29:07 +0000 (15:29 +0100)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Fri, 9 Mar 2007 21:02:39 +0000 (22:02 +0100)
Instances of struct file_operations and struct fw_card_driver can be
qualified as "const".  Ditto with struct fw_descriptor.data, struct
fw_device_id, and predefined instances of struct fw_address_region,
at least in the current implementation.

Data qualified as const is placed into the .rodata section which won't
be mixed with dirty data.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/fw-card.c
drivers/firewire/fw-device-cdev.c
drivers/firewire/fw-device.c
drivers/firewire/fw-device.h
drivers/firewire/fw-ohci.c
drivers/firewire/fw-sbp2.c
drivers/firewire/fw-transaction.c
drivers/firewire/fw-transaction.h

index 79773907e10ddaeb51c60d245f200aa7f8d0a737..82a92432bcb768eb8c10bfc6f4d3f962786b9806 100644 (file)
@@ -257,7 +257,7 @@ flush_timer_callback(unsigned long data)
 }
 
 void
-fw_card_initialize(struct fw_card *card, struct fw_card_driver *driver,
+fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
                   struct device *device)
 {
        static int index;
index c10e3326abf3c5488cc603582095a3c041b85569..117bc6db54af454bb9d9ba6c0340b7c107b2ee99 100644 (file)
@@ -602,7 +602,7 @@ static unsigned int fw_device_op_poll(struct file *file, poll_table * pt)
                return 0;
 }
 
-struct file_operations fw_device_ops = {
+const struct file_operations fw_device_ops = {
        .owner          = THIS_MODULE,
        .open           = fw_device_op_open,
        .read           = fw_device_op_read,
index ec1cb7fc8e9676de11f3ac0915d1d62f81e67e2c..e541daade0c3a9cbbf1122d2bba0982ba133c710 100644 (file)
@@ -49,7 +49,7 @@ EXPORT_SYMBOL(fw_csr_iterator_next);
 
 static int is_fw_unit(struct device *dev);
 
-static int match_unit_directory(u32 * directory, struct fw_device_id *id)
+static int match_unit_directory(u32 * directory, const struct fw_device_id *id)
 {
        struct fw_csr_iterator ci;
        int key, value, match;
index 731abbe5330bb04cb7ae0076b6b21c9f34c8ba49..f39cf6ae62535142956cf7a44bbe98c5d3644dd2 100644 (file)
@@ -113,7 +113,7 @@ struct fw_driver {
        struct device_driver driver;
        /* Called when the parent device sits through a bus reset. */
        void (*update) (struct fw_unit *unit);
-       struct fw_device_id *id_table;
+       const struct fw_device_id *id_table;
 };
 
 static inline struct fw_driver *
@@ -122,6 +122,6 @@ fw_driver(struct device_driver *drv)
         return container_of(drv, struct fw_driver, driver);
 }
 
-extern struct file_operations fw_device_ops;
+extern const struct file_operations fw_device_ops;
 
 #endif /* __fw_device_h */
index 5d42d18bd4550173ff133e0b117bb4ee9e599e15..d3750a2692e970563cf0190f963395daa5b4715d 100644 (file)
@@ -1146,7 +1146,7 @@ ohci_queue_iso(struct fw_iso_context *base,
        return 0;
 }
 
-static struct fw_card_driver ohci_driver = {
+static const struct fw_card_driver ohci_driver = {
        .name                   = ohci_driver_name,
        .enable                 = ohci_enable,
        .update_phy_reg         = ohci_update_phy_reg,
index ce9c41ff07651ba434c2abe61ba4b17435151228..28acae8b01b3ee15d043fca887b45952532a140a 100644 (file)
@@ -681,7 +681,7 @@ static void sbp2_update(struct fw_unit *unit)
 #define SBP2_UNIT_SPEC_ID_ENTRY        0x0000609e
 #define SBP2_SW_VERSION_ENTRY  0x00010483
 
-static struct fw_device_id sbp2_id_table[] = {
+static const struct fw_device_id sbp2_id_table[] = {
        {
                .match_flags  = FW_MATCH_SPECIFIER_ID | FW_MATCH_VERSION,
                .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY,
index affd42014a676662979a81e440fc7e956c2f0172..a72f50288c0a3705c215008f910070a979e440b9 100644 (file)
@@ -331,15 +331,15 @@ lookup_enclosing_address_handler(struct list_head *list,
 static DEFINE_SPINLOCK(address_handler_lock);
 static LIST_HEAD(address_handler_list);
 
-struct fw_address_region fw_low_memory_region =
+const struct fw_address_region fw_low_memory_region =
        { 0x000000000000ull, 0x000100000000ull };
-struct fw_address_region fw_high_memory_region =
+const struct fw_address_region fw_high_memory_region =
        { 0x000100000000ull, 0xffffe0000000ull };
-struct fw_address_region fw_private_region =
+const struct fw_address_region fw_private_region =
        { 0xffffe0000000ull, 0xfffff0000000ull };
-struct fw_address_region fw_csr_region =
+const struct fw_address_region fw_csr_region =
        { 0xfffff0000000ULL, 0xfffff0000800ull };
-struct fw_address_region fw_unit_space_region =
+const struct fw_address_region fw_unit_space_region =
        { 0xfffff0000900ull, 0x1000000000000ull };
 
 EXPORT_SYMBOL(fw_low_memory_region);
@@ -358,7 +358,7 @@ EXPORT_SYMBOL(fw_unit_space_region);
 
 int
 fw_core_add_address_handler(struct fw_address_handler *handler,
-                           struct fw_address_region *region)
+                           const struct fw_address_region *region)
 {
        struct fw_address_handler *other;
        unsigned long flags;
@@ -684,7 +684,7 @@ MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
 MODULE_DESCRIPTION("Core IEEE1394 transaction logic");
 MODULE_LICENSE("GPL");
 
-static u32 vendor_textual_descriptor_data[] = {
+static const u32 vendor_textual_descriptor_data[] = {
        /* textual descriptor leaf () */
        0x00080000,
        0x00000000,
index 292add509102334233c29cca96274ad125933200..2f849c813a4c3aa21a52f687939536a31ee123ea 100644 (file)
@@ -133,7 +133,7 @@ struct fw_descriptor {
        struct list_head link;
        size_t length;
        u32 key;
-       u32 *data;
+       const u32 *data;
 };
 
 int fw_core_add_descriptor (struct fw_descriptor *desc);
@@ -218,14 +218,14 @@ struct fw_address_region {
        u64 end;
 };
 
-extern struct fw_address_region fw_low_memory_region;
-extern struct fw_address_region fw_high_memory_region;
-extern struct fw_address_region fw_private_region;
-extern struct fw_address_region fw_csr_region;
-extern struct fw_address_region fw_unit_space_region;
+extern const struct fw_address_region fw_low_memory_region;
+extern const struct fw_address_region fw_high_memory_region;
+extern const struct fw_address_region fw_private_region;
+extern const struct fw_address_region fw_csr_region;
+extern const struct fw_address_region fw_unit_space_region;
 
 int fw_core_add_address_handler(struct fw_address_handler *handler,
-                               struct fw_address_region *region);
+                               const struct fw_address_region *region);
 void fw_core_remove_address_handler(struct fw_address_handler *handler);
 void fw_send_response(struct fw_card *card,
                      struct fw_request *request, int rcode);
@@ -233,7 +233,7 @@ void fw_send_response(struct fw_card *card,
 extern struct bus_type fw_bus_type;
 
 struct fw_card {
-        struct fw_card_driver *driver;
+       const struct fw_card_driver *driver;
        struct device *device;
 
         int node_id;
@@ -399,7 +399,7 @@ fw_node_event(struct fw_card *card, struct fw_node *node, int event);
 /* Do we need phy speed here also?  If we add more args, maybe we
    should go back to struct fw_card_info. */
 void
-fw_card_initialize(struct fw_card *card, struct fw_card_driver *driver,
+fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
                   struct device *device);
 int
 fw_card_add(struct fw_card *card,