Using const is generally a good idea. Julia Lawall has created a list of always const and almost always const structs in the kernel sources. Link: https://lkml.org/lkml/2016/8/28/95 Add the most frequently used (> 50 cases) that are almost always or always const.
Showing the changes to scripts/const_structs.checkpatch (1 of 1 file). Show all
Unified · Split
| @@ -2,38 +2,63 @@ acpi_dock_ops · 1 unmodified line | ||
| 2 | 2 | address_space_operations |
| 3 | 3 | backlight_ops |
| 4 | 4 | block_device_operations |
| 5 | +clk_ops | |
| 6 | +comedi_lrange | |
| 7 | +component_ops | |
| 5 | 8 | dentry_operations |
| 6 | 9 | dev_pm_ops |
| 7 | 10 | dma_map_ops |
| 11 | +driver_info | |
| 12 | +drm_connector_funcs | |
| 13 | +drm_encoder_funcs | |
| 14 | +drm_encoder_helper_funcs | |
| 15 | +ethtool_ops | |
| 8 | 16 | extent_io_ops |
| 9 | 17 | file_lock_operations |
| 10 | 18 | file_operations |
| 11 | 19 | hv_ops |
| 12 | 20 | ide_dma_ops |
| 21 | +ide_port_ops | |
| 22 | +inode_operations | |
| 13 | 23 | intel_dvo_dev_ops |
| 24 | +irq_domain_ops | |
| 14 | 25 | item_operations |
| 26 | +iwl_cfg | |
| 15 | 27 | iwl_ops |
| 16 | 28 | kgdb_arch |
| 17 | 29 | kgdb_io |
| 18 | 30 | kset_uevent_ops |
| 19 | 31 | lock_manager_operations |
| 32 | +machine_desc | |
| 20 | 33 | microcode_ops |
| 34 | +mlxsw_reg_info | |
| 21 | 35 | mtrr_ops |
| 22 | 36 | neigh_ops |
| 37 | +net_device_ops | |
| 23 | 38 | nlmsvc_binding |
| 39 | +nvkm_device_chip | |
| 24 | 40 | of_device_id |
| 25 | 41 | pci_raw_ops |
| 26 | 42 | pipe_buf_operations |
| 27 | 43 | platform_hibernation_ops |
| 28 | 44 | platform_suspend_ops |
| 29 | 45 | proto_ops |
| 46 | +regmap_access_table | |
| 30 | 47 | rpc_pipe_ops |
| 48 | +rtc_class_ops | |
| 49 | +sd_desc | |
| 31 | 50 | seq_operations |
| 51 | +sirfsoc_padmux | |
| 32 | 52 | snd_ac97_build_ops |
| 53 | +snd_soc_component_driver | |
| 33 | 54 | soc_pcmcia_socket_ops |
| 34 | 55 | stacktrace_ops |
| 35 | 56 | sysfs_ops |
| 36 | 57 | tty_operations |
| 37 | 58 | uart_ops |
| 38 | 59 | usb_mon_operations |
| 60 | +v4l2_ctrl_ops | |
| 61 | +v4l2_ioctl_ops | |
| 62 | +vm_operations_struct | |
| 63 | +wacom_features | |
| 39 | 64 | wd_ops |