constify various _ops structures for 2.6.32 v1
Subsystems (85)
cover constify various _ops structures for 2.6.32 v1
Hello everyone!
The following patch series attempts to constify several structures that hold function pointers. This is only the initial batch, there are about over 150 candidate structures, some of which can be constified as well, I plan to submit them in the future.
The list of constified structures in this series:acpi_dock_opsaddress_space_operationsbacklight_opsblock_device_operationsdma_map_opse1000_mac_operationse1000_nvm_operationse1000_phy_operationsextent_io_opsfile_lock_operationsfile_operationshv_opsintel_dvo_dev_opsitem_operationsiwl_opskgdb_archkgdb_iokset_uevent_opslock_manager_operationsmicrocode_opsmtrr_opsneigh_opsnlmsvc_bindingpci_raw_opsplatform_hibernation_opsplatform_suspend_opssnd_ac97_build_opssuper_operationssysfs_opsusb_mon_operationswd_ops
There are certain exceptions where a given instance of the structure cannot be const, they are marked with a comment in the patch.
The patches compile fine with an allyesconfig kernel on i386 and x86_64.
Please let me know if any of these structures should not be constified and any other issues you see with them.
Thanks,
Emese
PATCH 1/31 Constify struct acpi_dock_ops for 2.6.32 v1
From: Emese Revfy <[email protected]>
Constify struct acpi_dock_ops.
--- drivers/acpi/dock.c | 4 ++-- drivers/ata/libata-acpi.c | 4 ++-- drivers/pci/hotplug/acpiphp_glue.c | 2 +- include/acpi/acpi_drivers.h | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/acpi/dock.c +2 -2
@@ -77,7 +77,7 @@ struct dock_dependent_device {struct list_head list;struct list_head hotplug_list;acpi_handle handle; -struct acpi_dock_ops *ops; +const struct acpi_dock_ops *ops;void *context; };
@@ -605,7 +605,7 @@ EXPORT_SYMBOL_GPL(unregister_dock_notifier);* the dock driver after _DCK is executed. */ int -register_hotplug_dock_device (acpi_handle handle,struct acpi_dock_ops *ops, +register_hotplug_dock_device (acpi_handle handle,const struct acpi_dock_ops *ops,void *context) {struct dock_dependent_device *dd;
drivers/ata/libata-acpi.c +2 -2
@@ -223,12 +223,12 @@ static void ata_acpi_dev_uevent(acpi_handle handle, u32 event, void *data)ata_acpi_uevent (dev->link->ap, dev, event); } -static struct acpi_dock_ops ata_acpi_dev_dock_ops = { +static const struct acpi_dock_ops ata_acpi_dev_dock_ops = { .handler = ata_acpi_dev_notify_dock, .uevent = ata_acpi_dev_uevent, }; -static struct acpi_dock_ops ata_acpi_ap_dock_ops = { +static const struct acpi_dock_ops ata_acpi_ap_dock_ops = { .handler = ata_acpi_ap_notify_dock, .uevent = ata_acpi_ap_uevent, };
drivers/pci/hotplug/acpiphp_glue.c +1 -1
@@ -111,7 +111,7 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val, } -static struct acpi_dock_ops acpiphp_dock_ops = { +static const struct acpi_dock_ops acpiphp_dock_ops = { .handler = handle_hotplug_event_func, };
include/acpi/acpi_drivers.h +4 -4
@@ -119,8 +119,8 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type);Dock Station -------------------------------------------------------------------------- */ struct acpi_dock_ops { -acpi_notify_handler handler; -acpi_notify_handler uevent; +const acpi_notify_handler handler; +const acpi_notify_handler uevent; };#if defined(CONFIG_ACPI_DOCK ) || defined(CONFIG_ACPI_DOCK_MODULE )
@@ -128,7 +128,7 @@ extern int is_dock_device(acpi_handle handle);extern int register_dock_notifier (struct notifier_block *nb);extern void unregister_dock_notifier (struct notifier_block *nb);extern int register_hotplug_dock_device (acpi_handle handle, -struct acpi_dock_ops *ops, +const struct acpi_dock_ops *ops,void *context);extern void unregister_hotplug_dock_device (acpi_handle handle);#else
@@ -144,7 +144,7 @@ static inline void unregister_dock_notifier(struct notifier_block *nb) { }static inline int register_hotplug_dock_device (acpi_handle handle, -struct acpi_dock_ops *ops, +const struct acpi_dock_ops *ops,void *context) {return -ENODEV ;
PATCH 2/31 Constify struct address_space_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct address_space_operations.
--- include/linux/fs.h | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-)
include/linux/fs.h +17 -17
@@ -565,41 +565,41 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long);struct address_space_operations { -int (*writepage)(struct page *page,struct writeback_control *wbc); -int (*readpage)(struct file *,struct page *); -void (*sync_page)(struct page *); +int (*const writepage)(struct page *page,struct writeback_control *wbc); +int (*const readpage)(struct file *,struct page *); +void (*const sync_page)(struct page *);/* Write back some dirty pages from this mapping. */ -int (*writepages)(struct address_space *,struct writeback_control *); +int (*const writepages)(struct address_space *,struct writeback_control *);/* Set a page dirty. Return true if this dirtied it */ -int (*set_page_dirty)(struct page *page); +int (*const set_page_dirty)(struct page *page); -int (*readpages)(struct file *filp,struct address_space *mapping, +int (*const readpages)(struct file *filp,struct address_space *mapping,struct list_head *pages,unsigned nr_pages); -int (*write_begin)(struct file *,struct address_space *mapping, +int (*const write_begin)(struct file *,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags,struct page **pagep,void **fsdata); -int (*write_end)(struct file *,struct address_space *mapping, +int (*const write_end)(struct file *,struct address_space *mapping,loff_t pos,unsigned len,unsigned copied,struct page *page,void *fsdata);/* Unfortunately this kludge is needed for FIBMAP. Don't use it */ -sector_t (*bmap)(struct address_space *,sector_t ); -void (*invalidatepage) (struct page *,unsigned long ); -int (*releasepage) (struct page *,gfp_t ); -ssize_t (*direct_IO)(int ,struct kiocb *,const struct iovec *iov, +sector_t (*const bmap)(struct address_space *,sector_t ); +void (*const invalidatepage) (struct page *,unsigned long ); +int (*const releasepage) (struct page *,gfp_t ); +ssize_t (*const direct_IO)(int ,struct kiocb *,const struct iovec *iov,loff_t offset,unsigned long nr_segs); -int (*get_xip_mem)(struct address_space *,pgoff_t ,int , +int (*const get_xip_mem)(struct address_space *,pgoff_t ,int ,void **,unsigned long *);/* migrate the contents of a page to the specified target */ -int (*migratepage) (struct address_space *, +int (*const migratepage) (struct address_space *,struct page *,struct page *); -int (*launder_page) (struct page *); -int (*is_partially_uptodate) (struct page *,read_descriptor_t *, +int (*const launder_page) (struct page *); +int (*const is_partially_uptodate) (struct page *,read_descriptor_t *,unsigned long ); -int (*error_remove_page)(struct address_space *,struct page *); +int (*const error_remove_page)(struct address_space *,struct page *); };/*
PATCH 3/31 Constify struct backlight_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct backlight_ops.
--- drivers/acpi/video.c | 2 +- drivers/macintosh/via-pmu-backlight.c | 4 ++-- drivers/platform/x86/acer-wmi.c | 2 +- drivers/platform/x86/asus-laptop.c | 2 +- drivers/platform/x86/asus_acpi.c | 2 +- drivers/platform/x86/compal-laptop.c | 2 +- drivers/platform/x86/dell-laptop.c | 2 +- drivers/platform/x86/eeepc-laptop.c | 2 +- drivers/platform/x86/fujitsu-laptop.c | 2 +- drivers/platform/x86/msi-laptop.c | 2 +- drivers/platform/x86/panasonic-laptop.c | 2 +- drivers/platform/x86/sony-laptop.c | 2 +- drivers/platform/x86/thinkpad_acpi.c | 2 +- drivers/platform/x86/toshiba_acpi.c | 2 +- drivers/usb/misc/appledisplay.c | 2 +- drivers/video/atmel_lcdfb.c | 2 +- drivers/video/aty/aty128fb.c | 2 +- drivers/video/aty/atyfb_base.c | 2 +- drivers/video/aty/radeon_backlight.c | 2 +- drivers/video/backlight/adp5520_bl.c | 2 +- drivers/video/backlight/adx_bl.c | 2 +- drivers/video/backlight/atmel-pwm-bl.c | 2 +- drivers/video/backlight/backlight.c | 2 +- drivers/video/backlight/corgi_lcd.c | 2 +- drivers/video/backlight/cr_bllcd.c | 2 +- drivers/video/backlight/da903x_bl.c | 2 +- drivers/video/backlight/generic_bl.c | 2 +- drivers/video/backlight/hp680_bl.c | 2 +- drivers/video/backlight/jornada720_bl.c | 2 +- drivers/video/backlight/kb3886_bl.c | 2 +- drivers/video/backlight/locomolcd.c | 2 +- drivers/video/backlight/mbp_nvidia_bl.c | 2 +- drivers/video/backlight/omap1_bl.c | 2 +- drivers/video/backlight/progear_bl.c | 2 +- drivers/video/backlight/pwm_bl.c | 2 +- drivers/video/backlight/tosa_bl.c | 2 +- drivers/video/backlight/wm831x_bl.c | 2 +- drivers/video/bf54x-lq043fb.c | 2 +- drivers/video/bfin-t350mcqb-fb.c | 2 +- drivers/video/nvidia/nv_backlight.c | 2 +- drivers/video/riva/fbdev.c | 2 +- include/linux/backlight.h | 12 ++++++------ 42 files changed, 48 insertions(+), 48 deletions(-)
drivers/acpi/video.c +1 -1
@@ -359,7 +359,7 @@ static int acpi_video_set_brightness(struct backlight_device *bd) vd->brightness->levels[request_level]); } -static struct backlight_ops acpi_backlight_ops = { +static const struct backlight_ops acpi_backlight_ops = { .get_brightness = acpi_video_get_brightness, .update_status = acpi_video_set_brightness, };
drivers/macintosh/via-pmu-backlight.c +2 -2
@@ -15,7 +15,7 @@#define MAX_PMU_LEVEL 0xFF -static struct backlight_ops pmu_backlight_data; +static const struct backlight_ops pmu_backlight_data;static DEFINE_SPINLOCK (pmu_backlight_lock);static int sleeping, uses_pmu_bl;static u8 bl_curve[FB_BACKLIGHT_LEVELS ];
@@ -115,7 +115,7 @@ static int pmu_backlight_get_brightness(struct backlight_device *bd)return bd->props.brightness; } -static struct backlight_ops pmu_backlight_data = { +static const struct backlight_ops pmu_backlight_data = { .get_brightness = pmu_backlight_get_brightness, .update_status = pmu_backlight_update_status,
drivers/platform/x86/acer-wmi.c +1 -1
@@ -918,7 +918,7 @@ static int update_bl_status(struct backlight_device *bd)return 0 ; } -static struct backlight_ops acer_bl_ops = { +static const struct backlight_ops acer_bl_ops = { .get_brightness = read_brightness, .update_status = update_bl_status, };
drivers/platform/x86/asus-laptop.c +1 -1
@@ -249,7 +249,7 @@ static struct backlight_device *asus_backlight_device;*/ static int read_brightness (struct backlight_device *bd);static int update_bl_status (struct backlight_device *bd); -static struct backlight_ops asusbl_ops = { +static const struct backlight_ops asusbl_ops = { .get_brightness = read_brightness, .update_status = update_bl_status, };
drivers/platform/x86/asus_acpi.c +1 -1
@@ -1402,7 +1402,7 @@ static int asus_hotk_remove(struct acpi_device *device, int type)return 0 ; } -static struct backlight_ops asus_backlight_data = { +static const struct backlight_ops asus_backlight_data = { .get_brightness = read_brightness, .update_status = set_brightness_status, };
drivers/platform/x86/compal-laptop.c +1 -1
@@ -163,7 +163,7 @@ static int bl_update_status(struct backlight_device *b)return set_lcd_level (b->props.brightness); } -static struct backlight_ops compalbl_ops = { +static const struct backlight_ops compalbl_ops = { .get_brightness = bl_get_brightness, .update_status = bl_update_status, };
drivers/platform/x86/dell-laptop.c +1 -1
@@ -305,7 +305,7 @@ static int dell_get_intensity(struct backlight_device *bd)return buffer.output[1 ]; } -static struct backlight_ops dell_ops = { +static const struct backlight_ops dell_ops = { .get_brightness = dell_get_intensity, .update_status = dell_send_intensity, };
drivers/platform/x86/eeepc-laptop.c +1 -1
@@ -242,7 +242,7 @@ static struct device *eeepc_hwmon_device;*/ static int read_brightness (struct backlight_device *bd);static int update_bl_status (struct backlight_device *bd); -static struct backlight_ops eeepcbl_ops = { +static const struct backlight_ops eeepcbl_ops = { .get_brightness = read_brightness, .update_status = update_bl_status, };
drivers/platform/x86/fujitsu-laptop.c +1 -1
@@ -436,7 +436,7 @@ static int bl_update_status(struct backlight_device *b)return ret; } -static struct backlight_ops fujitsubl_ops = { +static const struct backlight_ops fujitsubl_ops = { .get_brightness = bl_get_brightness, .update_status = bl_update_status, };
drivers/platform/x86/msi-laptop.c +1 -1
@@ -161,7 +161,7 @@ static int bl_update_status(struct backlight_device *b)return set_lcd_level (b->props.brightness); } -static struct backlight_ops msibl_ops = { +static const struct backlight_ops msibl_ops = { .get_brightness = bl_get_brightness, .update_status = bl_update_status, };
drivers/platform/x86/panasonic-laptop.c +1 -1
@@ -352,7 +352,7 @@ static int bl_set_status(struct backlight_device *bd)return acpi_pcc_write_sset (pcc,SINF_DC_CUR_BRIGHT , bright); } -static struct backlight_ops pcc_backlight_ops = { +static const struct backlight_ops pcc_backlight_ops = { .get_brightness = bl_get, .update_status = bl_set_status, };
drivers/platform/x86/sony-laptop.c +1 -1
@@ -850,7 +850,7 @@ static int sony_backlight_get_brightness(struct backlight_device *bd) }static struct backlight_device *sony_backlight_device; -static struct backlight_ops sony_backlight_ops = { +static const struct backlight_ops sony_backlight_ops = { .update_status = sony_backlight_update_status, .get_brightness = sony_backlight_get_brightness, };
drivers/platform/x86/thinkpad_acpi.c +1 -1
@@ -6095,7 +6095,7 @@ static int brightness_get(struct backlight_device *bd)return status &TP_EC_BACKLIGHT_LVLMSK ; } -static struct backlight_ops ibm_backlight_data = { +static const struct backlight_ops ibm_backlight_data = { .get_brightness = brightness_get, .update_status = brightness_update_status, };
drivers/platform/x86/toshiba_acpi.c +1 -1
@@ -671,7 +671,7 @@ static acpi_status remove_device(void)return AE_OK ; } -static struct backlight_ops toshiba_backlight_data = { +static const struct backlight_ops toshiba_backlight_data = { .get_brightness = get_lcd, .update_status = set_lcd_status, };
drivers/usb/misc/appledisplay.c +1 -1
@@ -178,7 +178,7 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd)return pdata->msgdata[1 ]; } -static struct backlight_ops appledisplay_bl_data = { +static const struct backlight_ops appledisplay_bl_data = { .get_brightness = appledisplay_bl_get_brightness, .update_status = appledisplay_bl_update_status, };
drivers/video/atmel_lcdfb.c +1 -1
@@ -110,7 +110,7 @@ static int atmel_bl_get_brightness(struct backlight_device *bl)return lcdc_readl (sinfo,ATMEL_LCDC_CONTRAST_VAL ); } -static struct backlight_ops atmel_lcdc_bl_ops = { +static const struct backlight_ops atmel_lcdc_bl_ops = { .update_status = atmel_bl_update_status, .get_brightness = atmel_bl_get_brightness, };
drivers/video/aty/aty128fb.c +1 -1
@@ -1787,7 +1787,7 @@ static int aty128_bl_get_brightness(struct backlight_device *bd)return bd->props.brightness; } -static struct backlight_ops aty128_bl_data = { +static const struct backlight_ops aty128_bl_data = { .get_brightness = aty128_bl_get_brightness, .update_status = aty128_bl_update_status, };
drivers/video/aty/atyfb_base.c +1 -1
@@ -2225,7 +2225,7 @@ static int aty_bl_get_brightness(struct backlight_device *bd)return bd->props.brightness; } -static struct backlight_ops aty_bl_data = { +static const struct backlight_ops aty_bl_data = { .get_brightness = aty_bl_get_brightness, .update_status = aty_bl_update_status, };
drivers/video/aty/radeon_backlight.c +1 -1
@@ -127,7 +127,7 @@ static int radeon_bl_get_brightness(struct backlight_device *bd)return bd->props.brightness; } -static struct backlight_ops radeon_bl_data = { +static const struct backlight_ops radeon_bl_data = { .get_brightness = radeon_bl_get_brightness, .update_status = radeon_bl_update_status, };
drivers/video/backlight/adp5520_bl.c +1 -1
@@ -84,7 +84,7 @@ static int adp5520_bl_get_brightness(struct backlight_device *bl)return error ? data->current_brightness : reg_val; } -static struct backlight_ops adp5520_bl_ops = { +static const struct backlight_ops adp5520_bl_ops = { .update_status = adp5520_bl_update_status, .get_brightness = adp5520_bl_get_brightness, };
drivers/video/backlight/adx_bl.c +1 -1
@@ -61,7 +61,7 @@ static int adx_backlight_check_fb(struct fb_info *fb)return 1 ; } -static struct backlight_ops adx_backlight_ops = { +static const struct backlight_ops adx_backlight_ops = { .options =0 , .update_status = adx_backlight_update_status, .get_brightness = adx_backlight_get_brightness,
drivers/video/backlight/atmel-pwm-bl.c +1 -1
@@ -113,7 +113,7 @@ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)return pwm_channel_enable (&pwmbl->pwmc); } -static struct backlight_ops atmel_pwm_bl_ops = { +static const struct backlight_ops atmel_pwm_bl_ops = { .get_brightness = atmel_pwm_bl_get_intensity, .update_status = atmel_pwm_bl_set_intensity, };
drivers/video/backlight/backlight.c +1 -1
@@ -269,7 +269,7 @@ EXPORT_SYMBOL(backlight_force_update);* ERR_PTR() or a pointer to the newly allocated device. */ struct backlight_device *backlight_device_register (const char *name, -struct device *parent,void *devdata,struct backlight_ops *ops) +struct device *parent,void *devdata,const struct backlight_ops *ops) {struct backlight_device *new_bd;int rc;
drivers/video/backlight/corgi_lcd.c +1 -1
@@ -451,7 +451,7 @@ void corgi_lcd_limit_intensity(int limit) }EXPORT_SYMBOL (corgi_lcd_limit_intensity); -static struct backlight_ops corgi_bl_ops = { +static const struct backlight_ops corgi_bl_ops = { .get_brightness = corgi_bl_get_intensity, .update_status = corgi_bl_update_status, };
drivers/video/backlight/cr_bllcd.c +1 -1
@@ -108,7 +108,7 @@ static int cr_backlight_get_intensity(struct backlight_device *bd)return intensity; } -static struct backlight_ops cr_backlight_ops = { +static const struct backlight_ops cr_backlight_ops = { .get_brightness = cr_backlight_get_intensity, .update_status = cr_backlight_set_intensity, };
drivers/video/backlight/da903x_bl.c +1 -1
@@ -94,7 +94,7 @@ static int da903x_backlight_get_brightness(struct backlight_device *bl)return data->current_brightness; } -static struct backlight_ops da903x_backlight_ops = { +static const struct backlight_ops da903x_backlight_ops = { .update_status = da903x_backlight_update_status, .get_brightness = da903x_backlight_get_brightness, };
drivers/video/backlight/generic_bl.c +1 -1
@@ -70,7 +70,7 @@ void corgibl_limit_intensity(int limit) }EXPORT_SYMBOL (corgibl_limit_intensity); -static struct backlight_ops genericbl_ops = { +static const struct backlight_ops genericbl_ops = { .options =BL_CORE_SUSPENDRESUME , .get_brightness = genericbl_get_intensity, .update_status = genericbl_send_intensity,
drivers/video/backlight/hp680_bl.c +1 -1
@@ -98,7 +98,7 @@ static int hp680bl_get_intensity(struct backlight_device *bd)return current_intensity; } -static struct backlight_ops hp680bl_ops = { +static const struct backlight_ops hp680bl_ops = { .get_brightness = hp680bl_get_intensity, .update_status = hp680bl_set_intensity, };
drivers/video/backlight/jornada720_bl.c +1 -1
@@ -93,7 +93,7 @@ out:return ret; } -static struct backlight_ops jornada_bl_ops = { +static const struct backlight_ops jornada_bl_ops = { .get_brightness = jornada_bl_get_brightness, .update_status = jornada_bl_update_status, .options =BL_CORE_SUSPENDRESUME ,
drivers/video/backlight/kb3886_bl.c +1 -1
@@ -134,7 +134,7 @@ static int kb3886bl_get_intensity(struct backlight_device *bd)return kb3886bl_intensity; } -static struct backlight_ops kb3886bl_ops = { +static const struct backlight_ops kb3886bl_ops = { .get_brightness = kb3886bl_get_intensity, .update_status = kb3886bl_send_intensity, };
drivers/video/backlight/locomolcd.c +1 -1
@@ -141,7 +141,7 @@ static int locomolcd_get_intensity(struct backlight_device *bd)return current_intensity; } -static struct backlight_ops locomobl_data = { +static const struct backlight_ops locomobl_data = { .get_brightness = locomolcd_get_intensity, .update_status = locomolcd_set_intensity, };
drivers/video/backlight/mbp_nvidia_bl.c +1 -1
@@ -33,7 +33,7 @@ struct dmi_match_data {unsigned long iostart;unsigned long iolen;/* Backlight operations structure. */ -struct backlight_ops backlight_ops; +const struct backlight_ops backlight_ops; };/* Module parameters. */
drivers/video/backlight/omap1_bl.c +1 -1
@@ -125,7 +125,7 @@ static int omapbl_get_intensity(struct backlight_device *dev)return bl->current_intensity; } -static struct backlight_ops omapbl_ops = { +static const struct backlight_ops omapbl_ops = { .get_brightness = omapbl_get_intensity, .update_status = omapbl_update_status, };
drivers/video/backlight/progear_bl.c +1 -1
@@ -54,7 +54,7 @@ static int progearbl_get_intensity(struct backlight_device *bd)return intensity -HW_LEVEL_MIN ; } -static struct backlight_ops progearbl_ops = { +static const struct backlight_ops progearbl_ops = { .get_brightness = progearbl_get_intensity, .update_status = progearbl_set_intensity, };
drivers/video/backlight/pwm_bl.c +1 -1
@@ -56,7 +56,7 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl)return bl->props.brightness; } -static struct backlight_ops pwm_backlight_ops = { +static const struct backlight_ops pwm_backlight_ops = { .update_status = pwm_backlight_update_status, .get_brightness = pwm_backlight_get_brightness, };
drivers/video/backlight/tosa_bl.c +1 -1
@@ -72,7 +72,7 @@ static int tosa_bl_get_brightness(struct backlight_device *dev)return props->brightness; } -static struct backlight_ops bl_ops = { +static const struct backlight_ops bl_ops = { .get_brightness = tosa_bl_get_brightness, .update_status = tosa_bl_update_status, };
drivers/video/backlight/wm831x_bl.c +1 -1
@@ -112,7 +112,7 @@ static int wm831x_backlight_get_brightness(struct backlight_device *bl)return data->current_brightness; } -static struct backlight_ops wm831x_backlight_ops = { +static const struct backlight_ops wm831x_backlight_ops = { .options =BL_CORE_SUSPENDRESUME , .update_status = wm831x_backlight_update_status, .get_brightness = wm831x_backlight_get_brightness,
drivers/video/bf54x-lq043fb.c +1 -1
@@ -463,7 +463,7 @@ static int bl_get_brightness(struct backlight_device *bd)return 0 ; } -static struct backlight_ops bfin_lq043fb_bl_ops = { +static const struct backlight_ops bfin_lq043fb_bl_ops = { .get_brightness = bl_get_brightness, };
drivers/video/bfin-t350mcqb-fb.c +1 -1
@@ -381,7 +381,7 @@ static int bl_get_brightness(struct backlight_device *bd)return 0 ; } -static struct backlight_ops bfin_lq043fb_bl_ops = { +static const struct backlight_ops bfin_lq043fb_bl_ops = { .get_brightness = bl_get_brightness, };
drivers/video/nvidia/nv_backlight.c +1 -1
@@ -87,7 +87,7 @@ static int nvidia_bl_get_brightness(struct backlight_device *bd)return bd->props.brightness; } -static struct backlight_ops nvidia_bl_ops = { +static const struct backlight_ops nvidia_bl_ops = { .get_brightness = nvidia_bl_get_brightness, .update_status = nvidia_bl_update_status, };
drivers/video/riva/fbdev.c +1 -1
@@ -331,7 +331,7 @@ static int riva_bl_get_brightness(struct backlight_device *bd)return bd->props.brightness; } -static struct backlight_ops riva_bl_ops = { +static const struct backlight_ops riva_bl_ops = { .get_brightness = riva_bl_get_brightness, .update_status = riva_bl_update_status, };
include/linux/backlight.h +6 -6
@@ -36,18 +36,18 @@ struct backlight_device;struct fb_info ;struct backlight_ops { -unsigned int options; +const unsigned int options;#define BL_CORE_SUSPENDRESUME (1 << 0)/* Notify the backlight driver some property has changed */ -int (*update_status)(struct backlight_device *); +int (*const update_status)(struct backlight_device *);/* Return the current backlight brightness (accounting for power, fb_blank etc.) */ -int (*get_brightness)(struct backlight_device *); +int (*const get_brightness)(struct backlight_device *);/* Check if given framebuffer device is the one bound to this backlight; return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ -int (*check_fb)(struct fb_info *); +int (*const check_fb)(struct fb_info *); };/* This structure defines all the properties of a backlight */
@@ -86,7 +86,7 @@ struct backlight_device {registered this device has been unloaded, and if class_get_devdata() points to something in the body of that driver, it is also invalid. */ struct mutex ops_lock; -struct backlight_ops *ops; +const struct backlight_ops *ops;/* The framebuffer notifier block */ struct notifier_block fb_notif;
@@ -103,7 +103,7 @@ static inline void backlight_update_status(struct backlight_device *bd) }extern struct backlight_device *backlight_device_register (const char *name, -struct device *dev,void *devdata,struct backlight_ops *ops); +struct device *dev,void *devdata,const struct backlight_ops *ops);extern void backlight_device_unregister (struct backlight_device *bd);extern void backlight_force_update (struct backlight_device *bd,enum backlight_update_reason reason);
PATCH 4/31 Constify struct block_device_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct block_device_operations.
--- drivers/staging/dst/dcore.c | 2 +- drivers/staging/hv/blkvsc_drv.c | 2 +- include/linux/blkdev.h | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/staging/dst/dcore.c +1 -1
@@ -149,7 +149,7 @@ static int dst_bdev_release(struct gendisk *disk, fmode_t mode)return 0 ; } -static struct block_device_operations dst_blk_ops = { +static const struct block_device_operations dst_blk_ops = { .open = dst_bdev_open, .release = dst_bdev_release, .owner =THIS_MODULE ,
drivers/staging/hv/blkvsc_drv.c +1 -1
@@ -153,7 +153,7 @@ static int blkvsc_ringbuffer_size = BLKVSC_RING_BUFFER_SIZE;/* The one and only one */ static struct blkvsc_driver_context g_blkvsc_drv; -static struct block_device_operations block_ops = { +static const struct block_device_operations block_ops = { .owner =THIS_MODULE , .open = blkvsc_open, .release = blkvsc_release,
include/linux/blkdev.h +11 -11
@@ -1253,19 +1253,19 @@ static inline int blk_integrity_rq(struct request *rq)#endif /* CONFIG_BLK_DEV_INTEGRITY */ struct block_device_operations { -int (*open) (struct block_device *,fmode_t ); -int (*release) (struct gendisk *,fmode_t ); -int (*locked_ioctl) (struct block_device *,fmode_t ,unsigned ,unsigned long ); -int (*ioctl) (struct block_device *,fmode_t ,unsigned ,unsigned long ); -int (*compat_ioctl) (struct block_device *,fmode_t ,unsigned ,unsigned long ); -int (*direct_access) (struct block_device *,sector_t , +int (*const open) (struct block_device *,fmode_t ); +int (*const release) (struct gendisk *,fmode_t ); +int (*const locked_ioctl) (struct block_device *,fmode_t ,unsigned ,unsigned long ); +int (*const ioctl) (struct block_device *,fmode_t ,unsigned ,unsigned long ); +int (*const compat_ioctl) (struct block_device *,fmode_t ,unsigned ,unsigned long ); +int (*const direct_access) (struct block_device *,sector_t ,void **,unsigned long *); -int (*media_changed) (struct gendisk *); -unsigned long long (*set_capacity) (struct gendisk *, +int (*const media_changed) (struct gendisk *); +unsigned long long (*const set_capacity) (struct gendisk *,unsigned long long ); -int (*revalidate_disk) (struct gendisk *); -int (*getgeo)(struct block_device *,struct hd_geometry *); -struct module *owner; +int (*const revalidate_disk) (struct gendisk *); +int (*const getgeo)(struct block_device *,struct hd_geometry *); +const struct module *owner; }; extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int,
PATCH 5/31 Constify struct dma_map_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct dma_map_ops with some exceptions.
--- arch/ia64/hp/common/hwsw_iommu.c | 4 ++-- arch/ia64/hp/common/sba_iommu.c | 4 ++-- arch/ia64/include/asm/dma-mapping.h | 10 +++++----- arch/ia64/include/asm/machvec.h | 4 ++-- arch/ia64/kernel/dma-mapping.c | 4 ++-- arch/ia64/kernel/pci-dma.c | 2 +- arch/ia64/kernel/pci-swiotlb.c | 2 +- arch/ia64/sn/pci/pci_dma.c | 2 +- arch/powerpc/include/asm/device.h | 2 +- arch/powerpc/include/asm/dma-mapping.h | 18 +++++++++--------- arch/powerpc/include/asm/pci.h | 4 ++-- arch/powerpc/include/asm/swiotlb.h | 2 +- arch/powerpc/kernel/dma-iommu.c | 2 +- arch/powerpc/kernel/dma-swiotlb.c | 2 +- arch/powerpc/kernel/dma.c | 2 +- arch/powerpc/kernel/ibmebus.c | 2 +- arch/powerpc/kernel/pci-common.c | 6 +++--- arch/powerpc/kernel/vio.c | 1 + arch/powerpc/platforms/cell/iommu.c | 2 +- arch/powerpc/platforms/ps3/system-bus.c | 4 ++-- arch/sparc/include/asm/dma-mapping.h | 8 ++++---- arch/sparc/kernel/iommu.c | 4 ++-- arch/sparc/kernel/ioport.c | 6 +++--- arch/sparc/kernel/pci_sun4v.c | 2 +- arch/x86/include/asm/device.h | 2 +- arch/x86/include/asm/dma-mapping.h | 10 +++++----- arch/x86/include/asm/iommu.h | 2 +- arch/x86/kernel/amd_iommu.c | 2 +- arch/x86/kernel/pci-calgary_64.c | 2 +- arch/x86/kernel/pci-dma.c | 4 ++-- arch/x86/kernel/pci-gart_64.c | 2 +- arch/x86/kernel/pci-nommu.c | 2 +- arch/x86/kernel/pci-swiotlb.c | 2 +- drivers/pci/intel-iommu.c | 2 +- include/asm-generic/dma-mapping-common.h | 24 ++++++++++++------------ 35 files changed, 77 insertions(+), 76 deletions(-)
arch/ia64/hp/common/hwsw_iommu.c +2 -2
@@ -17,7 +17,7 @@#include <linux/swiotlb.h> #include <asm/machvec.h> -extern struct dma_map_ops sba_dma_ops, swiotlb_dma_ops; +extern const struct dma_map_ops sba_dma_ops, swiotlb_dma_ops;/* swiotlb declarations & definitions: */ extern int swiotlb_late_init_with_default_size (size_t size);
@@ -33,7 +33,7 @@ static inline int use_swiotlb(struct device *dev) !sba_dma_ops.dma_supported (dev, *dev->dma_mask); } -struct dma_map_ops *hwsw_dma_get_ops (struct device *dev) +const struct dma_map_ops *hwsw_dma_get_ops (struct device *dev) {if (use_swiotlb (dev))return &swiotlb_dma_ops;
arch/ia64/hp/common/sba_iommu.c +2 -2
@@ -2077,7 +2077,7 @@ static struct acpi_driver acpi_sba_ioc_driver = { }, }; -extern struct dma_map_ops swiotlb_dma_ops; +extern const struct dma_map_ops swiotlb_dma_ops;static int __init sba_init (void )
@@ -2191,7 +2191,7 @@ sba_page_override(char *str)__setup ("sbapagesize=" ,sba_page_override); -struct dma_map_ops sba_dma_ops = { +const struct dma_map_ops sba_dma_ops = { .alloc_coherent = sba_alloc_coherent, .free_coherent = sba_free_coherent, .map_page = sba_map_page,
arch/ia64/include/asm/dma-mapping.h +5 -5
@@ -12,7 +12,7 @@#define ARCH_HAS_DMA_GET_REQUIRED_MASK -extern struct dma_map_ops *dma_ops; +extern const struct dma_map_ops *dma_ops;extern struct ia64_machine_vector ia64_mv;extern void set_iommu_machvec (void );
@@ -24,7 +24,7 @@ extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int,static inline void *dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *daddr,gfp_t gfp) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);void *caddr; caddr = ops->alloc_coherent (dev, size, daddr, gfp);
@@ -35,7 +35,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,static inline void dma_free_coherent (struct device *dev,size_t size,void *caddr,dma_addr_t daddr) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);debug_dma_free_coherent (dev, size, caddr, daddr); ops->free_coherent (dev, size, caddr, daddr); }
@@ -49,13 +49,13 @@ static inline void dma_free_coherent(struct device *dev, size_t size,static inline int dma_mapping_error (struct device *dev,dma_addr_t daddr) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);return ops->mapping_error (dev, daddr); }static inline int dma_supported (struct device *dev,u64 mask) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);return ops->dma_supported (dev, mask); }
arch/ia64/include/asm/machvec.h +2 -2
@@ -45,7 +45,7 @@ typedef void ia64_mv_kernel_launch_event_t(void);/* DMA-mapping interface: */ typedef void ia64_mv_dma_init (void );typedef u64 ia64_mv_dma_get_required_mask (struct device *); -typedef struct dma_map_ops *ia64_mv_dma_get_ops (struct device *); +typedef const struct dma_map_ops *ia64_mv_dma_get_ops (struct device *);/* * WARNING: The legacy I/O space is _architected_. Platforms are
@@ -251,7 +251,7 @@ extern void machvec_init_from_cmdline(const char *cmdline);# endif /* CONFIG_IA64_GENERIC */ extern void swiotlb_dma_init (void ); -extern struct dma_map_ops *dma_get_ops (struct device *); +extern const struct dma_map_ops *dma_get_ops (struct device *);/* * Define default versions so we can extend machvec for new platforms without having
arch/ia64/kernel/dma-mapping.c +2 -2
@@ -3,7 +3,7 @@/* Set this to 1 if there is a HW IOMMU in the system */ int iommu_detected__read_mostly ; -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;EXPORT_SYMBOL (dma_ops);#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
@@ -16,7 +16,7 @@ static int __init dma_init(void) }fs_initcall (dma_init); -struct dma_map_ops *dma_get_ops (struct device *dev) +const struct dma_map_ops *dma_get_ops (struct device *dev) {return dma_ops; }
arch/ia64/kernel/pci-dma.c +1 -1
@@ -43,7 +43,7 @@ struct device fallback_dev = { .dma_mask = &fallback_dev.coherent_dma_mask, }; -extern struct dma_map_ops intel_dma_ops; +extern const struct dma_map_ops intel_dma_ops;static int __init pci_iommu_init (void ) {
arch/ia64/kernel/pci-swiotlb.c +1 -1
@@ -21,7 +21,7 @@ static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size,return swiotlb_alloc_coherent (dev, size, dma_handle, gfp); } -struct dma_map_ops swiotlb_dma_ops = { +const struct dma_map_ops swiotlb_dma_ops = { .alloc_coherent = ia64_swiotlb_alloc_coherent, .free_coherent = swiotlb_free_coherent, .map_page = swiotlb_map_page,
arch/ia64/sn/pci/pci_dma.c +1 -1
@@ -464,7 +464,7 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)return ret; } -static struct dma_map_ops sn_dma_ops = { +static const struct dma_map_ops sn_dma_ops = { .alloc_coherent = sn_dma_alloc_coherent, .free_coherent = sn_dma_free_coherent, .map_page = sn_dma_map_page,
arch/powerpc/include/asm/device.h +1 -1
@@ -14,7 +14,7 @@ struct dev_archdata {struct device_node *of_node;/* DMA operations on that device */ -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;/* * When an iommu is in use, dma_data is used as a ptr to the base of the
arch/powerpc/include/asm/dma-mapping.h +9 -9
@@ -67,11 +67,11 @@ static inline unsigned long device_to_mask(struct device *dev)* Available generic sets of operations */ #ifdef CONFIG_PPC64 -extern struct dma_map_ops dma_iommu_ops; +extern const struct dma_map_ops dma_iommu_ops;#endif -extern struct dma_map_ops dma_direct_ops; +extern const struct dma_map_ops dma_direct_ops; -static inline struct dma_map_ops *get_dma_ops (struct device *dev) +static inline const struct dma_map_ops *get_dma_ops (struct device *dev) {/* We don't handle the NULL dev case for ISA for now. We could * do it via an out of line call but it is not needed for now. The
@@ -84,7 +84,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)return dev->archdata.dma_ops; } -static inline void set_dma_ops (struct device *dev,struct dma_map_ops *ops) +static inline void set_dma_ops (struct device *dev,const struct dma_map_ops *ops) { dev->archdata.dma_ops = ops; }
@@ -118,7 +118,7 @@ static inline void set_dma_offset(struct device *dev, dma_addr_t off)static inline int dma_supported (struct device *dev,u64 mask) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);if (unlikely (dma_ops ==NULL ))return 0 ;
@@ -132,7 +132,7 @@ static inline int dma_supported(struct device *dev, u64 mask)static inline int dma_set_mask (struct device *dev,u64 dma_mask) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);if (unlikely (dma_ops ==NULL ))return -EIO ;
@@ -147,7 +147,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)static inline void *dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);void *cpu_addr;BUG_ON (!dma_ops);
@@ -162,7 +162,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,static inline void dma_free_coherent (struct device *dev,size_t size,void *cpu_addr,dma_addr_t dma_handle) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);BUG_ON (!dma_ops);
@@ -173,7 +173,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size,static inline int dma_mapping_error (struct device *dev,dma_addr_t dma_addr) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);if (dma_ops->mapping_error)return dma_ops->mapping_error (dev, dma_addr);
arch/powerpc/include/asm/pci.h +2 -2
@@ -65,8 +65,8 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) }#ifdef CONFIG_PCI -extern void set_pci_dma_ops (struct dma_map_ops *dma_ops); -extern struct dma_map_ops *get_pci_dma_ops (void ); +extern void set_pci_dma_ops (const struct dma_map_ops *dma_ops); +extern const struct dma_map_ops *get_pci_dma_ops (void );#else /* CONFIG_PCI */ #define set_pci_dma_ops (d)#define get_pci_dma_ops () NULL
arch/powerpc/include/asm/swiotlb.h +1 -1
@@ -13,7 +13,7 @@#include <linux/swiotlb.h> -extern struct dma_map_ops swiotlb_dma_ops; +extern const struct dma_map_ops swiotlb_dma_ops;static inline void dma_mark_clean (void *addr,size_t size) {}
arch/powerpc/kernel/dma-iommu.c +1 -1
@@ -89,7 +89,7 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)return 1 ; } -struct dma_map_ops dma_iommu_ops = { +const struct dma_map_ops dma_iommu_ops = { .alloc_coherent = dma_iommu_alloc_coherent, .free_coherent = dma_iommu_free_coherent, .map_sg = dma_iommu_map_sg,
arch/powerpc/kernel/dma-swiotlb.c +1 -1
@@ -31,7 +31,7 @@ unsigned int ppc_swiotlb_enable;* map_page, and unmap_page on highmem, use normal dma_ops * for everything else. */ -struct dma_map_ops swiotlb_dma_ops = { +const struct dma_map_ops swiotlb_dma_ops = { .alloc_coherent = dma_direct_alloc_coherent, .free_coherent = dma_direct_free_coherent, .map_sg = swiotlb_map_sg_attrs,
arch/powerpc/kernel/dma.c +1 -1
@@ -134,7 +134,7 @@ static inline void dma_direct_sync_single_range(struct device *dev, }#endif -struct dma_map_ops dma_direct_ops = { +const struct dma_map_ops dma_direct_ops = { .alloc_coherent = dma_direct_alloc_coherent, .free_coherent = dma_direct_free_coherent, .map_sg = dma_direct_map_sg,
arch/powerpc/kernel/ibmebus.c +1 -1
@@ -127,7 +127,7 @@ static int ibmebus_dma_supported(struct device *dev, u64 mask)return 1 ; } -static struct dma_map_ops ibmebus_dma_ops = { +static const struct dma_map_ops ibmebus_dma_ops = { .alloc_coherent = ibmebus_alloc_coherent, .free_coherent = ibmebus_free_coherent, .map_sg = ibmebus_map_sg,
arch/powerpc/kernel/pci-common.c +3 -3
@@ -50,14 +50,14 @@ resource_size_t isa_mem_base;unsigned int ppc_pci_flags =0 ; -static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; +static const struct dma_map_ops *pci_dma_ops = &dma_direct_ops; -void set_pci_dma_ops (struct dma_map_ops *dma_ops) +void set_pci_dma_ops (const struct dma_map_ops *dma_ops) { pci_dma_ops = dma_ops; } -struct dma_map_ops *get_pci_dma_ops (void ) +const struct dma_map_ops *get_pci_dma_ops (void ) {return pci_dma_ops; }
arch/powerpc/kernel/vio.c +1 -0
@@ -601,6 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,vio_cmo_dealloc (viodev, alloc_size); } +/* cannot be const */ struct dma_map_ops vio_dma_mapping_ops = { .alloc_coherent = vio_dma_iommu_alloc_coherent, .free_coherent = vio_dma_iommu_free_coherent,
arch/powerpc/platforms/cell/iommu.c +1 -1
@@ -642,7 +642,7 @@ static int dma_fixed_dma_supported(struct device *dev, u64 mask)static int dma_set_mask_and_switch (struct device *dev,u64 dma_mask); -struct dma_map_ops dma_iommu_fixed_ops = { +const struct dma_map_ops dma_iommu_fixed_ops = { .alloc_coherent = dma_fixed_alloc_coherent, .free_coherent = dma_fixed_free_coherent, .map_sg = dma_fixed_map_sg,
arch/powerpc/platforms/ps3/system-bus.c +2 -2
@@ -694,7 +694,7 @@ static int ps3_dma_supported(struct device *_dev, u64 mask)return mask >=DMA_BIT_MASK (32 ); } -static struct dma_map_ops ps3_sb_dma_ops = { +static const struct dma_map_ops ps3_sb_dma_ops = { .alloc_coherent = ps3_alloc_coherent, .free_coherent = ps3_free_coherent, .map_sg = ps3_sb_map_sg,
@@ -704,7 +704,7 @@ static struct dma_map_ops ps3_sb_dma_ops = { .unmap_page = ps3_unmap_page, }; -static struct dma_map_ops ps3_ioc0_dma_ops = { +static const struct dma_map_ops ps3_ioc0_dma_ops = { .alloc_coherent = ps3_alloc_coherent, .free_coherent = ps3_free_coherent, .map_sg = ps3_ioc0_map_sg,
arch/sparc/include/asm/dma-mapping.h +4 -4
@@ -14,10 +14,10 @@ extern int dma_set_mask(struct device *dev, u64 dma_mask);#define dma_free_noncoherent (d, s, v, h) dma_free_coherent(d, s, v, h)#define dma_is_consistent (d, h) (1) -extern struct dma_map_ops *dma_ops, pci32_dma_ops; +extern struct const dma_map_ops *dma_ops, pci32_dma_ops;extern struct bus_type pci_bus_type; -static inline struct dma_map_ops *get_dma_ops (struct device *dev) +static inline const struct dma_map_ops *get_dma_ops (struct device *dev) {#if defined(CONFIG_SPARC32 ) && defined(CONFIG_PCI )if (dev->bus == &pci_bus_type)
@@ -31,7 +31,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)static inline void *dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);void *cpu_addr; cpu_addr = ops->alloc_coherent (dev, size, dma_handle, flag);
@@ -42,7 +42,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,static inline void dma_free_coherent (struct device *dev,size_t size,void *cpu_addr,dma_addr_t dma_handle) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);debug_dma_free_coherent (dev, size, cpu_addr, dma_handle); ops->free_coherent (dev, size, cpu_addr, dma_handle);
arch/sparc/kernel/iommu.c +2 -2
@@ -826,7 +826,7 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev,spin_unlock_irqrestore (&iommu->lock, flags); } -static struct dma_map_ops sun4u_dma_ops = { +static const struct dma_map_ops sun4u_dma_ops = { .alloc_coherent = dma_4u_alloc_coherent, .free_coherent = dma_4u_free_coherent, .map_page = dma_4u_map_page,
@@ -837,7 +837,7 @@ static struct dma_map_ops sun4u_dma_ops = { .sync_sg_for_cpu = dma_4u_sync_sg_for_cpu, }; -struct dma_map_ops *dma_ops = &sun4u_dma_ops; +const struct dma_map_ops *dma_ops = &sun4u_dma_ops;EXPORT_SYMBOL (dma_ops);extern int pci64_dma_supported (struct pci_dev *pdev,u64 device_mask);
arch/sparc/kernel/ioport.c +3 -3
@@ -392,7 +392,7 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg,BUG (); } -struct dma_map_ops sbus_dma_ops = { +const struct dma_map_ops sbus_dma_ops = { .alloc_coherent = sbus_alloc_coherent, .free_coherent = sbus_free_coherent, .map_page = sbus_map_page,
@@ -403,7 +403,7 @@ struct dma_map_ops sbus_dma_ops = { .sync_sg_for_device = sbus_sync_sg_for_device, }; -struct dma_map_ops *dma_ops = &sbus_dma_ops; +const struct dma_map_ops *dma_ops = &sbus_dma_ops;EXPORT_SYMBOL (dma_ops);static int __init sparc_register_ioport (void )
@@ -640,7 +640,7 @@ static void pci32_sync_sg_for_device(struct device *device, struct scatterlist * } } -struct dma_map_ops pci32_dma_ops = { +const struct dma_map_ops pci32_dma_ops = { .alloc_coherent = pci32_alloc_coherent, .free_coherent = pci32_free_coherent, .map_page = pci32_map_page,
arch/sparc/kernel/pci_sun4v.c +1 -1
@@ -525,7 +525,7 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,spin_unlock_irqrestore (&iommu->lock, flags); } -static struct dma_map_ops sun4v_dma_ops = { +static const struct dma_map_ops sun4v_dma_ops = { .alloc_coherent = dma_4v_alloc_coherent, .free_coherent = dma_4v_free_coherent, .map_page = dma_4v_map_page,
arch/x86/include/asm/device.h +1 -1
@@ -6,7 +6,7 @@ struct dev_archdata {void *acpi_handle;#endif #ifdef CONFIG_X86_64 -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;#endif #ifdef CONFIG_DMAR void *iommu;/* hook for IOMMU specific extension */
arch/x86/include/asm/dma-mapping.h +5 -5
@@ -25,9 +25,9 @@ extern int iommu_merge;extern struct device x86_dma_fallback_dev;extern int panic_on_overflow; -extern struct dma_map_ops *dma_ops; +extern const struct dma_map_ops *dma_ops; -static inline struct dma_map_ops *get_dma_ops (struct device *dev) +static inline const struct dma_map_ops *get_dma_ops (struct device *dev) {#ifdef CONFIG_X86_32 return dma_ops;
@@ -44,7 +44,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)/* Make sure we keep the same behaviour */ static inline int dma_mapping_error (struct device *dev,dma_addr_t dma_addr) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);if (ops->mapping_error)return ops->mapping_error (dev, dma_addr);
@@ -122,7 +122,7 @@ static inline void * dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);void *memory; gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
@@ -149,7 +149,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,static inline void dma_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t bus) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);WARN_ON (irqs_disabled ());/* for portability */
arch/x86/include/asm/iommu.h +1 -1
@@ -3,7 +3,7 @@extern void pci_iommu_shutdown (void );extern void no_iommu_init (void ); -extern struct dma_map_ops nommu_dma_ops; +extern const struct dma_map_ops nommu_dma_ops;extern int force_iommu, no_iommu;extern int iommu_detected;extern int iommu_pass_through;
arch/x86/kernel/amd_iommu.c +1 -1
@@ -2069,7 +2069,7 @@ static void prealloc_protection_domains(void) } } -static struct dma_map_ops amd_iommu_dma_ops = { +static const struct dma_map_ops amd_iommu_dma_ops = { .alloc_coherent = alloc_coherent, .free_coherent = free_coherent, .map_page = map_page,
arch/x86/kernel/pci-calgary_64.c +1 -1
@@ -470,7 +470,7 @@ static void calgary_free_coherent(struct device *dev, size_t size,free_pages ((unsigned long )vaddr,get_order (size)); } -static struct dma_map_ops calgary_dma_ops = { +static const struct dma_map_ops calgary_dma_ops = { .alloc_coherent = calgary_alloc_coherent, .free_coherent = calgary_free_coherent, .map_sg = calgary_map_sg,
arch/x86/kernel/pci-dma.c +2 -2
@@ -14,7 +14,7 @@static int forbid_dac__read_mostly ; -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;EXPORT_SYMBOL (dma_ops);static int iommu_sac_force__read_mostly ;
@@ -243,7 +243,7 @@ early_param("iommu", iommu_setup);int dma_supported (struct device *dev,u64 mask) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);#ifdef CONFIG_PCI if (mask >0xffffffff && forbid_dac >0 ) {
arch/x86/kernel/pci-gart_64.c +1 -1
@@ -679,7 +679,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info)return -1 ; } -static struct dma_map_ops gart_dma_ops = { +static const struct dma_map_ops gart_dma_ops = { .map_sg = gart_map_sg, .unmap_sg = gart_unmap_sg, .map_page = gart_map_page,
arch/x86/kernel/pci-nommu.c +1 -1
@@ -94,7 +94,7 @@ static void nommu_sync_sg_for_device(struct device *dev,flush_write_buffers (); } -struct dma_map_ops nommu_dma_ops = { +const struct dma_map_ops nommu_dma_ops = { .alloc_coherent = dma_generic_alloc_coherent, .free_coherent = nommu_free_coherent, .map_sg = nommu_map_sg,
arch/x86/kernel/pci-swiotlb.c +1 -1
@@ -25,7 +25,7 @@ static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size,return swiotlb_alloc_coherent (hwdev, size, dma_handle, flags); } -static struct dma_map_ops swiotlb_dma_ops = { +static const struct dma_map_ops swiotlb_dma_ops = { .mapping_error = swiotlb_dma_mapping_error, .alloc_coherent = x86_swiotlb_alloc_coherent, .free_coherent = swiotlb_free_coherent,
drivers/pci/intel-iommu.c +1 -1
@@ -2937,7 +2937,7 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr)return !dma_addr; } -struct dma_map_ops intel_dma_ops = { +const struct dma_map_ops intel_dma_ops = { .alloc_coherent = intel_alloc_coherent, .free_coherent = intel_free_coherent, .map_sg = intel_map_sg,
include/asm-generic/dma-mapping-common.h +12 -12
@@ -11,7 +11,7 @@ static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);dma_addr_t addr;kmemcheck_mark_initialized (ptr, size);
@@ -30,7 +30,7 @@ static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr,enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));if (ops->unmap_page)
@@ -42,7 +42,7 @@ static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);int i, ents;struct scatterlist *s;
@@ -59,7 +59,7 @@ static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));debug_dma_unmap_sg (dev, sg, nents, dir);
@@ -71,7 +71,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); +const struct dma_map_ops *ops =get_dma_ops (dev);dma_addr_t addr;kmemcheck_mark_initialized (page_address (page) + offset, size);
@@ -85,7 +85,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,static inline void dma_unmap_page (struct device *dev,dma_addr_t addr,size_t size,enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->unmap_page)
@@ -97,7 +97,7 @@ static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_for_cpu)
@@ -109,7 +109,7 @@ static inline void dma_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_for_device)
@@ -123,7 +123,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev, size_t size, enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_range_for_cpu) {
@@ -140,7 +140,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev, size_t size, enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_range_for_device) {
@@ -155,7 +155,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_sg_for_cpu)
@@ -167,7 +167,7 @@ static inline void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_sg_for_device)
PATCH 6/31 Constify struct e1000_mac_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_mac_operations with some exceptions.
--- drivers/net/e1000e/82571.c | 3 ++- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 3 ++- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/e1000e/82571.c +2 -1
@@ -212,6 +212,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;u32 swsm =0 ;u32 swsm2 =0 ;
@@ -1656,7 +1657,7 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations e82571_mac_ops = { +static const struct e1000_mac_operations e82571_mac_ops = {/* .check_mng_mode: mac type dependent */ /* .check_for_link: media type dependent */ .id_led_init = e1000e_id_led_init,
drivers/net/e1000e/e1000.h +1 -1
@@ -375,7 +375,7 @@ struct e1000_info {u32 pba;u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
drivers/net/e1000e/es2lan.c +2 -1
@@ -207,6 +207,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;/* Set media type */
@@ -1365,7 +1366,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations es2_mac_ops = { +static const struct e1000_mac_operations es2_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000e_check_mng_mode_generic,/* check_for_link dependent on media type */
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3451,7 +3451,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) } } -static struct e1000_mac_operations ich8_mac_ops = { +static const struct e1000_mac_operations ich8_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000_check_mng_mode_ich8lan, .check_for_link = e1000_check_for_copper_link_ich8lan,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1400,7 +1400,7 @@ void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable)wr32 (E1000_VT_CTL , vt_ctl); } -static struct e1000_mac_operations e1000_mac_ops_82575 = { +static const struct e1000_mac_operations e1000_mac_ops_82575 = { .reset_hw = igb_reset_hw_82575, .init_hw = igb_init_hw_82575, .check_for_link = igb_check_for_link_82575,
drivers/net/igb/e1000_hw.h +1 -1
@@ -310,7 +310,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
PATCH 7/31 Constify struct e1000_nvm_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_nvm_operations.
--- drivers/net/e1000e/82571.c | 2 +- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/hw.h | 16 ++++++++-------- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 12 ++++++------ 7 files changed, 19 insertions(+), 19 deletions(-)
drivers/net/e1000e/82571.c +1 -1
@@ -1725,7 +1725,7 @@ static struct e1000_phy_operations e82_phy_ops_bm = { .cfg_on_link_up = NULL, }; -static struct e1000_nvm_operations e82571_nvm_ops = { +static const struct e1000_nvm_operations e82571_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_82571, .read_nvm = e1000e_read_nvm_eerd, .release_nvm = e1000_release_nvm_82571,
drivers/net/e1000e/e1000.h +1 -1
@@ -377,7 +377,7 @@ struct e1000_info {s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops; -struct e1000_nvm_operations *nvm_ops; +const struct e1000_nvm_operations *nvm_ops; };/* hardware capability, feature, and workaround flags */
drivers/net/e1000e/es2lan.c +1 -1
@@ -1400,7 +1400,7 @@ static struct e1000_phy_operations es2_phy_ops = { .cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan, }; -static struct e1000_nvm_operations es2_nvm_ops = { +static const struct e1000_nvm_operations es2_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_80003es2lan, .read_nvm = e1000e_read_nvm_eerd, .release_nvm = e1000_release_nvm_80003es2lan,
drivers/net/e1000e/hw.h +8 -8
@@ -776,13 +776,13 @@ struct e1000_phy_operations {/* Function pointers for the NVM. */ struct e1000_nvm_operations { -s32 (*acquire_nvm)(struct e1000_hw *); -s32 (*read_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); -void (*release_nvm)(struct e1000_hw *); -s32 (*update_nvm)(struct e1000_hw *); -s32 (*valid_led_default)(struct e1000_hw *,u16 *); -s32 (*validate_nvm)(struct e1000_hw *); -s32 (*write_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); +s32 (*const acquire_nvm)(struct e1000_hw *); +s32 (*const read_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); +void (*const release_nvm)(struct e1000_hw *); +s32 (*const update_nvm)(struct e1000_hw *); +s32 (*const valid_led_default)(struct e1000_hw *,u16 *); +s32 (*const validate_nvm)(struct e1000_hw *); +s32 (*const write_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); };struct e1000_mac_info {
@@ -856,7 +856,7 @@ struct e1000_phy_info { };struct e1000_nvm_info { -struct e1000_nvm_operations ops; +const struct e1000_nvm_operations ops;enum e1000_nvm_type type;enum e1000_nvm_override override;
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3485,7 +3485,7 @@ static struct e1000_phy_operations ich8_phy_ops = { .write_phy_reg = e1000e_write_phy_reg_igp, }; -static struct e1000_nvm_operations ich8_nvm_ops = { +static const struct e1000_nvm_operations ich8_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_ich8lan, .read_nvm = e1000_read_nvm_ich8lan, .release_nvm = e1000_release_nvm_ich8lan,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1415,7 +1415,7 @@ static struct e1000_phy_operations e1000_phy_ops_82575 = { .release = igb_release_phy_82575, }; -static struct e1000_nvm_operations e1000_nvm_ops_82575 = { +static const struct e1000_nvm_operations e1000_nvm_ops_82575 = { .acquire = igb_acquire_nvm_82575, .read = igb_read_nvm_eerd, .release = igb_release_nvm_82575,
drivers/net/igb/e1000_hw.h +6 -6
@@ -302,17 +302,17 @@ struct e1000_phy_operations { };struct e1000_nvm_operations { -s32 (*acquire)(struct e1000_hw *); -s32 (*read)(struct e1000_hw *,u16 ,u16 ,u16 *); -void (*release)(struct e1000_hw *); -s32 (*write)(struct e1000_hw *,u16 ,u16 ,u16 *); +s32 (*const acquire)(struct e1000_hw *); +s32 (*const read)(struct e1000_hw *,u16 ,u16 ,u16 *); +void (*const release)(struct e1000_hw *); +s32 (*const write)(struct e1000_hw *,u16 ,u16 ,u16 *); };struct e1000_info {s32 (*get_invariants)(struct e1000_hw *);struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops; -struct e1000_nvm_operations *nvm_ops; +const struct e1000_nvm_operations *nvm_ops; };extern const struct e1000_info e1000_82575_info;
@@ -397,7 +397,7 @@ struct e1000_phy_info { };struct e1000_nvm_info { -struct e1000_nvm_operations ops; +const struct e1000_nvm_operations ops;enum e1000_nvm_type type;enum e1000_nvm_override override;
PATCH 8/31 Constify struct e1000_phy_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_phy_operations.
--- drivers/net/e1000e/82571.c | 6 +++--- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/e1000e/82571.c +3 -3
@@ -1674,7 +1674,7 @@ static struct e1000_mac_operations e82571_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations e82_phy_ops_igp = { +static const struct e1000_phy_operations e82_phy_ops_igp = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy =NULL ,
@@ -1691,7 +1691,7 @@ static struct e1000_phy_operations e82_phy_ops_igp = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_m88 = { +static const struct e1000_phy_operations e82_phy_ops_m88 = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
@@ -1708,7 +1708,7 @@ static struct e1000_phy_operations e82_phy_ops_m88 = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_bm = { +static const struct e1000_phy_operations e82_phy_ops_bm = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
drivers/net/e1000e/e1000.h +1 -1
@@ -376,7 +376,7 @@ struct e1000_info {u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
drivers/net/e1000e/es2lan.c +1 -1
@@ -1383,7 +1383,7 @@ static struct e1000_mac_operations es2_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations es2_phy_ops = { +static const struct e1000_phy_operations es2_phy_ops = { .acquire_phy = e1000_acquire_phy_80003es2lan, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3469,7 +3469,7 @@ static struct e1000_mac_operations ich8_mac_ops = {/* id_led_init dependent on mac type */ }; -static struct e1000_phy_operations ich8_phy_ops = { +static const struct e1000_phy_operations ich8_phy_ops = { .acquire_phy = e1000_acquire_swflag_ich8lan, .check_reset_block = e1000_check_reset_block_ich8lan, .commit_phy =NULL ,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1409,7 +1409,7 @@ static struct e1000_mac_operations e1000_mac_ops_82575 = { .get_speed_and_duplex = igb_get_speed_and_duplex_copper, }; -static struct e1000_phy_operations e1000_phy_ops_82575 = { +static const struct e1000_phy_operations e1000_phy_ops_82575 = { .acquire = igb_acquire_phy_82575, .get_cfg_done = igb_get_cfg_done_82575, .release = igb_release_phy_82575,
drivers/net/igb/e1000_hw.h +1 -1
@@ -311,7 +311,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
PATCH 9/31 Constify struct extent_io_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct extent_io_ops.
--- fs/btrfs/disk-io.c | 4 ++-- fs/btrfs/extent_io.h | 30 +++++++++++++++--------------- fs/btrfs/inode.c | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-)
fs/btrfs/disk-io.c +2 -2
@@ -39,7 +39,7 @@#include "tree-log.h" #include "free-space-cache.h" -static struct extent_io_ops btree_extent_io_ops; +static const struct extent_io_ops btree_extent_io_ops;static void end_workqueue_fn (struct btrfs_work *work);static void free_fs_root (struct btrfs_root *root);
@@ -2585,7 +2585,7 @@ out:return 0 ; } -static struct extent_io_ops btree_extent_io_ops = { +static const struct extent_io_ops btree_extent_io_ops = { .write_cache_pages_lock_hook = btree_lock_page_hook, .readpage_end_io_hook = btree_readpage_end_io_hook, .submit_bio_hook = btree_submit_bio_hook,
fs/btrfs/extent_io.h +15 -15
@@ -49,36 +49,36 @@ typedef int (extent_submit_bio_hook_t)(struct inode *inode, int rw, struct bio *bio, int mirror_num, unsigned long bio_flags);struct extent_io_ops { -int (*fill_delalloc)(struct inode *inode,struct page *locked_page, +int (*const fill_delalloc)(struct inode *inode,struct page *locked_page,u64 start,u64 end,int *page_started,unsigned long *nr_written); -int (*writepage_start_hook)(struct page *page,u64 start,u64 end); -int (*writepage_io_hook)(struct page *page,u64 start,u64 end); +int (*const writepage_start_hook)(struct page *page,u64 start,u64 end); +int (*const writepage_io_hook)(struct page *page,u64 start,u64 end);extent_submit_bio_hook_t *submit_bio_hook; -int (*merge_bio_hook)(struct page *page,unsigned long offset, +int (*const merge_bio_hook)(struct page *page,unsigned long offset,size_t size,struct bio *bio,unsigned long bio_flags); -int (*readpage_io_hook)(struct page *page,u64 start,u64 end); -int (*readpage_io_failed_hook)(struct bio *bio,struct page *page, +int (*const readpage_io_hook)(struct page *page,u64 start,u64 end); +int (*const readpage_io_failed_hook)(struct bio *bio,struct page *page,u64 start,u64 end,struct extent_state *state); -int (*writepage_io_failed_hook)(struct bio *bio,struct page *page, +int (*const writepage_io_failed_hook)(struct bio *bio,struct page *page,u64 start,u64 end,struct extent_state *state); -int (*readpage_end_io_hook)(struct page *page,u64 start,u64 end, +int (*const readpage_end_io_hook)(struct page *page,u64 start,u64 end,struct extent_state *state); -int (*writepage_end_io_hook)(struct page *page,u64 start,u64 end, +int (*const writepage_end_io_hook)(struct page *page,u64 start,u64 end,struct extent_state *state,int uptodate); -int (*set_bit_hook)(struct inode *inode,u64 start,u64 end, +int (*const set_bit_hook)(struct inode *inode,u64 start,u64 end,unsigned long old,unsigned long bits); -int (*clear_bit_hook)(struct inode *inode,struct extent_state *state, +int (*const clear_bit_hook)(struct inode *inode,struct extent_state *state,unsigned long bits); -int (*merge_extent_hook)(struct inode *inode, +int (*const merge_extent_hook)(struct inode *inode,struct extent_state *new,struct extent_state *other); -int (*split_extent_hook)(struct inode *inode, +int (*const split_extent_hook)(struct inode *inode,struct extent_state *orig,u64 split); -int (*write_cache_pages_lock_hook)(struct page *page); +int (*const write_cache_pages_lock_hook)(struct page *page); };struct extent_io_tree {
@@ -88,7 +88,7 @@ struct extent_io_tree {u64 dirty_bytes;spinlock_t lock;spinlock_t buffer_lock; -struct extent_io_ops *ops; +const struct extent_io_ops *ops; };struct extent_state {
fs/btrfs/inode.c +2 -2
@@ -63,7 +63,7 @@ static const struct inode_operations btrfs_file_inode_operations;static const struct address_space_operations btrfs_aops;static const struct address_space_operations btrfs_symlink_aops;static const struct file_operations btrfs_dir_file_operations; -static struct extent_io_ops btrfs_extent_io_ops; +static const struct extent_io_ops btrfs_extent_io_ops;static struct kmem_cache *btrfs_inode_cachep;struct kmem_cache *btrfs_trans_handle_cachep;
@@ -5854,7 +5854,7 @@ static const struct file_operations btrfs_dir_file_operations = { .fsync = btrfs_sync_file, }; -static struct extent_io_ops btrfs_extent_io_ops = { +static const struct extent_io_ops btrfs_extent_io_ops = { .fill_delalloc = run_delalloc_range, .submit_bio_hook = btrfs_submit_bio_hook, .merge_bio_hook = btrfs_merge_bio_hook,
PATCH 10/31 Constify struct file_lock_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct file_lock_operations.
--- include/linux/fs.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/linux/fs.h +2 -2
@@ -1027,8 +1027,8 @@ static inline int file_check_writeable(struct file *filp)typedef struct files_struct *fl_owner_t ;struct file_lock_operations { -void (*fl_copy_lock)(struct file_lock *,struct file_lock *); -void (*fl_release_private)(struct file_lock *); +void (*const fl_copy_lock)(struct file_lock *,struct file_lock *); +void (*const fl_release_private)(struct file_lock *); };struct lock_manager_operations {
PATCH 11/31 Constify struct file_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct file_operations with some exceptions.
--- drivers/acpi/battery.c | 2 +- drivers/char/pty.c | 16 +++++++++--- drivers/char/tty_io.c | 28 ++++----------------- drivers/media/dvb/dvb-core/dvbdev.c | 1 + drivers/net/wireless/b43/debugfs.c | 2 +- drivers/net/wireless/b43legacy/debugfs.c | 2 +- drivers/net/wireless/libertas/debugfs.c | 2 +- drivers/staging/b3dfg/b3dfg.c | 2 +- drivers/staging/dream/qdsp5/adsp_driver.c | 2 +- drivers/staging/dream/qdsp5/audio_aac.c | 2 +- drivers/staging/dream/qdsp5/audio_amrnb.c | 2 +- drivers/staging/dream/qdsp5/audio_evrc.c | 2 +- drivers/staging/dream/qdsp5/audio_in.c | 4 +- drivers/staging/dream/qdsp5/audio_mp3.c | 2 +- drivers/staging/dream/qdsp5/audio_out.c | 4 +- drivers/staging/dream/qdsp5/audio_qcelp.c | 2 +- drivers/staging/dream/qdsp5/snd.c | 2 +- drivers/staging/dream/smd/smd_qmi.c | 2 +- drivers/staging/dream/smd/smd_rpcrouter_device.c | 4 +- drivers/staging/panel/panel.c | 4 +- drivers/staging/poch/poch.c | 2 +- drivers/staging/sep/sep_driver.c | 2 +- drivers/staging/vme/devices/vme_user.c | 2 +- fs/fuse/cuse.c | 20 +++++++++------ fs/fuse/dev.c | 8 +++--- fs/fuse/fuse_i.h | 10 ++++++++ include/linux/tty.h | 14 ++++++++++- include/net/tcp.h | 1 + include/net/udp.h | 1 + kernel/trace/trace_events.c | 2 + virt/kvm/kvm_main.c | 3 ++ 31 files changed, 89 insertions(+), 63 deletions(-)
drivers/acpi/battery.c +1 -1
@@ -763,7 +763,7 @@ DECLARE_FILE_FUNCTIONS(alarm); }static struct battery_file { -struct file_operations ops; +const struct file_operations ops;mode_t mode;const char *name; } acpi_battery_file[] = {
drivers/char/pty.c +12 -4
@@ -682,7 +682,18 @@ static int ptmx_open(struct inode *inode, struct file *filp)return ret; } -static struct file_operations ptmx_fops; +static const struct file_operations ptmx_fops = { + .llseek = no_llseek, + .read = tty_read, + .write = tty_write, + .poll = tty_poll, + .unlocked_ioctl = tty_ioctl, + .compat_ioctl = tty_compat_ioctl, + .open = ptmx_open, + .release = tty_release, + .fasync = tty_fasync, +}; +static void __init unix98_pty_init (void ) {
@@ -736,9 +747,6 @@ static void __init unix98_pty_init(void)register_sysctl_table (pty_root_table);/* Now create the /dev/ptmx special device */ -tty_default_fops (&ptmx_fops); - ptmx_fops.open = ptmx_open; -cdev_init (&ptmx_cdev, &ptmx_fops);if (cdev_add (&ptmx_cdev,MKDEV (TTYAUX_MAJOR ,2 ),1 ) ||register_chrdev_region (MKDEV (TTYAUX_MAJOR ,2 ),1 ,"/dev/ptmx" ) <0 )
drivers/char/tty_io.c +6 -22
@@ -136,21 +136,10 @@ LIST_HEAD(tty_drivers); /* linked list of tty drivers */DEFINE_MUTEX (tty_mutex);EXPORT_SYMBOL (tty_mutex); -static ssize_t tty_read (struct file *,char __user *,size_t ,loff_t *); -static ssize_t tty_write (struct file *,const char __user *,size_t ,loff_t *);ssize_t redirected_tty_write (struct file *,const char __user *,size_t ,loff_t *); -static unsigned int tty_poll (struct file *,poll_table *);static int tty_open (struct inode *,struct file *); -static int tty_release (struct inode *,struct file *);long tty_ioctl (struct file *file,unsigned int cmd,unsigned long arg); -#ifdef CONFIG_COMPAT -static long tty_compat_ioctl (struct file *file,unsigned int cmd, -unsigned long arg); -#else -#define tty_compat_ioctl NULL -#endif -static int tty_fasync (int fd,struct file *filp,int on);static void release_tty (struct tty_struct *tty,int idx);static void __proc_set_tty (struct task_struct *tsk,struct tty_struct *tty);static void proc_set_tty (struct task_struct *tsk,struct tty_struct *tty);
@@ -870,7 +859,7 @@ EXPORT_SYMBOL(start_tty);* read calls may be outstanding in parallel. */ -static ssize_t tty_read (struct file *file,char __user *buf,size_t count, +ssize_t tty_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) {int i;
@@ -1045,7 +1034,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)* write method will not be invoked in parallel for each device. */ -static ssize_t tty_write (struct file *file,const char __user *buf, +ssize_t tty_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) {struct tty_struct *tty;
@@ -1865,7 +1854,7 @@ static int tty_open(struct inode *inode, struct file *filp)* Takes bkl. See tty_release_dev */ -static int tty_release (struct inode *inode,struct file *filp) +int tty_release (struct inode *inode,struct file *filp) {lock_kernel ();tty_release_dev (filp);
@@ -1885,7 +1874,7 @@ static int tty_release(struct inode *inode, struct file *filp)* may be re-entered freely by other callers. */ -static unsigned int tty_poll (struct file *filp,poll_table *wait) +unsigned int tty_poll (struct file *filp,poll_table *wait) {struct tty_struct *tty;struct tty_ldisc *ld;
@@ -1902,7 +1891,7 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)return ret; } -static int tty_fasync (int fd,struct file *filp,int on) +int tty_fasync (int fd,struct file *filp,int on) {struct tty_struct *tty;unsigned long flags;
@@ -2579,7 +2568,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) }#ifdef CONFIG_COMPAT -static long tty_compat_ioctl (struct file *file,unsigned int cmd, +long tty_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct inode *inode = file->f_dentry->d_inode;
@@ -3046,11 +3035,6 @@ struct tty_struct *get_current_tty(void) }EXPORT_SYMBOL_GPL (get_current_tty); -void tty_default_fops (struct file_operations *fops) -{ - *fops = tty_fops; -} -/* * Initialize the console device. This is called *early*, so * we can't necessarily depend on lots of kernel help here.
drivers/media/dvb/dvb-core/dvbdev.c +1 -0
@@ -191,6 +191,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, const struct dvb_device *template, void *priv, int type) { struct dvb_device *dvbdev; +/* cannot be const */ struct file_operations *dvbdevfops;struct device *clsdev;int minor;
drivers/net/wireless/b43/debugfs.c +1 -1
@@ -43,7 +43,7 @@ static struct dentry *rootdir;struct b43_debugfs_fops {ssize_t (*read)(struct b43_wldev *dev,char *buf,size_t bufsize);int (*write)(struct b43_wldev *dev,const char *buf,size_t count); -struct file_operations fops; +const struct file_operations fops;/* Offset of struct b43_dfs_file in struct b43_dfsentry */ size_t file_struct_offset; };
drivers/net/wireless/b43legacy/debugfs.c +1 -1
@@ -44,7 +44,7 @@ static struct dentry *rootdir;struct b43legacy_debugfs_fops {ssize_t (*read)(struct b43legacy_wldev *dev,char *buf,size_t bufsize);int (*write)(struct b43legacy_wldev *dev,const char *buf,size_t count); -struct file_operations fops; +const struct file_operations fops;/* Offset of struct b43legacy_dfs_file in struct b43legacy_dfsentry */ size_t file_struct_offset;/* Take wl->irq_lock before calling read/write? */
drivers/net/wireless/libertas/debugfs.c +1 -1
@@ -708,7 +708,7 @@ out_unlock:struct lbs_debugfs_files {const char *name;int perm; -struct file_operations fops; +const struct file_operations fops; };static const struct lbs_debugfs_files debugfs_files[] = {
drivers/staging/b3dfg/b3dfg.c +1 -1
@@ -848,7 +848,7 @@ static int b3dfg_mmap(struct file *filp, struct vm_area_struct *vma)return r; } -static struct file_operations b3dfg_fops = { +static const struct file_operations b3dfg_fops = { .owner =THIS_MODULE , .open = b3dfg_open, .release = b3dfg_release,
drivers/staging/dream/qdsp5/adsp_driver.c +1 -1
@@ -576,7 +576,7 @@ static struct adsp_device *inode_to_device(struct inode *inode)static dev_t adsp_devno;static struct class *adsp_class; -static struct file_operations adsp_fops = { +static const struct file_operations adsp_fops = { .owner =THIS_MODULE , .open = adsp_open, .unlocked_ioctl = adsp_ioctl,
drivers/staging/dream/qdsp5/audio_aac.c +1 -1
@@ -1022,7 +1022,7 @@ done:return rc; } -static struct file_operations audio_aac_fops = { +static const struct file_operations audio_aac_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,
drivers/staging/dream/qdsp5/audio_amrnb.c +1 -1
@@ -833,7 +833,7 @@ done:return rc; } -static struct file_operations audio_amrnb_fops = { +static const struct file_operations audio_amrnb_fops = { .owner =THIS_MODULE , .open = audamrnb_open, .release = audamrnb_release,
drivers/staging/dream/qdsp5/audio_evrc.c +1 -1
@@ -805,7 +805,7 @@ dma_fail:return rc; } -static struct file_operations audio_evrc_fops = { +static const struct file_operations audio_evrc_fops = { .owner =THIS_MODULE , .open = audevrc_open, .release = audevrc_release,
drivers/staging/dream/qdsp5/audio_in.c +2 -2
@@ -913,7 +913,7 @@ static int audpre_open(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations audio_fops = { +static const struct file_operations audio_fops = { .owner =THIS_MODULE , .open = audio_in_open, .release = audio_in_release,
@@ -922,7 +922,7 @@ static struct file_operations audio_fops = { .unlocked_ioctl = audio_in_ioctl, }; -static struct file_operations audpre_fops = { +static const struct file_operations audpre_fops = { .owner =THIS_MODULE , .open = audpre_open, .unlocked_ioctl = audpre_ioctl,
drivers/staging/dream/qdsp5/audio_mp3.c +1 -1
@@ -941,7 +941,7 @@ done:return rc; } -static struct file_operations audio_mp3_fops = { +static const struct file_operations audio_mp3_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,
drivers/staging/dream/qdsp5/audio_out.c +2 -2
@@ -810,7 +810,7 @@ static int audpp_open(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations audio_fops = { +static const struct file_operations audio_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,
@@ -819,7 +819,7 @@ static struct file_operations audio_fops = { .unlocked_ioctl = audio_ioctl, }; -static struct file_operations audpp_fops = { +static const struct file_operations audpp_fops = { .owner =THIS_MODULE , .open = audpp_open, .unlocked_ioctl = audpp_ioctl,
drivers/staging/dream/qdsp5/audio_qcelp.c +1 -1
@@ -816,7 +816,7 @@ err:return rc; } -static struct file_operations audio_qcelp_fops = { +static const struct file_operations audio_qcelp_fops = { .owner =THIS_MODULE , .open = audqcelp_open, .release = audqcelp_release,
drivers/staging/dream/qdsp5/snd.c +1 -1
@@ -242,7 +242,7 @@ err:return rc; } -static struct file_operations snd_fops = { +static const struct file_operations snd_fops = { .owner =THIS_MODULE , .open = snd_open, .release = snd_release,
drivers/staging/dream/smd/smd_qmi.c +1 -1
@@ -793,7 +793,7 @@ static int qmi_release(struct inode *ip, struct file *fp)return 0 ; } -static struct file_operations qmi_fops = { +static const struct file_operations qmi_fops = { .owner =THIS_MODULE , .read = qmi_read, .write = qmi_write,
drivers/staging/dream/smd/smd_rpcrouter_device.c +2 -2
@@ -214,7 +214,7 @@ static long rpcrouter_ioctl(struct file *filp, unsigned int cmd,return rc; } -static struct file_operations rpcrouter_server_fops = { +static const struct file_operations rpcrouter_server_fops = { .owner =THIS_MODULE , .open = rpcrouter_open, .release = rpcrouter_release,
@@ -224,7 +224,7 @@ static struct file_operations rpcrouter_server_fops = { .unlocked_ioctl = rpcrouter_ioctl, }; -static struct file_operations rpcrouter_router_fops = { +static const struct file_operations rpcrouter_router_fops = { .owner =THIS_MODULE , .open = rpcrouter_open, .release = rpcrouter_release,
drivers/staging/panel/panel.c +2 -2
@@ -1305,7 +1305,7 @@ static int lcd_release(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations lcd_fops = { +static const struct file_operations lcd_fops = { .write = lcd_write, .open = lcd_open, .release = lcd_release,
@@ -1565,7 +1565,7 @@ static int keypad_release(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations keypad_fops = { +static const struct file_operations keypad_fops = { .read = keypad_read,/* read */ .open = keypad_open,/* open */ .release = keypad_release,/* close */
drivers/staging/poch/poch.c +1 -1
@@ -1057,7 +1057,7 @@ static int poch_ioctl(struct inode *inode, struct file *filp,return 0 ; } -static struct file_operations poch_fops = { +static const struct file_operations poch_fops = { .owner =THIS_MODULE , .open = poch_open, .release = poch_release,
drivers/staging/sep/sep_driver.c +1 -1
@@ -2603,7 +2603,7 @@ static struct pci_driver sep_pci_driver = {static dev_t sep_devno;/* the files operations structure of the driver */ -static struct file_operations sep_file_operations = { +static const struct file_operations sep_file_operations = { .owner =THIS_MODULE , .ioctl = sep_ioctl, .poll = sep_poll,
drivers/staging/vme/devices/vme_user.c +1 -1
@@ -136,7 +136,7 @@ static int vme_user_ioctl(struct inode *, struct file *, unsigned int,static int __init vme_user_probe (struct device *,int ,int ); static int __exit vme_user_remove(struct device *, int, int); -static struct file_operations vme_user_fops = { +static const struct file_operations vme_user_fops = { .open = vme_user_open, .release = vme_user_release, .read = vme_user_read,
fs/fuse/cuse.c +12 -8
@@ -528,8 +528,18 @@ static int cuse_channel_release(struct inode *inode, struct file *file)return rc; } -static struct file_operations cuse_channel_fops;/* initialized during init */ - +static const struct file_operations cuse_channel_fops = {/* initialized during init */ + .owner =THIS_MODULE , + .llseek = no_llseek, + .read = do_sync_read, + .aio_read = fuse_dev_read, + .write = do_sync_write, + .aio_write = fuse_dev_write, + .poll = fuse_dev_poll, + .open = cuse_channel_open, + .release = cuse_channel_release, + .fasync = fuse_dev_fasync, +};/************************************************************************** * Misc stuff and module initializatiion
@@ -575,12 +585,6 @@ static int __init cuse_init(void)for (i =0 ; i <CUSE_CONNTBL_LEN ; i++)INIT_LIST_HEAD (&cuse_conntbl[i]); -/* inherit and extend fuse_dev_operations */ - cuse_channel_fops = fuse_dev_operations; - cuse_channel_fops.owner =THIS_MODULE ; - cuse_channel_fops.open = cuse_channel_open; - cuse_channel_fops.release = cuse_channel_release; - cuse_class =class_create (THIS_MODULE ,"cuse" );if (IS_ERR (cuse_class))return PTR_ERR (cuse_class);
fs/fuse/dev.c +4 -4
@@ -745,7 +745,7 @@ __releases(&fc->lock)* request_end(). Otherwise add it to the processing list, and set * the 'sent' flag. */ -static ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov, +ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos) {int err;
@@ -987,7 +987,7 @@ static int copy_out_args(struct fuse_copy_state *cs, struct fuse_out *out,* it from the list and copy the rest of the buffer to the request. * The request is finished by calling request_end() */ -static ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov, +ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos) {int err;
@@ -1084,7 +1084,7 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,return err; } -static unsigned fuse_dev_poll (struct file *file,poll_table *wait) +unsigned fuse_dev_poll (struct file *file,poll_table *wait) {unsigned mask =POLLOUT |POLLWRNORM ;struct fuse_conn *fc =fuse_get_conn (file);
@@ -1210,7 +1210,7 @@ int fuse_dev_release(struct inode *inode, struct file *file) }EXPORT_SYMBOL_GPL (fuse_dev_release); -static int fuse_dev_fasync (int fd,struct file *file,int on) +int fuse_dev_fasync (int fd,struct file *file,int on) {struct fuse_conn *fc =fuse_get_conn (file);if (!fc)
fs/fuse/fuse_i.h +10 -0
@@ -521,6 +521,16 @@ extern const struct file_operations fuse_dev_operations;extern const struct dentry_operations fuse_dentry_operations; +extern ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov, +unsigned long nr_segs,loff_t pos); + +extern ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov, +unsigned long nr_segs,loff_t pos); + +extern unsigned fuse_dev_poll (struct file *file,poll_table *wait); + +extern int fuse_dev_fasync (int fd,struct file *file,int on); +/** * Inode to nodeid comparison. */
include/linux/tty.h +13 -1
@@ -13,6 +13,7 @@#include <linux/tty_driver.h> #include <linux/tty_ldisc.h> #include <linux/mutex.h> +#include <linux/poll.h> #include <asm/system.h>
@@ -432,7 +433,6 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);extern dev_t tty_devnum (struct tty_struct *tty);extern void proc_clear_tty (struct task_struct *p);extern struct tty_struct *get_current_tty (void ); -extern void tty_default_fops (struct file_operations *fops);extern struct tty_struct *alloc_tty_struct (void );extern void free_tty_struct (struct tty_struct *tty); extern void initialize_tty_struct(struct tty_struct *tty,
@@ -482,6 +482,18 @@ extern void tty_ldisc_begin(void);/* This last one is just for the tty layer internals and shouldn't be used elsewhere */ extern void tty_ldisc_enable (struct tty_struct *tty); +/* tty_io.c */ +extern ssize_t tty_read (struct file *,char __user *,size_t ,loff_t *); +extern ssize_t tty_write (struct file *,const char __user *,size_t ,loff_t *); +extern unsigned int tty_poll (struct file *,poll_table *); +#ifdef CONFIG_COMPAT +extern long tty_compat_ioctl (struct file *file,unsigned int cmd, +unsigned long arg); +#else +#define tty_compat_ioctl NULL +#endif +extern int tty_release (struct inode *,struct file *); +extern int tty_fasync (int fd,struct file *filp,int on);/* n_tty.c */ extern struct tty_ldisc_ops tty_ldisc_N_TTY;
include/net/tcp.h +1 -0
@@ -1414,6 +1414,7 @@ enum tcp_seq_states {struct tcp_seq_afinfo {char *name;sa_family_t family; +/* cannot be const */ struct file_operations seq_fops;struct seq_operations seq_ops; };
include/net/udp.h +1 -0
@@ -187,6 +187,7 @@ struct udp_seq_afinfo {char *name;sa_family_t family;struct udp_table *udp_table; +/* cannot be const */ struct file_operations seq_fops;struct seq_operations seq_ops; };
kernel/trace/trace_events.c +2 -0
@@ -951,6 +951,8 @@ static LIST_HEAD(ftrace_module_file_list);* Modules must own their file_operations to keep up with * reference counting. */ + +/* cannot be const */ struct ftrace_module_file_ops {struct list_head list;struct module *mod;
virt/kvm/kvm_main.c +3 -0
@@ -1745,6 +1745,7 @@ static int kvm_vcpu_release(struct inode *inode, struct file *filp)return 0 ; } +/* cannot be const */ static struct file_operations kvm_vcpu_fops = { .release = kvm_vcpu_release, .unlocked_ioctl = kvm_vcpu_ioctl,
@@ -2341,6 +2342,7 @@ static int kvm_vm_mmap(struct file *file, struct vm_area_struct *vma)return 0 ; } +/* cannot be const */ static struct file_operations kvm_vm_fops = { .release = kvm_vm_release, .unlocked_ioctl = kvm_vm_ioctl,
@@ -2428,6 +2430,7 @@ out:return r; } +/* cannot be const */ static struct file_operations kvm_chardev_ops = { .unlocked_ioctl = kvm_dev_ioctl, .compat_ioctl = kvm_dev_ioctl,
PATCH 12/31 Constify struct hv_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct hv_ops with some exceptions.
--- drivers/char/hvc_beat.c | 2 +- drivers/char/hvc_console.c | 6 +++--- drivers/char/hvc_console.h | 6 +++--- drivers/char/hvc_iseries.c | 2 +- drivers/char/hvc_iucv.c | 2 +- drivers/char/hvc_rtas.c | 2 +- drivers/char/hvc_udbg.c | 2 +- drivers/char/hvc_vio.c | 2 +- drivers/char/hvc_xen.c | 2 +- drivers/char/virtio_console.c | 1 + 10 files changed, 14 insertions(+), 13 deletions(-)
drivers/char/hvc_beat.c +1 -1
@@ -84,7 +84,7 @@ static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt)return cnt; } -static struct hv_ops hvc_beat_get_put_ops = { +static const struct hv_ops hvc_beat_get_put_ops = { .get_chars = hvc_beat_get_chars, .put_chars = hvc_beat_put_chars, };
drivers/char/hvc_console.c +3 -3
@@ -125,7 +125,7 @@ static struct hvc_struct *hvc_get_by_index(int index)* console interfaces but can still be used as a tty device. This has to be * static because kmalloc will not work during early console init. */ -static struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES ]; +static const struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES ];static uint32_t vtermnos[MAX_NR_HVC_CONSOLES ] = {[0 ...MAX_NR_HVC_CONSOLES -1 ] =-1 };
@@ -247,7 +247,7 @@ static void destroy_hvc_struct(struct kref *kref)* vty adapters do NOT get an hvc_instantiate() callback since they * appear after early console init. */ -int hvc_instantiate (uint32_t vtermno,int index,struct hv_ops *ops) +int hvc_instantiate (uint32_t vtermno,int index,const struct hv_ops *ops) {struct hvc_struct *hp;
@@ -749,7 +749,7 @@ static const struct tty_operations hvc_ops = { };struct hvc_struct __devinit *hvc_alloc (uint32_t vtermno,int data, -struct hv_ops *ops,int outbuf_size) +const struct hv_ops *ops,int outbuf_size) {struct hvc_struct *hp;int i;
drivers/char/hvc_console.h +3 -3
@@ -55,7 +55,7 @@ struct hvc_struct {int outbuf_size;int n_outbuf;uint32_t vtermno; -struct hv_ops *ops; +const struct hv_ops *ops;int irq_requested;int data;struct winsize ws;
@@ -76,11 +76,11 @@ struct hv_ops { };/* Register a vterm and a slot index for use as a console (console_init) */ -extern int hvc_instantiate (uint32_t vtermno,int index,struct hv_ops *ops); +extern int hvc_instantiate (uint32_t vtermno,int index,const struct hv_ops *ops);/* register a vterm for hvc tty operation (module_init or hotplug add) */ extern struct hvc_struct *__devinit hvc_alloc (uint32_t vtermno,int data, -struct hv_ops *ops,int outbuf_size); +const struct hv_ops *ops,int outbuf_size);/* remove a vterm from hvc tty operation (module_exit or hotplug remove) */ extern int hvc_remove (struct hvc_struct *hp);
drivers/char/hvc_iseries.c +1 -1
@@ -197,7 +197,7 @@ done:return sent; } -static struct hv_ops hvc_get_put_ops = { +static const struct hv_ops hvc_get_put_ops = { .get_chars = get_chars, .put_chars = put_chars, .notifier_add = notifier_add_irq,
drivers/char/hvc_iucv.c +1 -1
@@ -922,7 +922,7 @@ static int hvc_iucv_pm_restore_thaw(struct device *dev)/* HVC operations */ -static struct hv_ops hvc_iucv_ops = { +static const struct hv_ops hvc_iucv_ops = { .get_chars = hvc_iucv_get_chars, .put_chars = hvc_iucv_put_chars, .notifier_add = hvc_iucv_notifier_add,
drivers/char/hvc_rtas.c +1 -1
@@ -71,7 +71,7 @@ static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count)return i; } -static struct hv_ops hvc_rtas_get_put_ops = { +static const struct hv_ops hvc_rtas_get_put_ops = { .get_chars = hvc_rtas_read_console, .put_chars = hvc_rtas_write_console, };
drivers/char/hvc_udbg.c +1 -1
@@ -58,7 +58,7 @@ static int hvc_udbg_get(uint32_t vtermno, char *buf, int count)return i; } -static struct hv_ops hvc_udbg_ops = { +static const struct hv_ops hvc_udbg_ops = { .get_chars = hvc_udbg_get, .put_chars = hvc_udbg_put, };
drivers/char/hvc_vio.c +1 -1
@@ -77,7 +77,7 @@ static int filtered_get_chars(uint32_t vtermno, char *buf, int count)return got; } -static struct hv_ops hvc_get_put_ops = { +static const struct hv_ops hvc_get_put_ops = { .get_chars = filtered_get_chars, .put_chars = hvc_put_chars, .notifier_add = notifier_add_irq,
drivers/char/hvc_xen.c +1 -1
@@ -120,7 +120,7 @@ static int read_console(uint32_t vtermno, char *buf, int len)return recv; } -static struct hv_ops hvc_ops = { +static const struct hv_ops hvc_ops = { .get_chars = read_console, .put_chars = write_console, .notifier_add = notifier_add_irq,
drivers/char/virtio_console.c +1 -0
@@ -44,6 +44,7 @@ static unsigned int in_len;static char *in, *inbuf;/* The operations for our console. */ +/* cannot be const */ static struct hv_ops virtio_cons;/* The hvc device */
PATCH 13/31 Constify struct intel_dvo_dev_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct intel_dvo_dev_ops.
--- drivers/gpu/drm/i915/dvo.h | 16 ++++++++-------- drivers/gpu/drm/i915/dvo_ch7017.c | 2 +- drivers/gpu/drm/i915/dvo_ch7xxx.c | 2 +- drivers/gpu/drm/i915/dvo_ivch.c | 2 +- drivers/gpu/drm/i915/dvo_sil164.c | 2 +- drivers/gpu/drm/i915/dvo_tfp410.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/dvo.h +8 -8
@@ -135,23 +135,23 @@ struct intel_dvo_dev_ops {* * \return singly-linked list of modes or NULL if no modes found. */ -struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo); +struct drm_display_mode *(*const get_modes)(struct intel_dvo_device *dvo);/** * Clean up driver-specific bits of the output */ -void (*destroy) (struct intel_dvo_device *dvo); +void (*const destroy) (struct intel_dvo_device *dvo);/** * Debugging hook to dump device registers to log file */ - void (*dump_regs)(struct intel_dvo_device *dvo); + void (* const dump_regs)(struct intel_dvo_device *dvo); }; -extern struct intel_dvo_dev_ops sil164_ops; -extern struct intel_dvo_dev_ops ch7xxx_ops; -extern struct intel_dvo_dev_ops ivch_ops; -extern struct intel_dvo_dev_ops tfp410_ops; -extern struct intel_dvo_dev_ops ch7017_ops; +extern const struct intel_dvo_dev_ops sil164_ops; +extern const struct intel_dvo_dev_ops ch7xxx_ops; +extern const struct intel_dvo_dev_ops ivch_ops; +extern const struct intel_dvo_dev_ops tfp410_ops; +extern const struct intel_dvo_dev_ops ch7017_ops;#endif /* _INTEL_DVO_H */
drivers/gpu/drm/i915/dvo_ch7017.c +1 -1
@@ -443,7 +443,7 @@ static void ch7017_destroy(struct intel_dvo_device *dvo) } } -struct intel_dvo_dev_ops ch7017_ops = { +const struct intel_dvo_dev_ops ch7017_ops = { .init = ch7017_init, .detect = ch7017_detect, .mode_valid = ch7017_mode_valid,
drivers/gpu/drm/i915/dvo_ch7xxx.c +1 -1
@@ -356,7 +356,7 @@ static void ch7xxx_destroy(struct intel_dvo_device *dvo) } } -struct intel_dvo_dev_ops ch7xxx_ops = { +const struct intel_dvo_dev_ops ch7xxx_ops = { .init = ch7xxx_init, .detect = ch7xxx_detect, .mode_valid = ch7xxx_mode_valid,
drivers/gpu/drm/i915/dvo_ivch.c +1 -1
@@ -430,7 +430,7 @@ static void ivch_destroy(struct intel_dvo_device *dvo) } } -struct intel_dvo_dev_ops ivch_ops= { +const struct intel_dvo_dev_ops ivch_ops= { .init = ivch_init, .dpms = ivch_dpms, .save = ivch_save,
drivers/gpu/drm/i915/dvo_sil164.c +1 -1
@@ -290,7 +290,7 @@ static void sil164_destroy(struct intel_dvo_device *dvo) } } -struct intel_dvo_dev_ops sil164_ops = { +const struct intel_dvo_dev_ops sil164_ops = { .init = sil164_init, .detect = sil164_detect, .mode_valid = sil164_mode_valid,
drivers/gpu/drm/i915/dvo_tfp410.c +1 -1
@@ -323,7 +323,7 @@ static void tfp410_destroy(struct intel_dvo_device *dvo) } } -struct intel_dvo_dev_ops tfp410_ops = { +const struct intel_dvo_dev_ops tfp410_ops = { .init = tfp410_init, .detect = tfp410_detect, .mode_valid = tfp410_mode_valid,
PATCH 14/31 Constify struct item_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct item_operations.
--- fs/reiserfs/item_ops.c | 12 ++++++------ include/linux/reiserfs_fs.h | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-)
fs/reiserfs/item_ops.c +6 -6
@@ -102,7 +102,7 @@ static void sd_print_vi(struct virtual_item *vi) vi->vi_index, vi->vi_type, vi->vi_ih); } -static struct item_operations stat_data_ops = { +static const struct item_operations stat_data_ops = { .bytes_number = sd_bytes_number, .decrement_key = sd_decrement_key, .is_left_mergeable = sd_is_left_mergeable,
@@ -196,7 +196,7 @@ static void direct_print_vi(struct virtual_item *vi) vi->vi_index, vi->vi_type, vi->vi_ih); } -static struct item_operations direct_ops = { +static const struct item_operations direct_ops = { .bytes_number = direct_bytes_number, .decrement_key = direct_decrement_key, .is_left_mergeable = direct_is_left_mergeable,
@@ -341,7 +341,7 @@ static void indirect_print_vi(struct virtual_item *vi) vi->vi_index, vi->vi_type, vi->vi_ih); } -static struct item_operations indirect_ops = { +static const struct item_operations indirect_ops = { .bytes_number = indirect_bytes_number, .decrement_key = indirect_decrement_key, .is_left_mergeable = indirect_is_left_mergeable,
@@ -628,7 +628,7 @@ static void direntry_print_vi(struct virtual_item *vi)printk ("\n" ); } -static struct item_operations direntry_ops = { +static const struct item_operations direntry_ops = { .bytes_number = direntry_bytes_number, .decrement_key = direntry_decrement_key, .is_left_mergeable = direntry_is_left_mergeable,
@@ -724,7 +724,7 @@ static void errcatch_print_vi(struct virtual_item *vi) "Invalid item type observed, run fsck ASAP"); } -static struct item_operations errcatch_ops = { +static const struct item_operations errcatch_ops = { errcatch_bytes_number, errcatch_decrement_key, errcatch_is_left_mergeable,
@@ -746,7 +746,7 @@ static struct item_operations errcatch_ops = {#error Item types must use disk-format assigned values.#endif -struct item_operations *item_ops[TYPE_ANY +1 ] = { +const struct item_operations *const item_ops[TYPE_ANY +1 ] = { &stat_data_ops, &indirect_ops, &direct_ops,
include/linux/reiserfs_fs.h +12 -12
@@ -1534,24 +1534,24 @@ static inline struct super_block *sb_from_bi(struct buffer_info *bi)*/ struct item_operations { -int (*bytes_number) (struct item_head * ih,int block_size); -void (*decrement_key) (struct cpu_key *); -int (*is_left_mergeable) (struct reiserfs_key * ih, +int (*const bytes_number) (struct item_head * ih,int block_size); +void (*const decrement_key) (struct cpu_key *); +int (*const is_left_mergeable) (struct reiserfs_key * ih,unsigned long bsize); -void (*print_item) (struct item_head *,char *item); -void (*check_item) (struct item_head *,char *item); +void (*const print_item) (struct item_head *,char *item); +void (*const check_item) (struct item_head *,char *item); -int (*create_vi) (struct virtual_node * vn,struct virtual_item * vi, +int (*const create_vi) (struct virtual_node * vn,struct virtual_item * vi,int is_affected,int insert_size); -int (*check_left) (struct virtual_item * vi,int free, +int (*const check_left) (struct virtual_item * vi,int free,int start_skip,int end_skip); -int (*check_right) (struct virtual_item * vi,int free); -int (*part_size) (struct virtual_item * vi,int from,int to); -int (*unit_num) (struct virtual_item * vi); -void (*print_vi) (struct virtual_item * vi); +int (*const check_right) (struct virtual_item * vi,int free); +int (*const part_size) (struct virtual_item * vi,int from,int to); +int (*const unit_num) (struct virtual_item * vi); +void (*const print_vi) (struct virtual_item * vi); }; -extern struct item_operations *item_ops[TYPE_ANY +1 ]; +extern const struct item_operations *const item_ops[TYPE_ANY +1 ];#define op_bytes_number (ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)#define op_is_left_mergeable (key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize)
PATCH 15/31 Constify struct iwl_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct iwl_ops.
--- drivers/net/wireless/iwlwifi/iwl-1000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.c | 2 +- drivers/net/wireless/iwlwifi/iwl-5000.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-6000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-dev.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +1 -1
@@ -137,7 +137,7 @@ static struct iwl_lib_ops iwl1000_lib = { }, }; -static struct iwl_ops iwl1000_ops = { +static const struct iwl_ops iwl1000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl1000_lib, .hcmd = &iwl5000_hcmd,
drivers/net/wireless/iwlwifi/iwl-3945.c +1 -1
@@ -2876,7 +2876,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { .build_addsta_hcmd = iwl3945_build_addsta_hcmd, }; -static struct iwl_ops iwl3945_ops = { +static const struct iwl_ops iwl3945_ops = { .ucode = &iwl3945_ucode, .lib = &iwl3945_lib, .hcmd = &iwl3945_hcmd,
drivers/net/wireless/iwlwifi/iwl-4965.c +1 -1
@@ -2335,7 +2335,7 @@ static struct iwl_lib_ops iwl4965_lib = { }, }; -static struct iwl_ops iwl4965_ops = { +static const struct iwl_ops iwl4965_ops = { .ucode = &iwl4965_ucode, .lib = &iwl4965_lib, .hcmd = &iwl4965_hcmd,
drivers/net/wireless/iwlwifi/iwl-5000.c +2 -2
@@ -1627,14 +1627,14 @@ static struct iwl_lib_ops iwl5150_lib = { }, }; -struct iwl_ops iwl5000_ops = { +const struct iwl_ops iwl5000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl5000_lib, .hcmd = &iwl5000_hcmd, .utils = &iwl5000_hcmd_utils, }; -static struct iwl_ops iwl5150_ops = { +static const struct iwl_ops iwl5150_ops = { .ucode = &iwl5000_ucode, .lib = &iwl5150_lib, .hcmd = &iwl5000_hcmd,
drivers/net/wireless/iwlwifi/iwl-6000.c +1 -1
@@ -146,7 +146,7 @@ static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = { .calc_rssi = iwl5000_calc_rssi, }; -static struct iwl_ops iwl6000_ops = { +static const struct iwl_ops iwl6000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl6000_lib, .hcmd = &iwl5000_hcmd,
drivers/net/wireless/iwlwifi/iwl-dev.h +1 -1
@@ -67,7 +67,7 @@ struct iwl_tx_queue;/* shared structures from iwl-5000.c */ extern struct iwl_mod_params iwl50_mod_params; -extern struct iwl_ops iwl5000_ops; +extern const struct iwl_ops iwl5000_ops;extern struct iwl_ucode_ops iwl5000_ucode;extern struct iwl_lib_ops iwl5000_lib;extern struct iwl_hcmd_ops iwl5000_hcmd;
PATCH 16/31 Constify struct kgdb_arch for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct kgdb_arch with some exceptions.
--- arch/arm/kernel/kgdb.c | 2 +- arch/blackfin/kernel/kgdb.c | 2 +- arch/mips/kernel/kgdb.c | 1 + arch/powerpc/kernel/kgdb.c | 4 ++-- arch/sh/kernel/kgdb.c | 2 +- arch/sparc/kernel/kgdb_32.c | 2 +- arch/sparc/kernel/kgdb_64.c | 2 +- arch/x86/kernel/kgdb.c | 2 +- include/linux/kgdb.h | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-)
arch/arm/kernel/kgdb.c +1 -1
@@ -190,7 +190,7 @@ void kgdb_arch_exit(void)* and we handle the normal undef case within the do_undefinstr * handler. */ -struct kgdb_arch arch_kgdb_ops = { +const struct kgdb_arch arch_kgdb_ops = { #ifndef __ARMEB__ .gdb_bpt_instr = {0xfe, 0xde, 0xff, 0xe7} #else /* ! __ARMEB__ */
arch/blackfin/kernel/kgdb.c +1 -1
@@ -428,7 +428,7 @@ int kgdb_arch_handle_exception(int vector, int signo,return -1 ;/* this means that we do not want to exit from the handler */ } -struct kgdb_arch arch_kgdb_ops = { +const struct kgdb_arch arch_kgdb_ops = { .gdb_bpt_instr = {0xa1 }, #ifdef CONFIG_SMP .flags = KGDB_HW_BREAKPOINT|KGDB_THR_PROC_SWAP,
arch/mips/kernel/kgdb.c +1 -0
@@ -245,6 +245,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,return -1 ; } +/* cannot be const */ struct kgdb_arch arch_kgdb_ops;/*
arch/powerpc/kernel/kgdb.c +2 -2
@@ -126,7 +126,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)if (kgdb_handle_exception (0 ,SIGTRAP ,0 , regs) !=0 )return 0 ; -if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) +if (*(u32 *) (regs->nip) == *(const u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) regs->nip +=4 ;return 1 ;
@@ -353,7 +353,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,/* * Global data */ -struct kgdb_arch arch_kgdb_ops = { +const struct kgdb_arch arch_kgdb_ops = { .gdb_bpt_instr = {0x7d ,0x82 ,0x10 ,0x08 }, };
arch/sh/kernel/kgdb.c +1 -1
@@ -271,7 +271,7 @@ void kgdb_arch_exit(void) { } -struct kgdb_arch arch_kgdb_ops = { +const struct kgdb_arch arch_kgdb_ops = {/* Breakpoint instruction: trapa #0x3c */ #ifdef CONFIG_CPU_LITTLE_ENDIAN .gdb_bpt_instr = { 0x3c, 0xc3 },
arch/sparc/kernel/kgdb_32.c +1 -1
@@ -158,7 +158,7 @@ void kgdb_arch_exit(void) { } -struct kgdb_arch arch_kgdb_ops = { +const struct kgdb_arch arch_kgdb_ops = {/* Breakpoint instruction: ta 0x7d */ .gdb_bpt_instr = {0x91 ,0xd0 ,0x20 ,0x7d }, };
arch/sparc/kernel/kgdb_64.c +1 -1
@@ -180,7 +180,7 @@ void kgdb_arch_exit(void) { } -struct kgdb_arch arch_kgdb_ops = { +const struct kgdb_arch arch_kgdb_ops = {/* Breakpoint instruction: ta 0x72 */ .gdb_bpt_instr = {0x91 ,0xd0 ,0x20 ,0x72 }, };
arch/x86/kernel/kgdb.c +1 -1
@@ -573,7 +573,7 @@ unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs)return instruction_pointer (regs); } -struct kgdb_arch arch_kgdb_ops = { +const struct kgdb_arch arch_kgdb_ops = {/* Breakpoint instruction: */ .gdb_bpt_instr = {0xcc }, .flags =KGDB_HW_BREAKPOINT ,
include/linux/kgdb.h +1 -1
@@ -259,7 +259,7 @@ struct kgdb_io {void (*post_exception) (void ); }; -extern struct kgdb_arch arch_kgdb_ops; +extern const struct kgdb_arch arch_kgdb_ops;extern unsigned long __weak kgdb_arch_pc (int exception,struct pt_regs *regs);
PATCH 17/31 Constify struct kgdb_io for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct kgdb_io.
--- drivers/misc/kgdbts.c | 4 ++-- drivers/serial/kgdboc.c | 4 ++-- include/linux/kgdb.h | 18 +++++++++--------- kernel/kgdb.c | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-)
drivers/misc/kgdbts.c +2 -2
@@ -118,7 +118,7 @@ } while (0)#define MAX_CONFIG_LEN 40 -static struct kgdb_io kgdbts_io_ops; +static const struct kgdb_io kgdbts_io_ops;static char get_buf[BUFMAX ];static int get_buf_cnt;static char put_buf[BUFMAX ];
@@ -1102,7 +1102,7 @@ static void kgdbts_post_exp_handler(void)module_put (THIS_MODULE ); } -static struct kgdb_io kgdbts_io_ops = { +static const struct kgdb_io kgdbts_io_ops = { .name ="kgdbts" , .read_char = kgdbts_get_char, .write_char = kgdbts_put_char,
drivers/serial/kgdboc.c +2 -2
@@ -18,7 +18,7 @@#define MAX_CONFIG_LEN 40 -static struct kgdb_io kgdboc_io_ops; +static const struct kgdb_io kgdboc_io_ops;/* -1 = init not run yet, 0 = unconfigured, 1 = configured. */ static int configured =-1 ;
@@ -154,7 +154,7 @@ static void kgdboc_post_exp_handler(void)module_put (THIS_MODULE ); } -static struct kgdb_io kgdboc_io_ops = { +static const struct kgdb_io kgdboc_io_ops = { .name ="kgdboc" , .read_char = kgdboc_get_char, .write_char = kgdboc_put_char,
include/linux/kgdb.h +9 -9
@@ -251,20 +251,20 @@ struct kgdb_arch {*/ struct kgdb_io {const char *name; -int (*read_char) (void ); -void (*write_char) (u8 ); -void (*flush) (void ); -int (*init) (void ); -void (*pre_exception) (void ); -void (*post_exception) (void ); +int (*const read_char) (void ); +void (*const write_char) (u8 ); +void (*const flush) (void ); +int (*const init) (void ); +void (*const pre_exception) (void ); +void (*const post_exception) (void ); }; -extern struct kgdb_arch arch_kgdb_ops; +extern struct kgdb_arch arch_kgdb_ops;extern unsigned long __weak kgdb_arch_pc (int exception,struct pt_regs *regs); -extern int kgdb_register_io_module (struct kgdb_io *local_kgdb_io_ops); -extern void kgdb_unregister_io_module (struct kgdb_io *local_kgdb_io_ops); +extern int kgdb_register_io_module (const struct kgdb_io *local_kgdb_io_ops); +extern void kgdb_unregister_io_module (const struct kgdb_io *local_kgdb_io_ops);extern int kgdb_hex2long (char **ptr,unsigned long *long_val);extern int kgdb_mem2hex (char *mem,char *buf,int count);
kernel/kgdb.c +3 -3
@@ -86,7 +86,7 @@ static int kgdb_io_module_registered;/* Guard for recursive entry */ static int exception_level; -static struct kgdb_io *kgdb_io_ops; +static const struct kgdb_io *kgdb_io_ops;static DEFINE_SPINLOCK (kgdb_registration_lock);/* kgdb console driver is loaded */
@@ -1637,7 +1637,7 @@ static void kgdb_initial_breakpoint(void)* * Register it with the KGDB core. */ -int kgdb_register_io_module (struct kgdb_io *new_kgdb_io_ops) +int kgdb_register_io_module (const struct kgdb_io *new_kgdb_io_ops) {int err;
@@ -1682,7 +1682,7 @@ EXPORT_SYMBOL_GPL(kgdb_register_io_module);* * Unregister it with the KGDB core. */ -void kgdb_unregister_io_module (struct kgdb_io *old_kgdb_io_ops) +void kgdb_unregister_io_module (const struct kgdb_io *old_kgdb_io_ops) {BUG_ON (kgdb_connected);
PATCH 18/31 Constify struct kset_uevent_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct kset_uevent_ops.
--- drivers/base/bus.c | 2 +- drivers/base/core.c | 2 +- drivers/base/memory.c | 2 +- fs/gfs2/sys.c | 2 +- include/linux/kobject.h | 10 +++++----- kernel/params.c | 2 +- lib/kobject.c | 4 ++-- lib/kobject_uevent.c | 2 +- mm/slub.c | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-)
drivers/base/bus.c +1 -1
@@ -154,7 +154,7 @@ static int bus_uevent_filter(struct kset *kset, struct kobject *kobj)return 0 ; } -static struct kset_uevent_ops bus_uevent_ops = { +static const struct kset_uevent_ops bus_uevent_ops = { .filter = bus_uevent_filter, };
drivers/base/core.c +1 -1
@@ -245,7 +245,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,return retval; } -static struct kset_uevent_ops device_uevent_ops = { +static const struct kset_uevent_ops device_uevent_ops = { .filter = dev_uevent_filter, .name = dev_uevent_name, .uevent = dev_uevent,
drivers/base/memory.c +1 -1
@@ -44,7 +44,7 @@ static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uevreturn retval; } -static struct kset_uevent_ops memory_uevent_ops = { +static const struct kset_uevent_ops memory_uevent_ops = { .name = memory_uevent_name, .uevent = memory_uevent, };
fs/gfs2/sys.c +1 -1
@@ -584,7 +584,7 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,return 0 ; } -static struct kset_uevent_ops gfs2_uevent_ops = { +static const struct kset_uevent_ops gfs2_uevent_ops = { .uevent = gfs2_uevent, };
include/linux/kobject.h +5 -5
@@ -118,9 +118,9 @@ struct kobj_uevent_env { };struct kset_uevent_ops { -int (*filter)(struct kset *kset,struct kobject *kobj); -const char *(*name)(struct kset *kset,struct kobject *kobj); -int (*uevent)(struct kset *kset,struct kobject *kobj, +int (*const filter)(struct kset *kset,struct kobject *kobj); +const char *(*const name)(struct kset *kset,struct kobject *kobj); +int (*const uevent)(struct kset *kset,struct kobject *kobj,struct kobj_uevent_env *env); };
@@ -155,14 +155,14 @@ struct kset {struct list_head list;spinlock_t list_lock;struct kobject kobj; -struct kset_uevent_ops *uevent_ops; +const struct kset_uevent_ops *uevent_ops; };extern void kset_init (struct kset *kset);extern int __must_check kset_register (struct kset *kset);extern void kset_unregister (struct kset *kset);extern struct kset *__must_check kset_create_and_add (const char *name, -struct kset_uevent_ops *u, +const struct kset_uevent_ops *u,struct kobject *parent_kobj);static inline struct kset *to_kset (struct kobject *kobj)
kernel/params.c +1 -1
@@ -739,7 +739,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)return 0 ; } -static struct kset_uevent_ops module_uevent_ops = { +static const struct kset_uevent_ops module_uevent_ops = { .filter = uevent_filter, };
lib/kobject.c +2 -2
@@ -789,7 +789,7 @@ static struct kobj_type kset_ktype = {* If the kset was not able to be created, NULL will be returned. */ static struct kset *kset_create (const char *name, -struct kset_uevent_ops *uevent_ops, +const struct kset_uevent_ops *uevent_ops,struct kobject *parent_kobj) {struct kset *kset;
@@ -832,7 +832,7 @@ static struct kset *kset_create(const char *name,* If the kset was not able to be created, NULL will be returned. */ struct kset *kset_create_and_add (const char *name, -struct kset_uevent_ops *uevent_ops, +const struct kset_uevent_ops *uevent_ops,struct kobject *parent_kobj) {struct kset *kset;
lib/kobject_uevent.c +1 -1
@@ -95,7 +95,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,const char *subsystem;struct kobject *top_kobj;struct kset *kset; -struct kset_uevent_ops *uevent_ops; +const struct kset_uevent_ops *uevent_ops;u64 seq;int i =0 ;int retval =0 ;
mm/slub.c +1 -1
@@ -4522,7 +4522,7 @@ static int uevent_filter(struct kset *kset, struct kobject *kobj)return 0 ; } -static struct kset_uevent_ops slab_uevent_ops = { +static const struct kset_uevent_ops slab_uevent_ops = { .filter = uevent_filter, };
PATCH 19/31 Constify struct lock_manager_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct lock_manager_operations.
--- include/linux/fs.h | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
include/linux/fs.h +8 -8
@@ -1032,14 +1032,14 @@ struct file_lock_operations { };struct lock_manager_operations { -int (*fl_compare_owner)(struct file_lock *,struct file_lock *); -void (*fl_notify)(struct file_lock *);/* unblock callback */ -int (*fl_grant)(struct file_lock *,struct file_lock *,int ); -void (*fl_copy_lock)(struct file_lock *,struct file_lock *); -void (*fl_release_private)(struct file_lock *); -void (*fl_break)(struct file_lock *); -int (*fl_mylease)(struct file_lock *,struct file_lock *); -int (*fl_change)(struct file_lock **,int ); +int (*const fl_compare_owner)(struct file_lock *,struct file_lock *); +void (*const fl_notify)(struct file_lock *);/* unblock callback */ +int (*const fl_grant)(struct file_lock *,struct file_lock *,int ); +void (*const fl_copy_lock)(struct file_lock *,struct file_lock *); +void (*const fl_release_private)(struct file_lock *); +void (*const fl_break)(struct file_lock *); +int (*const fl_mylease)(struct file_lock *,struct file_lock *); +int (*const fl_change)(struct file_lock **,int ); };struct lock_manager {
PATCH 20/31 Constify struct microcode_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct microcode_ops.
--- arch/x86/include/asm/microcode.h | 14 +++++++------- arch/x86/kernel/microcode_amd.c | 4 ++-- arch/x86/kernel/microcode_core.c | 2 +- arch/x86/kernel/microcode_intel.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-)
arch/x86/include/asm/microcode.h +7 -7
@@ -12,13 +12,13 @@ struct device;enum ucode_state {UCODE_ERROR ,UCODE_OK ,UCODE_NFOUND };struct microcode_ops { -enum ucode_state (*request_microcode_user) (int cpu, +enum ucode_state (*const request_microcode_user) (int cpu,const void __user *buf,size_t size); -enum ucode_state (*request_microcode_fw) (int cpu, +enum ucode_state (*const request_microcode_fw) (int cpu,struct device *device); -void (*microcode_fini_cpu) (int cpu); +void (*const microcode_fini_cpu) (int cpu);/* * The generic 'microcode_core' part guarantees that
@@ -38,18 +38,18 @@ struct ucode_cpu_info {extern struct ucode_cpu_info ucode_cpu_info[];#ifdef CONFIG_MICROCODE_INTEL -extern struct microcode_ops *__init init_intel_microcode (void ); +extern const struct microcode_ops *__init init_intel_microcode (void );#else -static inline struct microcode_ops *__init init_intel_microcode (void ) +static inline const struct microcode_ops *__init init_intel_microcode (void ) {return NULL ; }#endif /* CONFIG_MICROCODE_INTEL */ #ifdef CONFIG_MICROCODE_AMD -extern struct microcode_ops *__init init_amd_microcode (void ); +extern const struct microcode_ops *__init init_amd_microcode (void );#else -static inline struct microcode_ops *__init init_amd_microcode (void ) +static inline const struct microcode_ops *__init init_amd_microcode (void ) {return NULL ; }
arch/x86/kernel/microcode_amd.c +2 -2
@@ -346,7 +346,7 @@ static void microcode_fini_cpu_amd(int cpu) uci->mc =NULL ; } -static struct microcode_ops microcode_amd_ops = { +static const struct microcode_ops microcode_amd_ops = { .request_microcode_user = request_microcode_user, .request_microcode_fw = request_microcode_fw, .collect_cpu_info = collect_cpu_info_amd,
@@ -354,7 +354,7 @@ static struct microcode_ops microcode_amd_ops = { .microcode_fini_cpu = microcode_fini_cpu_amd, }; -struct microcode_ops *__init init_amd_microcode (void ) +const struct microcode_ops *__init init_amd_microcode (void ) {return µcode_amd_ops; }
arch/x86/kernel/microcode_core.c +1 -1
@@ -90,7 +90,7 @@ MODULE_LICENSE("GPL");#define MICROCODE_VERSION "2.00" -static struct microcode_ops *microcode_ops; +static const struct microcode_ops *microcode_ops;/* * Synchronization.
arch/x86/kernel/microcode_intel.c +2 -2
@@ -460,7 +460,7 @@ static void microcode_fini_cpu(int cpu) uci->mc =NULL ; } -static struct microcode_ops microcode_intel_ops = { +static const struct microcode_ops microcode_intel_ops = { .request_microcode_user = request_microcode_user, .request_microcode_fw = request_microcode_fw, .collect_cpu_info = collect_cpu_info,
@@ -468,7 +468,7 @@ static struct microcode_ops microcode_intel_ops = { .microcode_fini_cpu = microcode_fini_cpu, }; -struct microcode_ops *__init init_intel_microcode (void ) +const struct microcode_ops *__init init_intel_microcode (void ) {return µcode_intel_ops; }
PATCH 21/31 Constify struct mtrr_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct mtrr_ops.
--- arch/x86/kernel/cpu/mtrr/amd.c | 2 +- arch/x86/kernel/cpu/mtrr/centaur.c | 2 +- arch/x86/kernel/cpu/mtrr/cyrix.c | 2 +- arch/x86/kernel/cpu/mtrr/generic.c | 2 +- arch/x86/kernel/cpu/mtrr/main.c | 6 +++--- arch/x86/kernel/cpu/mtrr/mtrr.h | 22 +++++++++++----------- 6 files changed, 18 insertions(+), 18 deletions(-)
arch/x86/kernel/cpu/mtrr/amd.c +1 -1
@@ -108,7 +108,7 @@ amd_validate_add_page(unsigned long base, unsigned long size, unsigned int type)return 0 ; } -static struct mtrr_ops amd_mtrr_ops = { +static const struct mtrr_ops amd_mtrr_ops = { .vendor =X86_VENDOR_AMD , .set = amd_set_mtrr, .get = amd_get_mtrr,
arch/x86/kernel/cpu/mtrr/centaur.c +1 -1
@@ -110,7 +110,7 @@ centaur_validate_add_page(unsigned long base, unsigned long size, unsigned int treturn 0 ; } -static struct mtrr_ops centaur_mtrr_ops = { +static const struct mtrr_ops centaur_mtrr_ops = { .vendor =X86_VENDOR_CENTAUR , .set = centaur_set_mcr, .get = centaur_get_mcr,
arch/x86/kernel/cpu/mtrr/cyrix.c +1 -1
@@ -265,7 +265,7 @@ static void cyrix_set_all(void)post_set (); } -static struct mtrr_ops cyrix_mtrr_ops = { +static const struct mtrr_ops cyrix_mtrr_ops = { .vendor =X86_VENDOR_CYRIX , .set_all = cyrix_set_all, .set = cyrix_set_arr,
arch/x86/kernel/cpu/mtrr/generic.c +1 -1
@@ -752,7 +752,7 @@ int positive_have_wrcomb(void)/* * Generic structure... */ -struct mtrr_ops generic_mtrr_ops = { +const struct mtrr_ops generic_mtrr_ops = { .use_intel_if =1 , .set_all = generic_set_all, .get = generic_get_mtrr,
arch/x86/kernel/cpu/mtrr/main.c +3 -3
@@ -60,14 +60,14 @@ static DEFINE_MUTEX(mtrr_mutex);u64 size_or_mask, size_and_mask;static bool mtrr_aps_delayed_init; -static struct mtrr_ops *mtrr_ops[X86_VENDOR_NUM ]; +static const struct mtrr_ops *mtrr_ops[X86_VENDOR_NUM ]; -struct mtrr_ops *mtrr_if; +const struct mtrr_ops *mtrr_if;static void set_mtrr (unsigned int reg,unsigned long base,unsigned long size,mtrr_type type); -void set_mtrr_ops (struct mtrr_ops *ops) +void set_mtrr_ops (const struct mtrr_ops *ops) {if (ops->vendor && ops->vendor <X86_VENDOR_NUM ) mtrr_ops[ops->vendor] = ops;
arch/x86/kernel/cpu/mtrr/mtrr.h +11 -11
@@ -12,19 +12,19 @@extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES ];struct mtrr_ops { -u32 vendor; -u32 use_intel_if; -void (*set)(unsigned int reg,unsigned long base, +const u32 vendor; +const u32 use_intel_if; +void (*const set)(unsigned int reg,unsigned long base,unsigned long size,mtrr_type type); -void (*set_all)(void ); +void (*const set_all)(void ); -void (*get)(unsigned int reg,unsigned long *base, +void (*const get)(unsigned int reg,unsigned long *base,unsigned long *size,mtrr_type *type); -int (*get_free_region)(unsigned long base,unsigned long size, +int (*const get_free_region)(unsigned long base,unsigned long size,int replace_reg); -int (*validate_add_page)(unsigned long base,unsigned long size, +int (*const validate_add_page)(unsigned long base,unsigned long size,unsigned int type); -int (*have_wrcomb)(void ); +int (*const have_wrcomb)(void ); }; extern int generic_get_free_region(unsigned long base, unsigned long size,
@@ -32,7 +32,7 @@ extern int generic_get_free_region(unsigned long base, unsigned long size,extern int generic_validate_add_page (unsigned long base,unsigned long size,unsigned int type); -extern struct mtrr_ops generic_mtrr_ops; +extern const struct mtrr_ops generic_mtrr_ops;extern int positive_have_wrcomb (void );
@@ -53,10 +53,10 @@ void fill_mtrr_var_range(unsigned int index, u32 base_lo, u32 base_hi, u32 mask_lo, u32 mask_hi);void get_mtrr_state (void ); -extern void set_mtrr_ops (struct mtrr_ops *ops); +extern void set_mtrr_ops (const struct mtrr_ops *ops);extern u64 size_or_mask, size_and_mask; -extern struct mtrr_ops *mtrr_if; +extern const struct mtrr_ops *mtrr_if;#define is_cpu (vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)#define use_intel () (mtrr_if && mtrr_if->use_intel_if == 1)
PATCH 22/31 Constify struct neigh_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct neigh_ops.
--- include/net/neighbour.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
include/net/neighbour.h +6 -6
@@ -125,12 +125,12 @@ struct neighbourstruct neigh_ops {int family; -void (*solicit)(struct neighbour *,struct sk_buff *); -void (*error_report)(struct neighbour *,struct sk_buff *); -int (*output)(struct sk_buff *); -int (*connected_output)(struct sk_buff *); -int (*hh_output)(struct sk_buff *); -int (*queue_xmit)(struct sk_buff *); +void (*const solicit)(struct neighbour *,struct sk_buff *); +void (*const error_report)(struct neighbour *,struct sk_buff *); +int (*const output)(struct sk_buff *); +int (*const connected_output)(struct sk_buff *); +int (*const hh_output)(struct sk_buff *); +int (*const queue_xmit)(struct sk_buff *); };struct pneigh_entry
PATCH 23/31 Constify struct nlmsvc_binding for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct nlmsvc_binding.
--- fs/lockd/svc.c | 2 +- fs/nfsd/lockd.c | 2 +- include/linux/lockd/bind.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
fs/lockd/svc.c +1 -1
@@ -43,7 +43,7 @@static struct svc_program nlmsvc_program; -struct nlmsvc_binding * nlmsvc_ops; +const struct nlmsvc_binding * nlmsvc_ops;EXPORT_SYMBOL_GPL (nlmsvc_ops);static DEFINE_MUTEX (nlmsvc_mutex);
fs/nfsd/lockd.c +1 -1
@@ -67,7 +67,7 @@ nlm_fclose(struct file *filp)fput (filp); } -static struct nlmsvc_binding nfsd_nlm_ops = { +static const struct nlmsvc_binding nfsd_nlm_ops = { .fopen = nlm_fopen,/* open file for locking */ .fclose = nlm_fclose,/* close file */ };
include/linux/lockd/bind.h +3 -3
@@ -23,13 +23,13 @@ struct svc_rqst;* This is the set of functions for lockd->nfsd communication */ struct nlmsvc_binding { -__be32 (*fopen)(struct svc_rqst *, +__be32 (*const fopen)(struct svc_rqst *,struct nfs_fh *,struct file **); -void (*fclose)(struct file *); +void (*const fclose)(struct file *); }; -extern struct nlmsvc_binding * nlmsvc_ops; +extern const struct nlmsvc_binding * nlmsvc_ops;/* * Similar to nfs_client_initdata, but without the NFS-specific
Re: [PATCH 06/31] Constify struct e1000_mac_operations for 2.6.32 v1
In reply to Emese RevfyQuoted 5 lines · Emese Revfy
From: Emese Revfy <[email protected]>
Constify struct
e1000_mac_operationswith some exceptions.Signed-off-by Emese Revfy <[email protected]>
Any networking patches need to be sent to the netdev list and Dave Miller. I've added those to the CC, and will do the same for the other two e1000 patches in your series.
Cheers,
-PJ
Quoted 105 lines
--- drivers/net/e1000e/82571.c | 3 ++- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 3 ++- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-)drivers/net/e1000e/82571.c +2
-1@@ -212,6 +212,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;u32 swsm =0 ;u32 swsm2 =0 ;@@ -1656,7 +1657,7 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations e82571_mac_ops = { +static const struct e1000_mac_operations e82571_mac_ops = {/* .check_mng_mode: mac type dependent */ /* .check_for_link: media type dependent */ .id_led_init = e1000e_id_led_init,drivers/net/e1000e/e1000.h +1
-1@@ -375,7 +375,7 @@ struct e1000_info {u32 pba;u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };drivers/net/e1000e/es2lan.c +2
-1@@ -207,6 +207,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;/* Set media type */ @@ -1365,7 +1366,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations es2_mac_ops = { +static const struct e1000_mac_operations es2_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000e_check_mng_mode_generic,/* check_for_link dependent on media type */ drivers/net/e1000e/ich8lan.c +1
-1@@ -3451,7 +3451,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) } } -static struct e1000_mac_operations ich8_mac_ops = { +static const struct e1000_mac_operations ich8_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000_check_mng_mode_ich8lan, .check_for_link = e1000_check_for_copper_link_ich8lan,drivers/net/igb/e1000_82575.c +1
-1@@ -1400,7 +1400,7 @@ void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable)wr32 (E1000_VT_CTL , vt_ctl); } -static struct e1000_mac_operations e1000_mac_ops_82575 = { +static const struct e1000_mac_operations e1000_mac_ops_82575 = { .reset_hw = igb_reset_hw_82575, .init_hw = igb_init_hw_82575, .check_for_link = igb_check_for_link_82575,drivers/net/igb/e1000_hw.h +1
-1@@ -310,7 +310,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
PATCH 24/31 Constify struct pci_raw_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct pci_raw_ops.
--- arch/x86/include/asm/pci_x86.h | 10 +++++----- arch/x86/pci/common.c | 4 ++-- arch/x86/pci/direct.c | 6 +++--- arch/x86/pci/mmconfig_32.c | 2 +- arch/x86/pci/mmconfig_64.c | 2 +- arch/x86/pci/numaq_32.c | 2 +- arch/x86/pci/olpc.c | 2 +- arch/x86/pci/pcbios.c | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-)
arch/x86/include/asm/pci_x86.h +5 -5
@@ -89,16 +89,16 @@ extern int (*pcibios_enable_irq)(struct pci_dev *dev);extern void (*pcibios_disable_irq)(struct pci_dev *dev);struct pci_raw_ops { -int (*read)(unsigned int domain,unsigned int bus,unsigned int devfn, +int (*const read)(unsigned int domain,unsigned int bus,unsigned int devfn,int reg,int len,u32 *val); -int (*write)(unsigned int domain,unsigned int bus,unsigned int devfn, +int (*const write)(unsigned int domain,unsigned int bus,unsigned int devfn,int reg,int len,u32 val); }; -extern struct pci_raw_ops *raw_pci_ops; -extern struct pci_raw_ops *raw_pci_ext_ops; +extern const struct pci_raw_ops *raw_pci_ops; +extern const struct pci_raw_ops *raw_pci_ext_ops; -extern struct pci_raw_ops pci_direct_conf1; +extern const struct pci_raw_ops pci_direct_conf1;extern bool port_cf9_safe;/* arch_initcall level */
arch/x86/pci/common.c +2 -2
@@ -31,8 +31,8 @@ int noioapicreroute = 1;int pcibios_last_bus =-1 ;unsigned long pirq_table_addr;struct pci_bus *pci_root_bus; -struct pci_raw_ops *raw_pci_ops; -struct pci_raw_ops *raw_pci_ext_ops; +const struct pci_raw_ops *raw_pci_ops; +const struct pci_raw_ops *raw_pci_ext_ops;int raw_pci_read (unsigned int domain,unsigned int bus,unsigned int devfn,int reg,int len,u32 *val)
arch/x86/pci/direct.c +3 -3
@@ -79,7 +79,7 @@ static int pci_conf1_write(unsigned int seg, unsigned int bus,#undef PCI_CONF1_ADDRESS -struct pci_raw_ops pci_direct_conf1 = { +const struct pci_raw_ops pci_direct_conf1 = { .read = pci_conf1_read, .write = pci_conf1_write, };
@@ -173,7 +173,7 @@ static int pci_conf2_write(unsigned int seg, unsigned int bus,#undef PCI_CONF2_ADDRESS -struct pci_raw_ops pci_direct_conf2 = { +const struct pci_raw_ops pci_direct_conf2 = { .read = pci_conf2_read, .write = pci_conf2_write, };
@@ -189,7 +189,7 @@ struct pci_raw_ops pci_direct_conf2 = {* This should be close to trivial, but it isn't, because there are buggy * chipsets (yes, you guessed it, by Intel and Compaq) that have no class ID. */ -static int __init pci_sanity_check (struct pci_raw_ops *o) +static int __init pci_sanity_check (const struct pci_raw_ops *o) {u32 x =0 ;int year, devfn;
arch/x86/pci/mmconfig_32.c +1 -1
@@ -125,7 +125,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,return 0 ; } -static struct pci_raw_ops pci_mmcfg = { +static const struct pci_raw_ops pci_mmcfg = { .read = pci_mmcfg_read, .write = pci_mmcfg_write, };
arch/x86/pci/mmconfig_64.c +1 -1
@@ -104,7 +104,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,return 0 ; } -static struct pci_raw_ops pci_mmcfg = { +static const struct pci_raw_ops pci_mmcfg = { .read = pci_mmcfg_read, .write = pci_mmcfg_write, };
arch/x86/pci/numaq_32.c +1 -1
@@ -112,7 +112,7 @@ static int pci_conf1_mq_write(unsigned int seg, unsigned int bus,#undef PCI_CONF1_MQ_ADDRESS -static struct pci_raw_ops pci_direct_conf1_mq = { +static const struct pci_raw_ops pci_direct_conf1_mq = { .read = pci_conf1_mq_read, .write = pci_conf1_mq_write };
arch/x86/pci/olpc.c +1 -1
@@ -297,7 +297,7 @@ static int pci_olpc_write(unsigned int seg, unsigned int bus,return 0 ; } -static struct pci_raw_ops pci_olpc_conf = { +static const struct pci_raw_ops pci_olpc_conf = { .read = pci_olpc_read, .write = pci_olpc_write, };
arch/x86/pci/pcbios.c +2 -2
@@ -278,7 +278,7 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,* Function table for BIOS32 access */ -static struct pci_raw_ops pci_bios_access = { +static const struct pci_raw_ops pci_bios_access = { .read = pci_bios_read, .write = pci_bios_write };
@@ -287,7 +287,7 @@ static struct pci_raw_ops pci_bios_access = {* Try to find PCI BIOS. */ -static struct pci_raw_ops *__devinit pci_find_bios (void ) +static const struct pci_raw_ops *__devinit pci_find_bios (void ) {union bios32 *check;unsigned char sum;
Re: [PATCH 07/31] Constify struct e1000_nvm_operations for 2.6.32 v1
In reply to Emese RevfyQuoted 5 lines · Emese Revfy
From: Emese Revfy <[email protected]>
Constify struct
e1000_nvm_operations.Signed-off-by Emese Revfy <[email protected]>
Added Dave Miller and netdev.
Quoted 147 lines
--- drivers/net/e1000e/82571.c | 2 +- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/hw.h | 16 ++++++++-------- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 12 ++++++------ 7 files changed, 19 insertions(+), 19 deletions(-)drivers/net/e1000e/82571.c +1
-1@@ -1725,7 +1725,7 @@ static struct e1000_phy_operations e82_phy_ops_bm = { .cfg_on_link_up = NULL, }; -static struct e1000_nvm_operations e82571_nvm_ops = { +static const struct e1000_nvm_operations e82571_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_82571, .read_nvm = e1000e_read_nvm_eerd, .release_nvm = e1000_release_nvm_82571,drivers/net/e1000e/e1000.h +1
-1@@ -377,7 +377,7 @@ struct e1000_info {s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops; -struct e1000_nvm_operations *nvm_ops; +const struct e1000_nvm_operations *nvm_ops; };/* hardware capability, feature, and workaround flags */ drivers/net/e1000e/es2lan.c +1
-1@@ -1400,7 +1400,7 @@ static struct e1000_phy_operations es2_phy_ops = { .cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan, }; -static struct e1000_nvm_operations es2_nvm_ops = { +static const struct e1000_nvm_operations es2_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_80003es2lan, .read_nvm = e1000e_read_nvm_eerd, .release_nvm = e1000_release_nvm_80003es2lan,drivers/net/e1000e/hw.h +8
-8@@ -776,13 +776,13 @@ struct e1000_phy_operations {/* Function pointers for the NVM. */ struct e1000_nvm_operations { -s32 (*acquire_nvm)(struct e1000_hw *); -s32 (*read_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); -void (*release_nvm)(struct e1000_hw *); -s32 (*update_nvm)(struct e1000_hw *); -s32 (*valid_led_default)(struct e1000_hw *,u16 *); -s32 (*validate_nvm)(struct e1000_hw *); -s32 (*write_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); +s32 (*const acquire_nvm)(struct e1000_hw *); +s32 (*const read_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); +void (*const release_nvm)(struct e1000_hw *); +s32 (*const update_nvm)(struct e1000_hw *); +s32 (*const valid_led_default)(struct e1000_hw *,u16 *); +s32 (*const validate_nvm)(struct e1000_hw *); +s32 (*const write_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); };struct e1000_mac_info {@@ -856,7 +856,7 @@ struct e1000_phy_info { };struct e1000_nvm_info { -struct e1000_nvm_operations ops; +const struct e1000_nvm_operations ops;enum e1000_nvm_type type;enum e1000_nvm_override override;drivers/net/e1000e/ich8lan.c +1
-1@@ -3485,7 +3485,7 @@ static struct e1000_phy_operations ich8_phy_ops = { .write_phy_reg = e1000e_write_phy_reg_igp, }; -static struct e1000_nvm_operations ich8_nvm_ops = { +static const struct e1000_nvm_operations ich8_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_ich8lan, .read_nvm = e1000_read_nvm_ich8lan, .release_nvm = e1000_release_nvm_ich8lan,drivers/net/igb/e1000_82575.c +1
-1@@ -1415,7 +1415,7 @@ static struct e1000_phy_operations e1000_phy_ops_82575 = { .release = igb_release_phy_82575, }; -static struct e1000_nvm_operations e1000_nvm_ops_82575 = { +static const struct e1000_nvm_operations e1000_nvm_ops_82575 = { .acquire = igb_acquire_nvm_82575, .read = igb_read_nvm_eerd, .release = igb_release_nvm_82575,drivers/net/igb/e1000_hw.h +6
-6@@ -302,17 +302,17 @@ struct e1000_phy_operations { };struct e1000_nvm_operations { -s32 (*acquire)(struct e1000_hw *); -s32 (*read)(struct e1000_hw *,u16 ,u16 ,u16 *); -void (*release)(struct e1000_hw *); -s32 (*write)(struct e1000_hw *,u16 ,u16 ,u16 *); +s32 (*const acquire)(struct e1000_hw *); +s32 (*const read)(struct e1000_hw *,u16 ,u16 ,u16 *); +void (*const release)(struct e1000_hw *); +s32 (*const write)(struct e1000_hw *,u16 ,u16 ,u16 *); };struct e1000_info {s32 (*get_invariants)(struct e1000_hw *);struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops; -struct e1000_nvm_operations *nvm_ops; +const struct e1000_nvm_operations *nvm_ops; };extern const struct e1000_info e1000_82575_info;@@ -397,7 +397,7 @@ struct e1000_phy_info { };struct e1000_nvm_info { -struct e1000_nvm_operations ops; +const struct e1000_nvm_operations ops;enum e1000_nvm_type type;enum e1000_nvm_override override;
Re: [PATCH 08/31] Constify struct e1000_phy_operations for 2.6.32 v1
In reply to Emese RevfyQuoted 5 lines · Emese Revfy
From: Emese Revfy <[email protected]>
Constify struct
e1000_phy_operations.Signed-off-by Emese Revfy <[email protected]>
Added Dave Miller and netdev.
Quoted 106 lines
--- drivers/net/e1000e/82571.c | 6 +++--- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)drivers/net/e1000e/82571.c +3
-3@@ -1674,7 +1674,7 @@ static struct e1000_mac_operations e82571_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations e82_phy_ops_igp = { +static const struct e1000_phy_operations e82_phy_ops_igp = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy =NULL ,@@ -1691,7 +1691,7 @@ static struct e1000_phy_operations e82_phy_ops_igp = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_m88 = { +static const struct e1000_phy_operations e82_phy_ops_m88 = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,@@ -1708,7 +1708,7 @@ static struct e1000_phy_operations e82_phy_ops_m88 = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_bm = { +static const struct e1000_phy_operations e82_phy_ops_bm = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,drivers/net/e1000e/e1000.h +1
-1@@ -376,7 +376,7 @@ struct e1000_info {u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };drivers/net/e1000e/es2lan.c +1
-1@@ -1383,7 +1383,7 @@ static struct e1000_mac_operations es2_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations es2_phy_ops = { +static const struct e1000_phy_operations es2_phy_ops = { .acquire_phy = e1000_acquire_phy_80003es2lan, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,drivers/net/e1000e/ich8lan.c +1
-1@@ -3469,7 +3469,7 @@ static struct e1000_mac_operations ich8_mac_ops = {/* id_led_init dependent on mac type */ }; -static struct e1000_phy_operations ich8_phy_ops = { +static const struct e1000_phy_operations ich8_phy_ops = { .acquire_phy = e1000_acquire_swflag_ich8lan, .check_reset_block = e1000_check_reset_block_ich8lan, .commit_phy =NULL ,drivers/net/igb/e1000_82575.c +1
-1@@ -1409,7 +1409,7 @@ static struct e1000_mac_operations e1000_mac_ops_82575 = { .get_speed_and_duplex = igb_get_speed_and_duplex_copper, }; -static struct e1000_phy_operations e1000_phy_ops_82575 = { +static const struct e1000_phy_operations e1000_phy_ops_82575 = { .acquire = igb_acquire_phy_82575, .get_cfg_done = igb_get_cfg_done_82575, .release = igb_release_phy_82575,drivers/net/igb/e1000_hw.h +1
-1@@ -311,7 +311,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
PATCH 25/31 Constify struct platform_hibernation_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct platform_hibernation_ops.
--- drivers/acpi/sleep.c | 4 ++-- include/linux/suspend.h | 24 ++++++++++++------------ kernel/power/hibernate.c | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-)
drivers/acpi/sleep.c +2 -2
@@ -552,7 +552,7 @@ static void acpi_pm_enable_gpes(void)acpi_enable_all_runtime_gpes (); } -static struct platform_hibernation_ops acpi_hibernation_ops = { +static const struct platform_hibernation_ops acpi_hibernation_ops = { .begin = acpi_hibernation_begin, .end = acpi_pm_end, .pre_snapshot = acpi_hibernation_pre_snapshot,
@@ -605,7 +605,7 @@ static int acpi_hibernation_pre_snapshot_old(void)* The following callbacks are used if the pre-ACPI 2.0 suspend ordering has * been requested. */ -static struct platform_hibernation_ops acpi_hibernation_ops_old = { +static const struct platform_hibernation_ops acpi_hibernation_ops_old = { .begin = acpi_hibernation_begin_old, .end = acpi_pm_end, .pre_snapshot = acpi_hibernation_pre_snapshot_old,
include/linux/suspend.h +12 -12
@@ -215,16 +215,16 @@ extern void mark_free_pages(struct zone *zone);* platforms which require special recovery actions in that situation. */ struct platform_hibernation_ops { -int (*begin)(void ); -void (*end)(void ); -int (*pre_snapshot)(void ); -void (*finish)(void ); -int (*prepare)(void ); -int (*enter)(void ); -void (*leave)(void ); -int (*pre_restore)(void ); -void (*restore_cleanup)(void ); -void (*recover)(void ); +int (*const begin)(void ); +void (*const end)(void ); +int (*const pre_snapshot)(void ); +void (*const finish)(void ); +int (*const prepare)(void ); +int (*const enter)(void ); +void (*const leave)(void ); +int (*const pre_restore)(void ); +void (*const restore_cleanup)(void ); +void (*const recover)(void ); };#ifdef CONFIG_HIBERNATION
@@ -243,7 +243,7 @@ extern void swsusp_set_page_free(struct page *);extern void swsusp_unset_page_free (struct page *);extern unsigned long get_safe_page (gfp_t gfp_mask); -extern void hibernation_set_ops (struct platform_hibernation_ops *ops); +extern void hibernation_set_ops (const struct platform_hibernation_ops *ops);extern int hibernate (void );extern bool system_entering_hibernation (void );#else /* CONFIG_HIBERNATION */
@@ -251,7 +251,7 @@ static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }static inline void swsusp_set_page_free (struct page *p) {}static inline void swsusp_unset_page_free (struct page *p) {} -static inline void hibernation_set_ops (struct platform_hibernation_ops *ops) {} +static inline void hibernation_set_ops (const struct platform_hibernation_ops *ops) {}static inline int hibernate (void ) {return -ENOSYS ; }static inline bool system_entering_hibernation (void ) {return false; }#endif /* CONFIG_HIBERNATION */
kernel/power/hibernate.c +2 -2
@@ -48,14 +48,14 @@ enum {static int hibernation_mode =HIBERNATION_SHUTDOWN ; -static struct platform_hibernation_ops *hibernation_ops; +static const struct platform_hibernation_ops *hibernation_ops;/** * hibernation_set_ops - set the global hibernate operations * @ops: the hibernation operations to use in subsequent hibernation transitions */ -void hibernation_set_ops (struct platform_hibernation_ops *ops) +void hibernation_set_ops (const struct platform_hibernation_ops *ops) { if (ops && !(ops->begin && ops->end && ops->pre_snapshot && ops->prepare && ops->finish && ops->enter && ops->pre_restore
PATCH 27/31 Constify struct snd_ac97_build_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct snd_ac97_build_ops.
--- include/sound/ac97_codec.h | 16 +++++----- sound/pci/ac97/ac97_codec.c | 2 +- sound/pci/ac97/ac97_patch.c | 64 +++++++++++++++++++++--------------------- 3 files changed, 41 insertions(+), 41 deletions(-)
include/sound/ac97_codec.h +8 -8
@@ -419,15 +419,15 @@struct snd_ac97 ;struct snd_ac97_build_ops { -int (*build_3d) (struct snd_ac97 *ac97); -int (*build_specific) (struct snd_ac97 *ac97); -int (*build_spdif) (struct snd_ac97 *ac97); -int (*build_post_spdif) (struct snd_ac97 *ac97); +int (*const build_3d) (struct snd_ac97 *ac97); +int (*const build_specific) (struct snd_ac97 *ac97); +int (*const build_spdif) (struct snd_ac97 *ac97); +int (*const build_post_spdif) (struct snd_ac97 *ac97);#ifdef CONFIG_PM -void (*suspend) (struct snd_ac97 *ac97); -void (*resume) (struct snd_ac97 *ac97); +void (*const suspend) (struct snd_ac97 *ac97); +void (*const resume) (struct snd_ac97 *ac97);#endif -void (*update_jacks) (struct snd_ac97 *ac97);/* for jack-sharing */ +void (*const update_jacks) (struct snd_ac97 *ac97);/* for jack-sharing */ };struct snd_ac97_bus_ops {
@@ -477,7 +477,7 @@ struct snd_ac97_template {struct snd_ac97 {/* -- lowlevel (hardware) driver specific -- */ -struct snd_ac97_build_ops * build_ops; +const struct snd_ac97_build_ops * build_ops;void *private_data;void (*private_free) (struct snd_ac97 *ac97);/* --- */
sound/pci/ac97/ac97_codec.c +1 -1
@@ -1952,7 +1952,7 @@ static int snd_ac97_dev_disconnect(struct snd_device *device) }/* build_ops to do nothing */ -static struct snd_ac97_build_ops null_build_ops; +static const struct snd_ac97_build_ops null_build_ops;#ifdef CONFIG_SND_AC97_POWER_SAVE static void do_update_power (struct work_struct *work)
sound/pci/ac97/ac97_patch.c +32 -32
256 lines not on this page · raw message
PATCH 26/31 Constify struct platform_suspend_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct platform_suspend_ops.
--- arch/arm/mach-at91/pm.c | 2 +- arch/arm/mach-omap1/pm.c | 2 +- arch/arm/mach-omap2/pm24xx.c | 2 +- arch/arm/mach-omap2/pm34xx.c | 2 +- arch/arm/mach-pnx4008/pm.c | 2 +- arch/arm/mach-pxa/pm.c | 2 +- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- arch/arm/mach-sa1100/pm.c | 2 +- arch/arm/plat-s3c/pm.c | 2 +- arch/avr32/mach-at32ap/pm.c | 2 +- arch/blackfin/mach-common/pm.c | 2 +- arch/mips/alchemy/devboards/pm.c | 2 +- arch/powerpc/platforms/52xx/lite5200_pm.c | 2 +- arch/powerpc/platforms/52xx/mpc52xx_pm.c | 2 +- arch/powerpc/platforms/83xx/suspend.c | 2 +- arch/sh/boards/mach-hp6xx/pm.c | 2 +- arch/sh/kernel/cpu/shmobile/pm.c | 2 +- drivers/acpi/sleep.c | 4 ++-- drivers/macintosh/via-pmu.c | 2 +- include/linux/suspend.h | 22 +++++++++++----------- kernel/power/suspend.c | 4 ++-- 21 files changed, 33 insertions(+), 33 deletions(-)
arch/arm/mach-at91/pm.c +1 -1
@@ -348,7 +348,7 @@ static void at91_pm_end(void) } -static struct platform_suspend_ops at91_pm_ops ={ +static const struct platform_suspend_ops at91_pm_ops ={ .valid = at91_pm_valid_state, .begin = at91_pm_begin, .enter = at91_pm_enter,
arch/arm/mach-omap1/pm.c +1 -1
@@ -647,7 +647,7 @@ static struct irqaction omap_wakeup_irq = { -static struct platform_suspend_ops omap_pm_ops ={ +static const struct platform_suspend_ops omap_pm_ops ={ .prepare = omap_pm_prepare, .enter = omap_pm_enter, .finish = omap_pm_finish,
arch/arm/mach-omap2/pm24xx.c +1 -1
@@ -326,7 +326,7 @@ static void omap2_pm_finish(void)enable_hlt (); } -static struct platform_suspend_ops omap_pm_ops = { +static const struct platform_suspend_ops omap_pm_ops = { .prepare = omap2_pm_prepare, .enter = omap2_pm_enter, .finish = omap2_pm_finish,
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -401,7 +401,7 @@ static void omap3_pm_end(void)return ; } -static struct platform_suspend_ops omap_pm_ops = { +static const struct platform_suspend_ops omap_pm_ops = { .begin = omap3_pm_begin, .end = omap3_pm_end, .prepare = omap3_pm_prepare,
arch/arm/mach-pnx4008/pm.c +1 -1
@@ -116,7 +116,7 @@ static int pnx4008_pm_valid(suspend_state_t state) (state ==PM_SUSPEND_MEM ); } -static struct platform_suspend_ops pnx4008_pm_ops = { +static const struct platform_suspend_ops pnx4008_pm_ops = { .enter = pnx4008_pm_enter, .valid = pnx4008_pm_valid, };
arch/arm/mach-pxa/pm.c +1 -1
@@ -95,7 +95,7 @@ void pxa_pm_finish(void) pxa_cpu_pm_fns->finish (); } -static struct platform_suspend_ops pxa_pm_ops = { +static const struct platform_suspend_ops pxa_pm_ops = { .valid = pxa_pm_valid, .enter = pxa_pm_enter, .prepare = pxa_pm_prepare,
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -891,7 +891,7 @@ static void sharpsl_apm_get_power_status(struct apm_power_info *info) }#ifdef CONFIG_PM -static struct platform_suspend_ops sharpsl_pm_ops = { +static const struct platform_suspend_ops sharpsl_pm_ops = { .prepare = pxa_pm_prepare, .finish = pxa_pm_finish, .enter = corgi_pxa_pm_enter,
arch/arm/mach-sa1100/pm.c +1 -1
@@ -120,7 +120,7 @@ unsigned long sleep_phys_sp(void *sp)return virt_to_phys (sp); } -static struct platform_suspend_ops sa11x0_pm_ops = { +static const struct platform_suspend_ops sa11x0_pm_ops = { .enter = sa11x0_pm_enter, .valid = suspend_valid_only_mem, };
arch/arm/plat-s3c/pm.c +1 -1
@@ -355,7 +355,7 @@ static void s3c_pm_finish(void)s3c_pm_check_cleanup (); } -static struct platform_suspend_ops s3c_pm_ops = { +static const struct platform_suspend_ops s3c_pm_ops = { .enter = s3c_pm_enter, .prepare = s3c_pm_prepare, .finish = s3c_pm_finish,
arch/avr32/mach-at32ap/pm.c +1 -1
@@ -176,7 +176,7 @@ out:return 0 ; } -static struct platform_suspend_ops avr32_pm_ops = { +static const struct platform_suspend_ops avr32_pm_ops = { .valid = avr32_pm_valid_state, .enter = avr32_pm_enter, };
arch/blackfin/mach-common/pm.c +1 -1
@@ -255,7 +255,7 @@ static int bfin_pm_enter(suspend_state_t state)return 0 ; } -struct platform_suspend_ops bfin_pm_ops = { +const struct platform_suspend_ops bfin_pm_ops = { .enter = bfin_pm_enter, .valid = bfin_pm_valid, };
arch/mips/alchemy/devboards/pm.c +1 -1
@@ -78,7 +78,7 @@ static void db1x_pm_end(void) } -static struct platform_suspend_ops db1x_pm_ops = { +static const struct platform_suspend_ops db1x_pm_ops = { .valid = suspend_valid_only_mem, .begin = db1x_pm_begin, .enter = db1x_pm_enter,
arch/powerpc/platforms/52xx/lite5200_pm.c +1 -1
@@ -235,7 +235,7 @@ static void lite5200_pm_end(void) lite5200_pm_target_state =PM_SUSPEND_ON ; } -static struct platform_suspend_ops lite5200_pm_ops = { +static const struct platform_suspend_ops lite5200_pm_ops = { .valid = lite5200_pm_valid, .begin = lite5200_pm_begin, .prepare = lite5200_pm_prepare,
arch/powerpc/platforms/52xx/mpc52xx_pm.c +1 -1
@@ -180,7 +180,7 @@ void mpc52xx_pm_finish(void)iounmap (mbar); } -static struct platform_suspend_ops mpc52xx_pm_ops = { +static const struct platform_suspend_ops mpc52xx_pm_ops = { .valid = mpc52xx_pm_valid, .prepare = mpc52xx_pm_prepare, .enter = mpc52xx_pm_enter,
arch/powerpc/platforms/83xx/suspend.c +1 -1
@@ -273,7 +273,7 @@ static int mpc83xx_is_pci_agent(void)return ret; } -static struct platform_suspend_ops mpc83xx_suspend_ops = { +static const struct platform_suspend_ops mpc83xx_suspend_ops = { .valid = mpc83xx_suspend_valid, .begin = mpc83xx_suspend_begin, .enter = mpc83xx_suspend_enter,
arch/sh/boards/mach-hp6xx/pm.c +1 -1
@@ -143,7 +143,7 @@ static int hp6x0_pm_enter(suspend_state_t state)return 0 ; } -static struct platform_suspend_ops hp6x0_pm_ops = { +static const struct platform_suspend_ops hp6x0_pm_ops = { .enter = hp6x0_pm_enter, .valid = suspend_valid_only_mem, };
arch/sh/kernel/cpu/shmobile/pm.c +1 -1
@@ -58,7 +58,7 @@ static int sh_pm_enter(suspend_state_t state)return 0 ; } -static struct platform_suspend_ops sh_pm_ops = { +static const struct platform_suspend_ops sh_pm_ops = { .enter = sh_pm_enter, .valid = suspend_valid_only_mem, };
drivers/acpi/sleep.c +2 -2
@@ -297,7 +297,7 @@ static int acpi_suspend_state_valid(suspend_state_t pm_state) } } -static struct platform_suspend_ops acpi_suspend_ops = { +static const struct platform_suspend_ops acpi_suspend_ops = { .valid = acpi_suspend_state_valid, .begin = acpi_suspend_begin, .prepare_late = acpi_pm_prepare,
@@ -325,7 +325,7 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state)* The following callbacks are used if the pre-ACPI 2.0 suspend ordering has * been requested. */ -static struct platform_suspend_ops acpi_suspend_ops_old = { +static const struct platform_suspend_ops acpi_suspend_ops_old = { .valid = acpi_suspend_state_valid, .begin = acpi_suspend_begin_old, .prepare_late = acpi_pm_disable_gpes,
drivers/macintosh/via-pmu.c +1 -1
@@ -2232,7 +2232,7 @@ static int pmu_sleep_valid(suspend_state_t state) && (pmac_call_feature (PMAC_FTR_SLEEP_STATE ,NULL ,0 ,-1 ) >=0 ); } -static struct platform_suspend_ops pmu_pm_ops = { +static const struct platform_suspend_ops pmu_pm_ops = { .enter = powerbook_sleep, .valid = pmu_sleep_valid, };
include/linux/suspend.h +11 -11
@@ -104,15 +104,15 @@ typedef int __bitwise suspend_state_t;* which require special recovery actions in that situation. */ struct platform_suspend_ops { -int (*valid)(suspend_state_t state); -int (*begin)(suspend_state_t state); -int (*prepare)(void ); -int (*prepare_late)(void ); -int (*enter)(suspend_state_t state); -void (*wake)(void ); -void (*finish)(void ); -void (*end)(void ); -void (*recover)(void ); +int (*const valid)(suspend_state_t state); +int (*const begin)(suspend_state_t state); +int (*const prepare)(void ); +int (*const prepare_late)(void ); +int (*const enter)(suspend_state_t state); +void (*const wake)(void ); +void (*const finish)(void ); +void (*const end)(void ); +void (*const recover)(void ); };#ifdef CONFIG_SUSPEND
@@ -120,7 +120,7 @@ struct platform_suspend_ops {* suspend_set_ops - set platform dependent suspend operations * @ops: The new suspend operations to set. */ -extern void suspend_set_ops (struct platform_suspend_ops *ops); +extern void suspend_set_ops (const struct platform_suspend_ops *ops);extern int suspend_valid_only_mem (suspend_state_t state);/**
@@ -145,7 +145,7 @@ extern int pm_suspend(suspend_state_t state);#else /* !CONFIG_SUSPEND */ #define suspend_valid_only_mem NULL -static inline void suspend_set_ops (struct platform_suspend_ops *ops) {} +static inline void suspend_set_ops (const struct platform_suspend_ops *ops) {}static inline int pm_suspend (suspend_state_t state) {return -ENOSYS ; }#endif /* !CONFIG_SUSPEND */
kernel/power/suspend.c +2 -2
@@ -23,13 +23,13 @@ const char *const pm_states[PM_SUSPEND_MAX] = { [PM_SUSPEND_MEM] = "mem", }; -static struct platform_suspend_ops *suspend_ops; +static const struct platform_suspend_ops *suspend_ops;/** * suspend_set_ops - Set the global suspend method table. * @ops: Pointer to ops structure. */ -void suspend_set_ops (struct platform_suspend_ops *ops) +void suspend_set_ops (const struct platform_suspend_ops *ops) {mutex_lock (&pm_mutex); suspend_ops = ops;
PATCH 28/31 Constify struct super_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct super_operations.
--- include/linux/fs.h | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-)
include/linux/fs.h +22 -22
@@ -1553,30 +1553,30 @@ extern ssize_t vfs_writev(struct file *, const struct iovec __user *, unsigned long, loff_t *);struct super_operations { -struct inode *(*alloc_inode)(struct super_block *sb); -void (*destroy_inode)(struct inode *); - -void (*dirty_inode) (struct inode *); -int (*write_inode) (struct inode *,int ); -void (*drop_inode) (struct inode *); -void (*delete_inode) (struct inode *); -void (*put_super) (struct super_block *); -void (*write_super) (struct super_block *); -int (*sync_fs)(struct super_block *sb,int wait); -int (*freeze_fs) (struct super_block *); -int (*unfreeze_fs) (struct super_block *); -int (*statfs) (struct dentry *,struct kstatfs *); -int (*remount_fs) (struct super_block *,int *,char *); -void (*clear_inode) (struct inode *); -void (*umount_begin) (struct super_block *); - -int (*show_options)(struct seq_file *,struct vfsmount *); -int (*show_stats)(struct seq_file *,struct vfsmount *); +struct inode *(*const alloc_inode)(struct super_block *sb); +void (*const destroy_inode)(struct inode *); + +void (*const dirty_inode) (struct inode *); +int (*const write_inode) (struct inode *,int ); +void (*const drop_inode) (struct inode *); +void (*const delete_inode) (struct inode *); +void (*const put_super) (struct super_block *); +void (*const write_super) (struct super_block *); +int (*const sync_fs)(struct super_block *sb,int wait); +int (*const freeze_fs) (struct super_block *); +int (*const unfreeze_fs) (struct super_block *); +int (*const statfs) (struct dentry *,struct kstatfs *); +int (*const remount_fs) (struct super_block *,int *,char *); +void (*const clear_inode) (struct inode *); +void (*const umount_begin) (struct super_block *); + +int (*const show_options)(struct seq_file *,struct vfsmount *); +int (*const show_stats)(struct seq_file *,struct vfsmount *);#ifdef CONFIG_QUOTA -ssize_t (*quota_read)(struct super_block *,int ,char *,size_t ,loff_t ); -ssize_t (*quota_write)(struct super_block *,int ,const char *,size_t ,loff_t ); +ssize_t (*const quota_read)(struct super_block *,int ,char *,size_t ,loff_t ); +ssize_t (*const quota_write)(struct super_block *,int ,const char *,size_t ,loff_t );#endif -int (*bdev_try_to_free_page)(struct super_block *,struct page *,gfp_t ); +int (*const bdev_try_to_free_page)(struct super_block *,struct page *,gfp_t ); };/*
PATCH 29/31 Constify struct sysfs_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct sysfs_ops.
--- arch/ia64/kernel/topology.c | 2 +- arch/powerpc/kernel/cacheinfo.c | 2 +- arch/sh/kernel/cpu/sh4/sq.c | 2 +- arch/x86/kernel/cpu/intel_cacheinfo.c | 2 +- arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 +- block/blk-integrity.c | 2 +- block/blk-sysfs.c | 2 +- block/elevator.c | 2 +- drivers/base/bus.c | 4 ++-- drivers/base/class.c | 2 +- drivers/base/core.c | 2 +- drivers/base/sys.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- drivers/cpufreq/cpufreq.c | 2 +- drivers/cpuidle/sysfs.c | 4 ++-- drivers/dma/ioat/dma.c | 2 +- drivers/dma/ioat/dma.h | 2 +- drivers/edac/edac_device_sysfs.c | 6 +++--- drivers/edac/edac_mc_sysfs.c | 4 ++-- drivers/edac/edac_pci_sysfs.c | 4 ++-- drivers/firmware/edd.c | 2 +- drivers/firmware/efivars.c | 2 +- drivers/firmware/iscsi_ibft.c | 2 +- drivers/firmware/memmap.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- drivers/gpu/drm/ttm/ttm_memory.c | 2 +- drivers/infiniband/core/cm.c | 2 +- drivers/infiniband/core/sysfs.c | 2 +- drivers/md/dm-sysfs.c | 2 +- drivers/md/md.c | 4 ++-- drivers/net/ibmveth.c | 2 +- drivers/net/iseries_veth.c | 4 ++-- drivers/parisc/pdc_stable.c | 2 +- drivers/pci/hotplug/fakephp.c | 2 +- drivers/pci/slot.c | 2 +- drivers/uio/uio.c | 4 ++-- drivers/uwb/wlp/sysfs.c | 3 +-- drivers/xen/sys-hypervisor.c | 2 +- fs/btrfs/sysfs.c | 4 ++-- fs/dlm/lockspace.c | 2 +- fs/ext4/super.c | 2 +- fs/gfs2/sys.c | 2 +- fs/ocfs2/cluster/masklog.c | 2 +- fs/sysfs/file.c | 8 ++++---- include/linux/kobject.h | 4 ++-- include/linux/sysfs.h | 4 ++-- kernel/params.c | 2 +- lib/kobject.c | 2 +- mm/slub.c | 2 +- net/bridge/br_private.h | 2 +- net/bridge/br_sysfs_if.c | 2 +- samples/kobject/kset-example.c | 2 +- 52 files changed, 68 insertions(+), 69 deletions(-)
arch/ia64/kernel/topology.c +1 -1
@@ -282,7 +282,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char *return ret; } -static struct sysfs_ops cache_sysfs_ops = { +static const struct sysfs_ops cache_sysfs_ops = { .show = cache_show };
arch/powerpc/kernel/cacheinfo.c +1 -1
@@ -642,7 +642,7 @@ static struct kobj_attribute *cache_index_opt_attrs[] = { &cache_assoc_attr, }; -static struct sysfs_ops cache_index_ops = { +static const struct sysfs_ops cache_index_ops = { .show = cache_index_show, };
arch/sh/kernel/cpu/sh4/sq.c +1 -1
@@ -327,7 +327,7 @@ static struct attribute *sq_sysfs_attrs[] = { NULL, }; -static struct sysfs_ops sq_sysfs_ops = { +static const struct sysfs_ops sq_sysfs_ops = { .show = sq_sysfs_show, .store = sq_sysfs_store, };
arch/x86/kernel/cpu/intel_cacheinfo.c +1 -1
@@ -860,7 +860,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };
arch/x86/kernel/cpu/mcheck/mce_amd.c +1 -1
@@ -388,7 +388,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops threshold_ops = { +static const struct sysfs_ops threshold_ops = { .show = show, .store = store, };
block/blk-integrity.c +1 -1
@@ -278,7 +278,7 @@ static struct attribute *integrity_attrs[] = { NULL, }; -static struct sysfs_ops integrity_ops = { +static const struct sysfs_ops integrity_ops = { .show = &integrity_attr_show, .store = &integrity_attr_store, };
block/blk-sysfs.c +1 -1
@@ -414,7 +414,7 @@ static void blk_release_queue(struct kobject *kobj)kmem_cache_free (blk_requestq_cachep, q); } -static struct sysfs_ops queue_sysfs_ops = { +static const struct sysfs_ops queue_sysfs_ops = { .show = queue_attr_show, .store = queue_attr_store, };
block/elevator.c +1 -1
@@ -889,7 +889,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,return error; } -static struct sysfs_ops elv_sysfs_ops = { +static const struct sysfs_ops elv_sysfs_ops = { .show = elv_attr_show, .store = elv_attr_store, };
drivers/base/bus.c +2 -2
@@ -70,7 +70,7 @@ static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops driver_sysfs_ops = { +static const struct sysfs_ops driver_sysfs_ops = { .show = drv_attr_show, .store = drv_attr_store, };
@@ -115,7 +115,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops bus_sysfs_ops = { +static const struct sysfs_ops bus_sysfs_ops = { .show = bus_attr_show, .store = bus_attr_store, };
drivers/base/class.c +1 -1
@@ -61,7 +61,7 @@ static void class_release(struct kobject *kobj) "be careful\n", class->name); } -static struct sysfs_ops class_sysfs_ops = { +static const struct sysfs_ops class_sysfs_ops = { .show = class_attr_show, .store = class_attr_store, };
drivers/base/core.c +1 -1
@@ -93,7 +93,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops dev_sysfs_ops = { +static const struct sysfs_ops dev_sysfs_ops = { .show = dev_attr_show, .store = dev_attr_store, };
drivers/base/sys.c +2 -2
@@ -54,7 +54,7 @@ sysdev_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = sysdev_show, .store = sysdev_store, };
@@ -104,7 +104,7 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops sysfs_class_ops = { +static const struct sysfs_ops sysfs_class_ops = { .show = sysdev_class_show, .store = sysdev_class_store, };
drivers/block/pktcdvd.c +1 -1
@@ -284,7 +284,7 @@ static ssize_t kobj_pkt_store(struct kobject *kobj,return len; } -static struct sysfs_ops kobj_pkt_ops = { +static const struct sysfs_ops kobj_pkt_ops = { .show = kobj_pkt_show, .store = kobj_pkt_store };
drivers/cpufreq/cpufreq.c +1 -1
@@ -750,7 +750,7 @@ static void cpufreq_sysfs_release(struct kobject *kobj)complete (&policy->kobj_unregister); } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };
drivers/cpuidle/sysfs.c +2 -2
@@ -191,7 +191,7 @@ static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr,return ret; } -static struct sysfs_ops cpuidle_sysfs_ops = { +static const struct sysfs_ops cpuidle_sysfs_ops = { .show = cpuidle_show, .store = cpuidle_store, };
@@ -277,7 +277,7 @@ static ssize_t cpuidle_state_show(struct kobject * kobj,return ret; } -static struct sysfs_ops cpuidle_state_sysfs_ops = { +static const struct sysfs_ops cpuidle_state_sysfs_ops = { .show = cpuidle_state_show, };
drivers/dma/ioat/dma.c +1 -1
@@ -1146,7 +1146,7 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)return entry->show (&chan->common, page); } -struct sysfs_ops ioat_sysfs_ops = { +const struct sysfs_ops ioat_sysfs_ops = { .show = ioat_attr_show, };
drivers/dma/ioat/dma.h +1 -1
@@ -329,7 +329,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, unsigned long *phys_complete);void ioat_kobject_add (struct ioatdma_device *device,struct kobj_type *type);void ioat_kobject_del (struct ioatdma_device *device); -extern struct sysfs_ops ioat_sysfs_ops; +extern const struct sysfs_ops ioat_sysfs_ops;extern struct ioat_sysfs_entry ioat_version_attr;extern struct ioat_sysfs_entry ioat_cap_attr;#endif /* IOATDMA_H */
drivers/edac/edac_device_sysfs.c +3 -3
@@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj, }/* edac_dev file operations for an 'ctl_info' */ -static struct sysfs_ops device_ctl_info_ops = { +static const struct sysfs_ops device_ctl_info_ops = { .show = edac_dev_ctl_info_show, .store = edac_dev_ctl_info_store };
@@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj, }/* edac_dev file operations for an 'instance' */ -static struct sysfs_ops device_instance_ops = { +static const struct sysfs_ops device_instance_ops = { .show = edac_dev_instance_show, .store = edac_dev_instance_store };
@@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj, }/* edac_dev file operations for a 'block' */ -static struct sysfs_ops device_block_ops = { +static const struct sysfs_ops device_block_ops = { .show = edac_dev_block_show, .store = edac_dev_block_store };
drivers/edac/edac_mc_sysfs.c +2 -2
@@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops csrowfs_ops = { +static const struct sysfs_ops csrowfs_ops = { .show = csrowdev_show, .store = csrowdev_store };
@@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr, }/* Intermediate show/store table */ -static struct sysfs_ops mci_ops = { +static const struct sysfs_ops mci_ops = { .show = mcidev_show, .store = mcidev_store };
drivers/edac/edac_pci_sysfs.c +2 -2
@@ -121,7 +121,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj, }/* fs_ops table */ -static struct sysfs_ops pci_instance_ops = { +static const struct sysfs_ops pci_instance_ops = { .show = edac_pci_instance_show, .store = edac_pci_instance_store };
@@ -261,7 +261,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj,return -EIO ; } -static struct sysfs_ops edac_pci_sysfs_ops = { +static const struct sysfs_ops edac_pci_sysfs_ops = { .show = edac_pci_dev_show, .store = edac_pci_dev_store };
drivers/firmware/edd.c +1 -1
@@ -122,7 +122,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)return ret; } -static struct sysfs_ops edd_attr_ops = { +static const struct sysfs_ops edd_attr_ops = { .show = edd_attr_show, };
drivers/firmware/efivars.c +1 -1
@@ -362,7 +362,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops efivar_attr_ops = { +static const struct sysfs_ops efivar_attr_ops = { .show = efivar_attr_show, .store = efivar_attr_store, };
drivers/firmware/iscsi_ibft.c +1 -1
@@ -525,7 +525,7 @@ static ssize_t ibft_show_attribute(struct kobject *kobj,return ret; } -static struct sysfs_ops ibft_attr_ops = { +static const struct sysfs_ops ibft_attr_ops = { .show = ibft_show_attribute, };
drivers/firmware/memmap.c +1 -1
@@ -74,7 +74,7 @@ static struct attribute *def_attrs[] = { NULL }; -static struct sysfs_ops memmap_attr_ops = { +static const struct sysfs_ops memmap_attr_ops = { .show = memmap_attr_show, };
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
@@ -67,7 +67,7 @@ static struct attribute *ttm_bo_global_attrs[] = { NULL }; -static struct sysfs_ops ttm_bo_global_ops = { +static const struct sysfs_ops ttm_bo_global_ops = { .show = &ttm_bo_global_show };
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
@@ -152,7 +152,7 @@ static struct attribute *ttm_mem_zone_attrs[] = { NULL }; -static struct sysfs_ops ttm_mem_zone_ops = { +static const struct sysfs_ops ttm_mem_zone_ops = { .show = &ttm_mem_zone_show, .store = &ttm_mem_zone_store };
drivers/infiniband/core/cm.c +1 -1
@@ -3597,7 +3597,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr, atomic_long_read(&group->counter[cm_attr->index])); } -static struct sysfs_ops cm_counter_ops = { +static const struct sysfs_ops cm_counter_ops = { .show = cm_show_counter };
drivers/infiniband/core/sysfs.c +1 -1
@@ -79,7 +79,7 @@ static ssize_t port_attr_show(struct kobject *kobj,return port_attr->show (p, port_attr, buf); } -static struct sysfs_ops port_sysfs_ops = { +static const struct sysfs_ops port_sysfs_ops = { .show = port_attr_show };
drivers/md/dm-sysfs.c +1 -1
@@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = { NULL, }; -static struct sysfs_ops dm_sysfs_ops = { +static const struct sysfs_ops dm_sysfs_ops = { .show = dm_attr_show, };
drivers/md/md.c +2 -2
@@ -2505,7 +2505,7 @@ static void rdev_free(struct kobject *ko)mdk_rdev_t *rdev =container_of (ko, mdk_rdev_t, kobj);kfree (rdev); } -static struct sysfs_ops rdev_sysfs_ops = { +static const struct sysfs_ops rdev_sysfs_ops = { .show = rdev_attr_show, .store = rdev_attr_store, };
@@ -3875,7 +3875,7 @@ static void md_free(struct kobject *ko)kfree (mddev); } -static struct sysfs_ops md_sysfs_ops = { +static const struct sysfs_ops md_sysfs_ops = { .show = md_attr_show, .store = md_attr_store, };
drivers/net/ibmveth.c +1 -1
@@ -1577,7 +1577,7 @@ static struct attribute * veth_pool_attrs[] = { NULL, }; -static struct sysfs_ops veth_pool_ops = { +static const struct sysfs_ops veth_pool_ops = { .show = veth_pool_show, .store = veth_pool_store, };
drivers/net/iseries_veth.c +2 -2
@@ -384,7 +384,7 @@ static struct attribute *veth_cnx_default_attrs[] = { NULL }; -static struct sysfs_ops veth_cnx_sysfs_ops = { +static const struct sysfs_ops veth_cnx_sysfs_ops = { .show = veth_cnx_attribute_show };
@@ -441,7 +441,7 @@ static struct attribute *veth_port_default_attrs[] = { NULL }; -static struct sysfs_ops veth_port_sysfs_ops = { +static const struct sysfs_ops veth_port_sysfs_ops = { .show = veth_port_attribute_show };
drivers/parisc/pdc_stable.c +1 -1
@@ -481,7 +481,7 @@ pdcspath_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops pdcspath_attr_ops = { +static const struct sysfs_ops pdcspath_attr_ops = { .show = pdcspath_attr_show, .store = pdcspath_attr_store, };
drivers/pci/hotplug/fakephp.c +1 -1
@@ -73,7 +73,7 @@ static void legacy_release(struct kobject *kobj) }static struct kobj_type legacy_ktype = { - .sysfs_ops = &(struct sysfs_ops ){ + .sysfs_ops = &(const struct sysfs_ops ){ .store = legacy_store, .show = legacy_show }, .release = &legacy_release,
drivers/pci/slot.c +1 -1
@@ -29,7 +29,7 @@ static ssize_t pci_slot_attr_store(struct kobject *kobj,return attribute->store ? attribute->store (slot, buf, len) : -EIO ; } -static struct sysfs_ops pci_slot_sysfs_ops = { +static const struct sysfs_ops pci_slot_sysfs_ops = { .show = pci_slot_attr_show, .store = pci_slot_attr_store, };
drivers/uio/uio.c +2 -2
@@ -129,7 +129,7 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,return entry->show (mem, buf); } -static struct sysfs_ops map_sysfs_ops = { +static const struct sysfs_ops map_sysfs_ops = { .show = map_type_show, };
@@ -217,7 +217,7 @@ static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr,return entry->show (port, buf); } -static struct sysfs_ops portio_sysfs_ops = { +static const struct sysfs_ops portio_sysfs_ops = { .show = portio_type_show, };
drivers/uwb/wlp/sysfs.c +1 -2
@@ -615,8 +615,7 @@ ssize_t wlp_wss_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static -struct sysfs_ops wss_sysfs_ops = { +static const struct sysfs_ops wss_sysfs_ops = { .show = wlp_wss_attr_show, .store = wlp_wss_attr_store, };
drivers/xen/sys-hypervisor.c +1 -1
@@ -425,7 +425,7 @@ static ssize_t hyp_sysfs_store(struct kobject *kobj,return 0 ; } -static struct sysfs_ops hyp_sysfs_ops = { +static const struct sysfs_ops hyp_sysfs_ops = { .show = hyp_sysfs_show, .store = hyp_sysfs_store, };
fs/btrfs/sysfs.c +2 -2
@@ -164,12 +164,12 @@ static void btrfs_root_release(struct kobject *kobj)complete (&root->kobj_unregister); } -static struct sysfs_ops btrfs_super_attr_ops = { +static const struct sysfs_ops btrfs_super_attr_ops = { .show = btrfs_super_attr_show, .store = btrfs_super_attr_store, }; -static struct sysfs_ops btrfs_root_attr_ops = { +static const struct sysfs_ops btrfs_root_attr_ops = { .show = btrfs_root_attr_show, .store = btrfs_root_attr_store, };
fs/dlm/lockspace.c +1 -1
@@ -148,7 +148,7 @@ static void lockspace_kobj_release(struct kobject *k)kfree (ls); } -static struct sysfs_ops dlm_attr_ops = { +static const struct sysfs_ops dlm_attr_ops = { .show = dlm_attr_show, .store = dlm_attr_store, };
fs/ext4/super.c +1 -1
@@ -2251,7 +2251,7 @@ static void ext4_sb_release(struct kobject *kobj) } -static struct sysfs_ops ext4_attr_ops = { +static const struct sysfs_ops ext4_attr_ops = { .show = ext4_attr_show, .store = ext4_attr_store, };
fs/gfs2/sys.c +1 -1
@@ -49,7 +49,7 @@ static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,return a->store ? a->store (sdp, buf, len) : len; } -static struct sysfs_ops gfs2_attr_ops = { +static const struct sysfs_ops gfs2_attr_ops = { .show = gfs2_attr_show, .store = gfs2_attr_store, };
fs/ocfs2/cluster/masklog.c +1 -1
@@ -135,7 +135,7 @@ static ssize_t mlog_store(struct kobject *obj, struct attribute *attr,return mlog_mask_store (mlog_attr->mask, buf, count); } -static struct sysfs_ops mlog_attr_ops = { +static const struct sysfs_ops mlog_attr_ops = { .show = mlog_show, .store = mlog_store, };
fs/sysfs/file.c +4 -4
@@ -53,7 +53,7 @@ struct sysfs_buffer {size_t count;loff_t pos;char * page; -struct sysfs_ops * ops; +const struct sysfs_ops * ops;struct mutex mutex;int needs_read_fill;int event;
@@ -75,7 +75,7 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int ret =0 ;ssize_t count;
@@ -199,7 +199,7 @@ flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int rc;/* need attr_sd for attr and ops, its parent for kobj */
@@ -335,7 +335,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;struct sysfs_buffer *buffer; -struct sysfs_ops *ops; +const struct sysfs_ops *ops;int error = -EACCES ;char *p;
include/linux/kobject.h +2 -2
@@ -106,7 +106,7 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);struct kobj_type {void (*release)(struct kobject *kobj); -struct sysfs_ops *sysfs_ops; +const struct sysfs_ops *sysfs_ops;struct attribute **default_attrs; };
@@ -132,7 +132,7 @@ struct kobj_attribute { const char *buf, size_t count); }; -extern struct sysfs_ops kobj_sysfs_ops; +extern const struct sysfs_ops kobj_sysfs_ops;/** * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
include/linux/sysfs.h +2 -2
@@ -75,8 +75,8 @@ struct bin_attribute { };struct sysfs_ops { -ssize_t (*show)(struct kobject *,struct attribute *,char *); -ssize_t (*store)(struct kobject *,struct attribute *,const char *,size_t ); +ssize_t (*const show)(struct kobject *,struct attribute *,char *); +ssize_t (*const store)(struct kobject *,struct attribute *,const char *,size_t ); };struct sysfs_dirent ;
kernel/params.c +1 -1
@@ -725,7 +725,7 @@ static ssize_t module_attr_store(struct kobject *kobj,return ret; } -static struct sysfs_ops module_sysfs_ops = { +static const struct sysfs_ops module_sysfs_ops = { .show = module_attr_show, .store = module_attr_store, };
lib/kobject.c +1 -1
@@ -700,7 +700,7 @@ static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -struct sysfs_ops kobj_sysfs_ops = { +const struct sysfs_ops kobj_sysfs_ops = { .show = kobj_attr_show, .store = kobj_attr_store, };
mm/slub.c +1 -1
@@ -4503,7 +4503,7 @@ static void kmem_cache_release(struct kobject *kobj)kfree (s); } -static struct sysfs_ops slab_sysfs_ops = { +static const struct sysfs_ops slab_sysfs_ops = { .show = slab_attr_show, .store = slab_attr_store, };
net/bridge/br_private.h +1 -1
@@ -254,7 +254,7 @@ extern void br_ifinfo_notify(int event, struct net_bridge_port *port);#ifdef CONFIG_SYSFS /* br_sysfs_if.c */ -extern struct sysfs_ops brport_sysfs_ops; +extern const struct sysfs_ops brport_sysfs_ops;extern int br_sysfs_addif (struct net_bridge_port *p);/* br_sysfs_br.c */
net/bridge/br_sysfs_if.c +1 -1
@@ -220,7 +220,7 @@ static ssize_t brport_store(struct kobject * kobj,return ret; } -struct sysfs_ops brport_sysfs_ops = { +const struct sysfs_ops brport_sysfs_ops = { .show = brport_show, .store = brport_store, };
samples/kobject/kset-example.c +1 -1
@@ -87,7 +87,7 @@ static ssize_t foo_attr_store(struct kobject *kobj, }/* Our custom sysfs_ops that we will associate with our ktype later on */ -static struct sysfs_ops foo_sysfs_ops = { +static const struct sysfs_ops foo_sysfs_ops = { .show = foo_attr_show, .store = foo_attr_store, };
PATCH 30/31 Constify struct usb_mon_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct usb_mon_operations.
--- drivers/usb/core/hcd.c | 4 ++-- drivers/usb/core/hcd.h | 10 +++++----- drivers/usb/mon/mon_main.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/usb/core/hcd.c +2 -2
@@ -2216,7 +2216,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_platform_shutdown);#if defined(CONFIG_USB_MON ) || defined(CONFIG_USB_MON_MODULE ) -struct usb_mon_operations *mon_ops; +const struct usb_mon_operations *mon_ops;/* * The registration is unlocked.
@@ -2226,7 +2226,7 @@ struct usb_mon_operations *mon_ops;* symbols from usbcore, usbcore gets referenced and cannot be unloaded first. */ -int usb_mon_register (struct usb_mon_operations *ops) +int usb_mon_register (const struct usb_mon_operations *ops) {if (mon_ops)
drivers/usb/core/hcd.h +5 -5
@@ -486,13 +486,13 @@ static inline void usbfs_cleanup(void) { }#if defined(CONFIG_USB_MON ) || defined(CONFIG_USB_MON_MODULE )struct usb_mon_operations { -void (*urb_submit)(struct usb_bus *bus,struct urb *urb); -void (*urb_submit_error)(struct usb_bus *bus,struct urb *urb,int err); -void (*urb_complete)(struct usb_bus *bus,struct urb *urb,int status); +void (*const urb_submit)(struct usb_bus *bus,struct urb *urb); +void (*const urb_submit_error)(struct usb_bus *bus,struct urb *urb,int err); +void (*const urb_complete)(struct usb_bus *bus,struct urb *urb,int status);/* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */ }; -extern struct usb_mon_operations *mon_ops; +extern const struct usb_mon_operations *mon_ops;static inline void usbmon_urb_submit (struct usb_bus *bus,struct urb *urb) {
@@ -514,7 +514,7 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, (*mon_ops->urb_complete)(bus, urb, status); } -int usb_mon_register (struct usb_mon_operations *ops); +int usb_mon_register (const struct usb_mon_operations *ops);void usb_mon_deregister (void );#else
drivers/usb/mon/mon_main.c +1 -1
@@ -238,7 +238,7 @@ static struct notifier_block mon_nb = {/* * Ops */ -static struct usb_mon_operations mon_ops_0 = { +static const struct usb_mon_operations mon_ops_0 = { .urb_submit = mon_submit, .urb_submit_error = mon_submit_error, .urb_complete = mon_complete,
PATCH 31/31 Constify struct wd_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct wd_ops with some exceptions.
--- arch/x86/kernel/cpu/perfctr-watchdog.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/perfctr-watchdog.c +7 -5
@@ -30,11 +30,11 @@ struct nmi_watchdog_ctlblk {/* Interface defining a CPU specific perfctr watchdog */ struct wd_ops { -int (*reserve)(void ); -void (*unreserve)(void ); -int (*setup)(unsigned nmi_hz); -void (*rearm)(struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz); -void (*stop)(void ); +int (*const reserve)(void ); +void (*const unreserve)(void ); +int (*const setup)(unsigned nmi_hz); +void (*const rearm)(struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz); +void (*const stop)(void );unsigned perfctr;unsigned evntsel;u64 checkbit;
@@ -645,6 +645,7 @@ static const struct wd_ops p4_wd_ops = {#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL#define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK +/* cannot be const */ static struct wd_ops intel_arch_wd_ops;static int setup_intel_arch_watchdog (unsigned nmi_hz)
@@ -697,6 +698,7 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)return 1 ; } +/* cannot be const */ static struct wd_ops intel_arch_wd_ops__read_mostly = { .reserve = single_msr_reserve, .unreserve = single_msr_unreserve,
Re: [PATCH 29/31] Constify struct sysfs_ops for 2.6.32 v1
In reply to Emese RevfyAdded [email protected] to CC.
Quoted 873 lines
From: Emese Revfy <[email protected]>
Constify struct
sysfs_ops.Signed-off-by Emese Revfy <[email protected]>--- arch/ia64/kernel/topology.c | 2 +- arch/powerpc/kernel/cacheinfo.c | 2 +- arch/sh/kernel/cpu/sh4/sq.c | 2 +- arch/x86/kernel/cpu/intel_cacheinfo.c | 2 +- arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 +- block/blk-integrity.c | 2 +- block/blk-sysfs.c | 2 +- block/elevator.c | 2 +- drivers/base/bus.c | 4 ++-- drivers/base/class.c | 2 +- drivers/base/core.c | 2 +- drivers/base/sys.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- drivers/cpufreq/cpufreq.c | 2 +- drivers/cpuidle/sysfs.c | 4 ++-- drivers/dma/ioat/dma.c | 2 +- drivers/dma/ioat/dma.h | 2 +- drivers/edac/edac_device_sysfs.c | 6 +++--- drivers/edac/edac_mc_sysfs.c | 4 ++-- drivers/edac/edac_pci_sysfs.c | 4 ++-- drivers/firmware/edd.c | 2 +- drivers/firmware/efivars.c | 2 +- drivers/firmware/iscsi_ibft.c | 2 +- drivers/firmware/memmap.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- drivers/gpu/drm/ttm/ttm_memory.c | 2 +- drivers/infiniband/core/cm.c | 2 +- drivers/infiniband/core/sysfs.c | 2 +- drivers/md/dm-sysfs.c | 2 +- drivers/md/md.c | 4 ++-- drivers/net/ibmveth.c | 2 +- drivers/net/iseries_veth.c | 4 ++-- drivers/parisc/pdc_stable.c | 2 +- drivers/pci/hotplug/fakephp.c | 2 +- drivers/pci/slot.c | 2 +- drivers/uio/uio.c | 4 ++-- drivers/uwb/wlp/sysfs.c | 3 +-- drivers/xen/sys-hypervisor.c | 2 +- fs/btrfs/sysfs.c | 4 ++-- fs/dlm/lockspace.c | 2 +- fs/ext4/super.c | 2 +- fs/gfs2/sys.c | 2 +- fs/ocfs2/cluster/masklog.c | 2 +- fs/sysfs/file.c | 8 ++++---- include/linux/kobject.h | 4 ++-- include/linux/sysfs.h | 4 ++-- kernel/params.c | 2 +- lib/kobject.c | 2 +- mm/slub.c | 2 +- net/bridge/br_private.h | 2 +- net/bridge/br_sysfs_if.c | 2 +- samples/kobject/kset-example.c | 2 +- 52 files changed, 68 insertions(+), 69 deletions(-)arch/ia64/kernel/topology.c +1
-1@@ -282,7 +282,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char *return ret; } -static struct sysfs_ops cache_sysfs_ops = { +static const struct sysfs_ops cache_sysfs_ops = { .show = cache_show };arch/powerpc/kernel/cacheinfo.c +1
-1@@ -642,7 +642,7 @@ static struct kobj_attribute *cache_index_opt_attrs[] = { &cache_assoc_attr, }; -static struct sysfs_ops cache_index_ops = { +static const struct sysfs_ops cache_index_ops = { .show = cache_index_show, };arch/sh/kernel/cpu/sh4/sq.c +1
-1@@ -327,7 +327,7 @@ static struct attribute *sq_sysfs_attrs[] = { NULL, }; -static struct sysfs_ops sq_sysfs_ops = { +static const struct sysfs_ops sq_sysfs_ops = { .show = sq_sysfs_show, .store = sq_sysfs_store, };arch/x86/kernel/cpu/intel_cacheinfo.c +1
-1@@ -860,7 +860,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };arch/x86/kernel/cpu/mcheck/mce_amd.c +1
-1@@ -388,7 +388,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops threshold_ops = { +static const struct sysfs_ops threshold_ops = { .show = show, .store = store, };block/blk-integrity.c +1
-1@@ -278,7 +278,7 @@ static struct attribute *integrity_attrs[] = { NULL, }; -static struct sysfs_ops integrity_ops = { +static const struct sysfs_ops integrity_ops = { .show = &integrity_attr_show, .store = &integrity_attr_store, };block/blk-sysfs.c +1
-1@@ -414,7 +414,7 @@ static void blk_release_queue(struct kobject *kobj)kmem_cache_free (blk_requestq_cachep, q); } -static struct sysfs_ops queue_sysfs_ops = { +static const struct sysfs_ops queue_sysfs_ops = { .show = queue_attr_show, .store = queue_attr_store, };block/elevator.c +1
-1@@ -889,7 +889,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,return error; } -static struct sysfs_ops elv_sysfs_ops = { +static const struct sysfs_ops elv_sysfs_ops = { .show = elv_attr_show, .store = elv_attr_store, };drivers/base/bus.c +2
-2@@ -70,7 +70,7 @@ static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops driver_sysfs_ops = { +static const struct sysfs_ops driver_sysfs_ops = { .show = drv_attr_show, .store = drv_attr_store, };@@ -115,7 +115,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops bus_sysfs_ops = { +static const struct sysfs_ops bus_sysfs_ops = { .show = bus_attr_show, .store = bus_attr_store, };drivers/base/class.c +1
-1@@ -61,7 +61,7 @@ static void class_release(struct kobject *kobj) "be careful\n", class->name); } -static struct sysfs_ops class_sysfs_ops = { +static const struct sysfs_ops class_sysfs_ops = { .show = class_attr_show, .store = class_attr_store, };drivers/base/core.c +1
-1@@ -93,7 +93,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops dev_sysfs_ops = { +static const struct sysfs_ops dev_sysfs_ops = { .show = dev_attr_show, .store = dev_attr_store, };drivers/base/sys.c +2
-2@@ -54,7 +54,7 @@ sysdev_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = sysdev_show, .store = sysdev_store, };@@ -104,7 +104,7 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops sysfs_class_ops = { +static const struct sysfs_ops sysfs_class_ops = { .show = sysdev_class_show, .store = sysdev_class_store, };drivers/block/pktcdvd.c +1
-1@@ -284,7 +284,7 @@ static ssize_t kobj_pkt_store(struct kobject *kobj,return len; } -static struct sysfs_ops kobj_pkt_ops = { +static const struct sysfs_ops kobj_pkt_ops = { .show = kobj_pkt_show, .store = kobj_pkt_store };drivers/cpufreq/cpufreq.c +1
-1@@ -750,7 +750,7 @@ static void cpufreq_sysfs_release(struct kobject *kobj)complete (&policy->kobj_unregister); } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };drivers/cpuidle/sysfs.c +2
-2@@ -191,7 +191,7 @@ static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr,return ret; } -static struct sysfs_ops cpuidle_sysfs_ops = { +static const struct sysfs_ops cpuidle_sysfs_ops = { .show = cpuidle_show, .store = cpuidle_store, };@@ -277,7 +277,7 @@ static ssize_t cpuidle_state_show(struct kobject * kobj,return ret; } -static struct sysfs_ops cpuidle_state_sysfs_ops = { +static const struct sysfs_ops cpuidle_state_sysfs_ops = { .show = cpuidle_state_show, };drivers/dma/ioat/dma.c +1
-1@@ -1146,7 +1146,7 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)return entry->show (&chan->common, page); } -struct sysfs_ops ioat_sysfs_ops = { +const struct sysfs_ops ioat_sysfs_ops = { .show = ioat_attr_show, };drivers/dma/ioat/dma.h +1
-1@@ -329,7 +329,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, unsigned long *phys_complete);void ioat_kobject_add (struct ioatdma_device *device,struct kobj_type *type);void ioat_kobject_del (struct ioatdma_device *device); -extern struct sysfs_ops ioat_sysfs_ops; +extern const struct sysfs_ops ioat_sysfs_ops;extern struct ioat_sysfs_entry ioat_version_attr;extern struct ioat_sysfs_entry ioat_cap_attr;#endif /* IOATDMA_H */ drivers/edac/edac_device_sysfs.c +3
-3@@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj, }/* edac_dev file operations for an 'ctl_info' */ -static struct sysfs_ops device_ctl_info_ops = { +static const struct sysfs_ops device_ctl_info_ops = { .show = edac_dev_ctl_info_show, .store = edac_dev_ctl_info_store };@@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj, }/* edac_dev file operations for an 'instance' */ -static struct sysfs_ops device_instance_ops = { +static const struct sysfs_ops device_instance_ops = { .show = edac_dev_instance_show, .store = edac_dev_instance_store };@@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj, }/* edac_dev file operations for a 'block' */ -static struct sysfs_ops device_block_ops = { +static const struct sysfs_ops device_block_ops = { .show = edac_dev_block_show, .store = edac_dev_block_store };drivers/edac/edac_mc_sysfs.c +2
-2@@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops csrowfs_ops = { +static const struct sysfs_ops csrowfs_ops = { .show = csrowdev_show, .store = csrowdev_store };@@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr, }/* Intermediate show/store table */ -static struct sysfs_ops mci_ops = { +static const struct sysfs_ops mci_ops = { .show = mcidev_show, .store = mcidev_store };drivers/edac/edac_pci_sysfs.c +2
-2@@ -121,7 +121,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj, }/* fs_ops table */ -static struct sysfs_ops pci_instance_ops = { +static const struct sysfs_ops pci_instance_ops = { .show = edac_pci_instance_show, .store = edac_pci_instance_store };@@ -261,7 +261,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj,return -EIO ; } -static struct sysfs_ops edac_pci_sysfs_ops = { +static const struct sysfs_ops edac_pci_sysfs_ops = { .show = edac_pci_dev_show, .store = edac_pci_dev_store };drivers/firmware/edd.c +1
-1@@ -122,7 +122,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)return ret; } -static struct sysfs_ops edd_attr_ops = { +static const struct sysfs_ops edd_attr_ops = { .show = edd_attr_show, };drivers/firmware/efivars.c +1
-1@@ -362,7 +362,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops efivar_attr_ops = { +static const struct sysfs_ops efivar_attr_ops = { .show = efivar_attr_show, .store = efivar_attr_store, };drivers/firmware/iscsi_ibft.c +1
-1@@ -525,7 +525,7 @@ static ssize_t ibft_show_attribute(struct kobject *kobj,return ret; } -static struct sysfs_ops ibft_attr_ops = { +static const struct sysfs_ops ibft_attr_ops = { .show = ibft_show_attribute, };drivers/firmware/memmap.c +1
-1@@ -74,7 +74,7 @@ static struct attribute *def_attrs[] = { NULL }; -static struct sysfs_ops memmap_attr_ops = { +static const struct sysfs_ops memmap_attr_ops = { .show = memmap_attr_show, };drivers/gpu/drm/ttm/ttm_bo.c +1
-1@@ -67,7 +67,7 @@ static struct attribute *ttm_bo_global_attrs[] = { NULL }; -static struct sysfs_ops ttm_bo_global_ops = { +static const struct sysfs_ops ttm_bo_global_ops = { .show = &ttm_bo_global_show };drivers/gpu/drm/ttm/ttm_memory.c +1
-1@@ -152,7 +152,7 @@ static struct attribute *ttm_mem_zone_attrs[] = { NULL }; -static struct sysfs_ops ttm_mem_zone_ops = { +static const struct sysfs_ops ttm_mem_zone_ops = { .show = &ttm_mem_zone_show, .store = &ttm_mem_zone_store };drivers/infiniband/core/cm.c +1
-1@@ -3597,7 +3597,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr, atomic_long_read(&group->counter[cm_attr->index])); } -static struct sysfs_ops cm_counter_ops = { +static const struct sysfs_ops cm_counter_ops = { .show = cm_show_counter };drivers/infiniband/core/sysfs.c +1
-1@@ -79,7 +79,7 @@ static ssize_t port_attr_show(struct kobject *kobj,return port_attr->show (p, port_attr, buf); } -static struct sysfs_ops port_sysfs_ops = { +static const struct sysfs_ops port_sysfs_ops = { .show = port_attr_show };drivers/md/dm-sysfs.c +1
-1@@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = { NULL, }; -static struct sysfs_ops dm_sysfs_ops = { +static const struct sysfs_ops dm_sysfs_ops = { .show = dm_attr_show, };drivers/md/md.c +2
-2@@ -2505,7 +2505,7 @@ static void rdev_free(struct kobject *ko)mdk_rdev_t *rdev =container_of (ko, mdk_rdev_t, kobj);kfree (rdev); } -static struct sysfs_ops rdev_sysfs_ops = { +static const struct sysfs_ops rdev_sysfs_ops = { .show = rdev_attr_show, .store = rdev_attr_store, };@@ -3875,7 +3875,7 @@ static void md_free(struct kobject *ko)kfree (mddev); } -static struct sysfs_ops md_sysfs_ops = { +static const struct sysfs_ops md_sysfs_ops = { .show = md_attr_show, .store = md_attr_store, };drivers/net/ibmveth.c +1
-1@@ -1577,7 +1577,7 @@ static struct attribute * veth_pool_attrs[] = { NULL, }; -static struct sysfs_ops veth_pool_ops = { +static const struct sysfs_ops veth_pool_ops = { .show = veth_pool_show, .store = veth_pool_store, };drivers/net/iseries_veth.c +2
-2@@ -384,7 +384,7 @@ static struct attribute *veth_cnx_default_attrs[] = { NULL }; -static struct sysfs_ops veth_cnx_sysfs_ops = { +static const struct sysfs_ops veth_cnx_sysfs_ops = { .show = veth_cnx_attribute_show };@@ -441,7 +441,7 @@ static struct attribute *veth_port_default_attrs[] = { NULL }; -static struct sysfs_ops veth_port_sysfs_ops = { +static const struct sysfs_ops veth_port_sysfs_ops = { .show = veth_port_attribute_show };drivers/parisc/pdc_stable.c +1
-1@@ -481,7 +481,7 @@ pdcspath_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops pdcspath_attr_ops = { +static const struct sysfs_ops pdcspath_attr_ops = { .show = pdcspath_attr_show, .store = pdcspath_attr_store, };drivers/pci/hotplug/fakephp.c +1
-1@@ -73,7 +73,7 @@ static void legacy_release(struct kobject *kobj) }static struct kobj_type legacy_ktype = { - .sysfs_ops = &(struct sysfs_ops ){ + .sysfs_ops = &(const struct sysfs_ops ){ .store = legacy_store, .show = legacy_show }, .release = &legacy_release,drivers/pci/slot.c +1
-1@@ -29,7 +29,7 @@ static ssize_t pci_slot_attr_store(struct kobject *kobj,return attribute->store ? attribute->store (slot, buf, len) : -EIO ; } -static struct sysfs_ops pci_slot_sysfs_ops = { +static const struct sysfs_ops pci_slot_sysfs_ops = { .show = pci_slot_attr_show, .store = pci_slot_attr_store, };drivers/uio/uio.c +2
-2@@ -129,7 +129,7 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,return entry->show (mem, buf); } -static struct sysfs_ops map_sysfs_ops = { +static const struct sysfs_ops map_sysfs_ops = { .show = map_type_show, };@@ -217,7 +217,7 @@ static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr,return entry->show (port, buf); } -static struct sysfs_ops portio_sysfs_ops = { +static const struct sysfs_ops portio_sysfs_ops = { .show = portio_type_show, };drivers/uwb/wlp/sysfs.c +1
-2@@ -615,8 +615,7 @@ ssize_t wlp_wss_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static -struct sysfs_ops wss_sysfs_ops = { +static const struct sysfs_ops wss_sysfs_ops = { .show = wlp_wss_attr_show, .store = wlp_wss_attr_store, };drivers/xen/sys-hypervisor.c +1
-1@@ -425,7 +425,7 @@ static ssize_t hyp_sysfs_store(struct kobject *kobj,return 0 ; } -static struct sysfs_ops hyp_sysfs_ops = { +static const struct sysfs_ops hyp_sysfs_ops = { .show = hyp_sysfs_show, .store = hyp_sysfs_store, };fs/btrfs/sysfs.c +2
-2@@ -164,12 +164,12 @@ static void btrfs_root_release(struct kobject *kobj)complete (&root->kobj_unregister); } -static struct sysfs_ops btrfs_super_attr_ops = { +static const struct sysfs_ops btrfs_super_attr_ops = { .show = btrfs_super_attr_show, .store = btrfs_super_attr_store, }; -static struct sysfs_ops btrfs_root_attr_ops = { +static const struct sysfs_ops btrfs_root_attr_ops = { .show = btrfs_root_attr_show, .store = btrfs_root_attr_store, };fs/dlm/lockspace.c +1
-1@@ -148,7 +148,7 @@ static void lockspace_kobj_release(struct kobject *k)kfree (ls); } -static struct sysfs_ops dlm_attr_ops = { +static const struct sysfs_ops dlm_attr_ops = { .show = dlm_attr_show, .store = dlm_attr_store, };fs/ext4/super.c +1
-1@@ -2251,7 +2251,7 @@ static void ext4_sb_release(struct kobject *kobj) } -static struct sysfs_ops ext4_attr_ops = { +static const struct sysfs_ops ext4_attr_ops = { .show = ext4_attr_show, .store = ext4_attr_store, };fs/gfs2/sys.c +1
-1@@ -49,7 +49,7 @@ static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,return a->store ? a->store (sdp, buf, len) : len; } -static struct sysfs_ops gfs2_attr_ops = { +static const struct sysfs_ops gfs2_attr_ops = { .show = gfs2_attr_show, .store = gfs2_attr_store, };fs/ocfs2/cluster/masklog.c +1
-1@@ -135,7 +135,7 @@ static ssize_t mlog_store(struct kobject *obj, struct attribute *attr,return mlog_mask_store (mlog_attr->mask, buf, count); } -static struct sysfs_ops mlog_attr_ops = { +static const struct sysfs_ops mlog_attr_ops = { .show = mlog_show, .store = mlog_store, };fs/sysfs/file.c +4
-4@@ -53,7 +53,7 @@ struct sysfs_buffer {size_t count;loff_t pos;char * page; -struct sysfs_ops * ops; +const struct sysfs_ops * ops;struct mutex mutex;int needs_read_fill;int event;@@ -75,7 +75,7 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int ret =0 ;ssize_t count;@@ -199,7 +199,7 @@ flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int rc;/* need attr_sd for attr and ops, its parent for kobj */ @@ -335,7 +335,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;struct sysfs_buffer *buffer; -struct sysfs_ops *ops; +const struct sysfs_ops *ops;int error = -EACCES ;char *p;include/linux/kobject.h +2
-2@@ -106,7 +106,7 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);struct kobj_type {void (*release)(struct kobject *kobj); -struct sysfs_ops *sysfs_ops; +const struct sysfs_ops *sysfs_ops;struct attribute **default_attrs; };@@ -132,7 +132,7 @@ struct kobj_attribute { const char *buf, size_t count); }; -extern struct sysfs_ops kobj_sysfs_ops; +extern const struct sysfs_ops kobj_sysfs_ops;/** * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. include/linux/sysfs.h +2
-2@@ -75,8 +75,8 @@ struct bin_attribute { };struct sysfs_ops { -ssize_t (*show)(struct kobject *,struct attribute *,char *); -ssize_t (*store)(struct kobject *,struct attribute *,const char *,size_t ); +ssize_t (*const show)(struct kobject *,struct attribute *,char *); +ssize_t (*const store)(struct kobject *,struct attribute *,const char *,size_t ); };struct sysfs_dirent ;kernel/params.c +1
-1@@ -725,7 +725,7 @@ static ssize_t module_attr_store(struct kobject *kobj,return ret; } -static struct sysfs_ops module_sysfs_ops = { +static const struct sysfs_ops module_sysfs_ops = { .show = module_attr_show, .store = module_attr_store, };lib/kobject.c +1
-1@@ -700,7 +700,7 @@ static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -struct sysfs_ops kobj_sysfs_ops = { +const struct sysfs_ops kobj_sysfs_ops = { .show = kobj_attr_show, .store = kobj_attr_store, };mm/slub.c +1
-1@@ -4503,7 +4503,7 @@ static void kmem_cache_release(struct kobject *kobj)kfree (s); } -static struct sysfs_ops slab_sysfs_ops = { +static const struct sysfs_ops slab_sysfs_ops = { .show = slab_attr_show, .store = slab_attr_store, };net/bridge/br_private.h +1
-1@@ -254,7 +254,7 @@ extern void br_ifinfo_notify(int event, struct net_bridge_port *port);#ifdef CONFIG_SYSFS /* br_sysfs_if.c */ -extern struct sysfs_ops brport_sysfs_ops; +extern const struct sysfs_ops brport_sysfs_ops;extern int br_sysfs_addif (struct net_bridge_port *p);/* br_sysfs_br.c */ net/bridge/br_sysfs_if.c +1
-1@@ -220,7 +220,7 @@ static ssize_t brport_store(struct kobject * kobj,return ret; } -struct sysfs_ops brport_sysfs_ops = { +const struct sysfs_ops brport_sysfs_ops = { .show = brport_show, .store = brport_store, };samples/kobject/kset-example.c +1
-1@@ -87,7 +87,7 @@ static ssize_t foo_attr_store(struct kobject *kobj, }/* Our custom sysfs_ops that we will associate with our ktype later on */ -static struct sysfs_ops foo_sysfs_ops = { +static const struct sysfs_ops foo_sysfs_ops = { .show = foo_attr_show, .store = foo_attr_store, };
Re: [PATCH 22/31] Constify struct neigh_ops for 2.6.32 v1
In reply to Emese RevfyAdded [email protected] to CC.
Quoted 34 lines
From: Emese Revfy <[email protected]>
Constify struct
neigh_ops.Signed-off-by Emese Revfy <[email protected]>--- include/net/neighbour.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)include/net/neighbour.h +6
-6@@ -125,12 +125,12 @@ struct neighbourstruct neigh_ops {int family; -void (*solicit)(struct neighbour *,struct sk_buff *); -void (*error_report)(struct neighbour *,struct sk_buff *); -int (*output)(struct sk_buff *); -int (*connected_output)(struct sk_buff *); -int (*hh_output)(struct sk_buff *); -int (*queue_xmit)(struct sk_buff *); +void (*const solicit)(struct neighbour *,struct sk_buff *); +void (*const error_report)(struct neighbour *,struct sk_buff *); +int (*const output)(struct sk_buff *); +int (*const connected_output)(struct sk_buff *); +int (*const hh_output)(struct sk_buff *); +int (*const queue_xmit)(struct sk_buff *); };struct pneigh_entry
Re: [PATCH 15/31] Constify struct iwl_ops for 2.6.32 v1
In reply to Emese RevfyAdded [email protected] and [email protected] to CC.
Quoted 102 lines
From: Emese Revfy <[email protected]>
Constify struct
iwl_ops.Signed-off-by Emese Revfy <[email protected]>--- drivers/net/wireless/iwlwifi/iwl-1000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.c | 2 +- drivers/net/wireless/iwlwifi/iwl-5000.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-6000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-dev.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)drivers/net/wireless/iwlwifi/iwl-1000.c +1
-1@@ -137,7 +137,7 @@ static struct iwl_lib_ops iwl1000_lib = { }, }; -static struct iwl_ops iwl1000_ops = { +static const struct iwl_ops iwl1000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl1000_lib, .hcmd = &iwl5000_hcmd,drivers/net/wireless/iwlwifi/iwl-3945.c +1
-1@@ -2876,7 +2876,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { .build_addsta_hcmd = iwl3945_build_addsta_hcmd, }; -static struct iwl_ops iwl3945_ops = { +static const struct iwl_ops iwl3945_ops = { .ucode = &iwl3945_ucode, .lib = &iwl3945_lib, .hcmd = &iwl3945_hcmd,drivers/net/wireless/iwlwifi/iwl-4965.c +1
-1@@ -2335,7 +2335,7 @@ static struct iwl_lib_ops iwl4965_lib = { }, }; -static struct iwl_ops iwl4965_ops = { +static const struct iwl_ops iwl4965_ops = { .ucode = &iwl4965_ucode, .lib = &iwl4965_lib, .hcmd = &iwl4965_hcmd,drivers/net/wireless/iwlwifi/iwl-5000.c +2
-2@@ -1627,14 +1627,14 @@ static struct iwl_lib_ops iwl5150_lib = { }, }; -struct iwl_ops iwl5000_ops = { +const struct iwl_ops iwl5000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl5000_lib, .hcmd = &iwl5000_hcmd, .utils = &iwl5000_hcmd_utils, }; -static struct iwl_ops iwl5150_ops = { +static const struct iwl_ops iwl5150_ops = { .ucode = &iwl5000_ucode, .lib = &iwl5150_lib, .hcmd = &iwl5000_hcmd,drivers/net/wireless/iwlwifi/iwl-6000.c +1
-1@@ -146,7 +146,7 @@ static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = { .calc_rssi = iwl5000_calc_rssi, }; -static struct iwl_ops iwl6000_ops = { +static const struct iwl_ops iwl6000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl6000_lib, .hcmd = &iwl5000_hcmd,drivers/net/wireless/iwlwifi/iwl-dev.h +1
-1@@ -67,7 +67,7 @@ struct iwl_tx_queue;/* shared structures from iwl-5000.c */ extern struct iwl_mod_params iwl50_mod_params; -extern struct iwl_ops iwl5000_ops; +extern const struct iwl_ops iwl5000_ops;extern struct iwl_ucode_ops iwl5000_ucode;extern struct iwl_lib_ops iwl5000_lib;extern struct iwl_hcmd_ops iwl5000_hcmd;
Re: [PATCH 11/31] Constify struct file_operations for 2.6.32 v1
In reply to Emese RevfyAdded [email protected] to CC.
Quoted 678 lines
From: Emese Revfy <[email protected]>
Constify struct
file_operationswith some exceptions.Signed-off-by Emese Revfy <[email protected]>--- drivers/acpi/battery.c | 2 +- drivers/char/pty.c | 16 +++++++++--- drivers/char/tty_io.c | 28 ++++----------------- drivers/media/dvb/dvb-core/dvbdev.c | 1 + drivers/net/wireless/b43/debugfs.c | 2 +- drivers/net/wireless/b43legacy/debugfs.c | 2 +- drivers/net/wireless/libertas/debugfs.c | 2 +- drivers/staging/b3dfg/b3dfg.c | 2 +- drivers/staging/dream/qdsp5/adsp_driver.c | 2 +- drivers/staging/dream/qdsp5/audio_aac.c | 2 +- drivers/staging/dream/qdsp5/audio_amrnb.c | 2 +- drivers/staging/dream/qdsp5/audio_evrc.c | 2 +- drivers/staging/dream/qdsp5/audio_in.c | 4 +- drivers/staging/dream/qdsp5/audio_mp3.c | 2 +- drivers/staging/dream/qdsp5/audio_out.c | 4 +- drivers/staging/dream/qdsp5/audio_qcelp.c | 2 +- drivers/staging/dream/qdsp5/snd.c | 2 +- drivers/staging/dream/smd/smd_qmi.c | 2 +- drivers/staging/dream/smd/smd_rpcrouter_device.c | 4 +- drivers/staging/panel/panel.c | 4 +- drivers/staging/poch/poch.c | 2 +- drivers/staging/sep/sep_driver.c | 2 +- drivers/staging/vme/devices/vme_user.c | 2 +- fs/fuse/cuse.c | 20 +++++++++------ fs/fuse/dev.c | 8 +++--- fs/fuse/fuse_i.h | 10 ++++++++ include/linux/tty.h | 14 ++++++++++- include/net/tcp.h | 1 + include/net/udp.h | 1 + kernel/trace/trace_events.c | 2 + virt/kvm/kvm_main.c | 3 ++ 31 files changed, 89 insertions(+), 63 deletions(-)drivers/acpi/battery.c +1
-1@@ -763,7 +763,7 @@ DECLARE_FILE_FUNCTIONS(alarm); }static struct battery_file { -struct file_operations ops; +const struct file_operations ops;mode_t mode;const char *name; } acpi_battery_file[] = {drivers/char/pty.c +12
-4@@ -682,7 +682,18 @@ static int ptmx_open(struct inode *inode, struct file *filp)return ret; } -static struct file_operations ptmx_fops; +static const struct file_operations ptmx_fops = { + .llseek = no_llseek, + .read = tty_read, + .write = tty_write, + .poll = tty_poll, + .unlocked_ioctl = tty_ioctl, + .compat_ioctl = tty_compat_ioctl, + .open = ptmx_open, + .release = tty_release, + .fasync = tty_fasync, +}; +static void __init unix98_pty_init (void ) {@@ -736,9 +747,6 @@ static void __init unix98_pty_init(void)register_sysctl_table (pty_root_table);/* Now create the /dev/ptmx special device */ -tty_default_fops (&ptmx_fops); - ptmx_fops.open = ptmx_open; -cdev_init (&ptmx_cdev, &ptmx_fops);if (cdev_add (&ptmx_cdev,MKDEV (TTYAUX_MAJOR ,2 ),1 ) ||register_chrdev_region (MKDEV (TTYAUX_MAJOR ,2 ),1 ,"/dev/ptmx" ) <0 )drivers/char/tty_io.c +6
-22@@ -136,21 +136,10 @@ LIST_HEAD(tty_drivers); /* linked list of tty drivers */DEFINE_MUTEX (tty_mutex);EXPORT_SYMBOL (tty_mutex); -static ssize_t tty_read (struct file *,char __user *,size_t ,loff_t *); -static ssize_t tty_write (struct file *,const char __user *,size_t ,loff_t *);ssize_t redirected_tty_write (struct file *,const char __user *,size_t ,loff_t *); -static unsigned int tty_poll (struct file *,poll_table *);static int tty_open (struct inode *,struct file *); -static int tty_release (struct inode *,struct file *);long tty_ioctl (struct file *file,unsigned int cmd,unsigned long arg); -#ifdef CONFIG_COMPAT -static long tty_compat_ioctl (struct file *file,unsigned int cmd, -unsigned long arg); -#else -#define tty_compat_ioctl NULL -#endif -static int tty_fasync (int fd,struct file *filp,int on);static void release_tty (struct tty_struct *tty,int idx);static void __proc_set_tty (struct task_struct *tsk,struct tty_struct *tty);static void proc_set_tty (struct task_struct *tsk,struct tty_struct *tty);@@ -870,7 +859,7 @@ EXPORT_SYMBOL(start_tty);* read calls may be outstanding in parallel. */ -static ssize_t tty_read (struct file *file,char __user *buf,size_t count, +ssize_t tty_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) {int i;@@ -1045,7 +1034,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)* write method will not be invoked in parallel for each device. */ -static ssize_t tty_write (struct file *file,const char __user *buf, +ssize_t tty_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) {struct tty_struct *tty;@@ -1865,7 +1854,7 @@ static int tty_open(struct inode *inode, struct file *filp)* Takes bkl. See tty_release_dev */ -static int tty_release (struct inode *inode,struct file *filp) +int tty_release (struct inode *inode,struct file *filp) {lock_kernel ();tty_release_dev (filp);@@ -1885,7 +1874,7 @@ static int tty_release(struct inode *inode, struct file *filp)* may be re-entered freely by other callers. */ -static unsigned int tty_poll (struct file *filp,poll_table *wait) +unsigned int tty_poll (struct file *filp,poll_table *wait) {struct tty_struct *tty;struct tty_ldisc *ld;@@ -1902,7 +1891,7 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)return ret; } -static int tty_fasync (int fd,struct file *filp,int on) +int tty_fasync (int fd,struct file *filp,int on) {struct tty_struct *tty;unsigned long flags;@@ -2579,7 +2568,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) }#ifdef CONFIG_COMPAT -static long tty_compat_ioctl (struct file *file,unsigned int cmd, +long tty_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct inode *inode = file->f_dentry->d_inode;@@ -3046,11 +3035,6 @@ struct tty_struct *get_current_tty(void) }EXPORT_SYMBOL_GPL (get_current_tty); -void tty_default_fops (struct file_operations *fops) -{ - *fops = tty_fops; -} -/* * Initialize the console device. This is called *early*, so * we can't necessarily depend on lots of kernel help here. drivers/media/dvb/dvb-core/dvbdev.c +1
-0@@ -191,6 +191,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, const struct dvb_device *template, void *priv, int type) { struct dvb_device *dvbdev; +/* cannot be const */ struct file_operations *dvbdevfops;struct device *clsdev;int minor;drivers/net/wireless/b43/debugfs.c +1
-1@@ -43,7 +43,7 @@ static struct dentry *rootdir;struct b43_debugfs_fops {ssize_t (*read)(struct b43_wldev *dev,char *buf,size_t bufsize);int (*write)(struct b43_wldev *dev,const char *buf,size_t count); -struct file_operations fops; +const struct file_operations fops;/* Offset of struct b43_dfs_file in struct b43_dfsentry */ size_t file_struct_offset; };drivers/net/wireless/b43legacy/debugfs.c +1
-1@@ -44,7 +44,7 @@ static struct dentry *rootdir;struct b43legacy_debugfs_fops {ssize_t (*read)(struct b43legacy_wldev *dev,char *buf,size_t bufsize);int (*write)(struct b43legacy_wldev *dev,const char *buf,size_t count); -struct file_operations fops; +const struct file_operations fops;/* Offset of struct b43legacy_dfs_file in struct b43legacy_dfsentry */ size_t file_struct_offset;/* Take wl->irq_lock before calling read/write? */ drivers/net/wireless/libertas/debugfs.c +1
-1@@ -708,7 +708,7 @@ out_unlock:struct lbs_debugfs_files {const char *name;int perm; -struct file_operations fops; +const struct file_operations fops; };static const struct lbs_debugfs_files debugfs_files[] = {drivers/staging/b3dfg/b3dfg.c +1
-1@@ -848,7 +848,7 @@ static int b3dfg_mmap(struct file *filp, struct vm_area_struct *vma)return r; } -static struct file_operations b3dfg_fops = { +static const struct file_operations b3dfg_fops = { .owner =THIS_MODULE , .open = b3dfg_open, .release = b3dfg_release,drivers/staging/dream/qdsp5/adsp_driver.c +1
-1@@ -576,7 +576,7 @@ static struct adsp_device *inode_to_device(struct inode *inode)static dev_t adsp_devno;static struct class *adsp_class; -static struct file_operations adsp_fops = { +static const struct file_operations adsp_fops = { .owner =THIS_MODULE , .open = adsp_open, .unlocked_ioctl = adsp_ioctl,drivers/staging/dream/qdsp5/audio_aac.c +1
-1@@ -1022,7 +1022,7 @@ done:return rc; } -static struct file_operations audio_aac_fops = { +static const struct file_operations audio_aac_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,drivers/staging/dream/qdsp5/audio_amrnb.c +1
-1@@ -833,7 +833,7 @@ done:return rc; } -static struct file_operations audio_amrnb_fops = { +static const struct file_operations audio_amrnb_fops = { .owner =THIS_MODULE , .open = audamrnb_open, .release = audamrnb_release,drivers/staging/dream/qdsp5/audio_evrc.c +1
-1@@ -805,7 +805,7 @@ dma_fail:return rc; } -static struct file_operations audio_evrc_fops = { +static const struct file_operations audio_evrc_fops = { .owner =THIS_MODULE , .open = audevrc_open, .release = audevrc_release,drivers/staging/dream/qdsp5/audio_in.c +2
-2@@ -913,7 +913,7 @@ static int audpre_open(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations audio_fops = { +static const struct file_operations audio_fops = { .owner =THIS_MODULE , .open = audio_in_open, .release = audio_in_release,@@ -922,7 +922,7 @@ static struct file_operations audio_fops = { .unlocked_ioctl = audio_in_ioctl, }; -static struct file_operations audpre_fops = { +static const struct file_operations audpre_fops = { .owner =THIS_MODULE , .open = audpre_open, .unlocked_ioctl = audpre_ioctl,drivers/staging/dream/qdsp5/audio_mp3.c +1
-1@@ -941,7 +941,7 @@ done:return rc; } -static struct file_operations audio_mp3_fops = { +static const struct file_operations audio_mp3_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,drivers/staging/dream/qdsp5/audio_out.c +2
-2@@ -810,7 +810,7 @@ static int audpp_open(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations audio_fops = { +static const struct file_operations audio_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,@@ -819,7 +819,7 @@ static struct file_operations audio_fops = { .unlocked_ioctl = audio_ioctl, }; -static struct file_operations audpp_fops = { +static const struct file_operations audpp_fops = { .owner =THIS_MODULE , .open = audpp_open, .unlocked_ioctl = audpp_ioctl,drivers/staging/dream/qdsp5/audio_qcelp.c +1
-1@@ -816,7 +816,7 @@ err:return rc; } -static struct file_operations audio_qcelp_fops = { +static const struct file_operations audio_qcelp_fops = { .owner =THIS_MODULE , .open = audqcelp_open, .release = audqcelp_release,drivers/staging/dream/qdsp5/snd.c +1
-1@@ -242,7 +242,7 @@ err:return rc; } -static struct file_operations snd_fops = { +static const struct file_operations snd_fops = { .owner =THIS_MODULE , .open = snd_open, .release = snd_release,drivers/staging/dream/smd/smd_qmi.c +1
-1@@ -793,7 +793,7 @@ static int qmi_release(struct inode *ip, struct file *fp)return 0 ; } -static struct file_operations qmi_fops = { +static const struct file_operations qmi_fops = { .owner =THIS_MODULE , .read = qmi_read, .write = qmi_write,drivers/staging/dream/smd/smd_rpcrouter_device.c +2
-2@@ -214,7 +214,7 @@ static long rpcrouter_ioctl(struct file *filp, unsigned int cmd,return rc; } -static struct file_operations rpcrouter_server_fops = { +static const struct file_operations rpcrouter_server_fops = { .owner =THIS_MODULE , .open = rpcrouter_open, .release = rpcrouter_release,@@ -224,7 +224,7 @@ static struct file_operations rpcrouter_server_fops = { .unlocked_ioctl = rpcrouter_ioctl, }; -static struct file_operations rpcrouter_router_fops = { +static const struct file_operations rpcrouter_router_fops = { .owner =THIS_MODULE , .open = rpcrouter_open, .release = rpcrouter_release,drivers/staging/panel/panel.c +2
-2@@ -1305,7 +1305,7 @@ static int lcd_release(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations lcd_fops = { +static const struct file_operations lcd_fops = { .write = lcd_write, .open = lcd_open, .release = lcd_release,@@ -1565,7 +1565,7 @@ static int keypad_release(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations keypad_fops = { +static const struct file_operations keypad_fops = { .read = keypad_read,/* read */ .open = keypad_open,/* open */ .release = keypad_release,/* close */ drivers/staging/poch/poch.c +1
-1@@ -1057,7 +1057,7 @@ static int poch_ioctl(struct inode *inode, struct file *filp,return 0 ; } -static struct file_operations poch_fops = { +static const struct file_operations poch_fops = { .owner =THIS_MODULE , .open = poch_open, .release = poch_release,drivers/staging/sep/sep_driver.c +1
-1@@ -2603,7 +2603,7 @@ static struct pci_driver sep_pci_driver = {static dev_t sep_devno;/* the files operations structure of the driver */ -static struct file_operations sep_file_operations = { +static const struct file_operations sep_file_operations = { .owner =THIS_MODULE , .ioctl = sep_ioctl, .poll = sep_poll,drivers/staging/vme/devices/vme_user.c +1
-1@@ -136,7 +136,7 @@ static int vme_user_ioctl(struct inode *, struct file *, unsigned int,static int __init vme_user_probe (struct device *,int ,int ); static int __exit vme_user_remove(struct device *, int, int); -static struct file_operations vme_user_fops = { +static const struct file_operations vme_user_fops = { .open = vme_user_open, .release = vme_user_release, .read = vme_user_read,fs/fuse/cuse.c +12
-8@@ -528,8 +528,18 @@ static int cuse_channel_release(struct inode *inode, struct file *file)return rc; } -static struct file_operations cuse_channel_fops;/* initialized during init */ - +static const struct file_operations cuse_channel_fops = {/* initialized during init */ + .owner =THIS_MODULE , + .llseek = no_llseek, + .read = do_sync_read, + .aio_read = fuse_dev_read, + .write = do_sync_write, + .aio_write = fuse_dev_write, + .poll = fuse_dev_poll, + .open = cuse_channel_open, + .release = cuse_channel_release, + .fasync = fuse_dev_fasync, +};/************************************************************************** * Misc stuff and module initializatiion @@ -575,12 +585,6 @@ static int __init cuse_init(void)for (i =0 ; i <CUSE_CONNTBL_LEN ; i++)INIT_LIST_HEAD (&cuse_conntbl[i]); -/* inherit and extend fuse_dev_operations */ - cuse_channel_fops = fuse_dev_operations; - cuse_channel_fops.owner =THIS_MODULE ; - cuse_channel_fops.open = cuse_channel_open; - cuse_channel_fops.release = cuse_channel_release; - cuse_class =class_create (THIS_MODULE ,"cuse" );if (IS_ERR (cuse_class))return PTR_ERR (cuse_class);fs/fuse/dev.c +4
-4@@ -745,7 +745,7 @@ __releases(&fc->lock)* request_end(). Otherwise add it to the processing list, and set * the 'sent' flag. */ -static ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov, +ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos) {int err;@@ -987,7 +987,7 @@ static int copy_out_args(struct fuse_copy_state *cs, struct fuse_out *out,* it from the list and copy the rest of the buffer to the request. * The request is finished by calling request_end() */ -static ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov, +ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos) {int err;@@ -1084,7 +1084,7 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,return err; } -static unsigned fuse_dev_poll (struct file *file,poll_table *wait) +unsigned fuse_dev_poll (struct file *file,poll_table *wait) {unsigned mask =POLLOUT |POLLWRNORM ;struct fuse_conn *fc =fuse_get_conn (file);@@ -1210,7 +1210,7 @@ int fuse_dev_release(struct inode *inode, struct file *file) }EXPORT_SYMBOL_GPL (fuse_dev_release); -static int fuse_dev_fasync (int fd,struct file *file,int on) +int fuse_dev_fasync (int fd,struct file *file,int on) {struct fuse_conn *fc =fuse_get_conn (file);if (!fc)fs/fuse/fuse_i.h +10
-0@@ -521,6 +521,16 @@ extern const struct file_operations fuse_dev_operations;extern const struct dentry_operations fuse_dentry_operations; +extern ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov, +unsigned long nr_segs,loff_t pos); + +extern ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov, +unsigned long nr_segs,loff_t pos); + +extern unsigned fuse_dev_poll (struct file *file,poll_table *wait); + +extern int fuse_dev_fasync (int fd,struct file *file,int on); +/** * Inode to nodeid comparison. */ include/linux/tty.h +13
-1@@ -13,6 +13,7 @@#include <linux/tty_driver.h> #include <linux/tty_ldisc.h> #include <linux/mutex.h> +#include <linux/poll.h> #include <asm/system.h> @@ -432,7 +433,6 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);extern dev_t tty_devnum (struct tty_struct *tty);extern void proc_clear_tty (struct task_struct *p);extern struct tty_struct *get_current_tty (void ); -extern void tty_default_fops (struct file_operations *fops);extern struct tty_struct *alloc_tty_struct (void );extern void free_tty_struct (struct tty_struct *tty); extern void initialize_tty_struct(struct tty_struct *tty,@@ -482,6 +482,18 @@ extern void tty_ldisc_begin(void);/* This last one is just for the tty layer internals and shouldn't be used elsewhere */ extern void tty_ldisc_enable (struct tty_struct *tty); +/* tty_io.c */ +extern ssize_t tty_read (struct file *,char __user *,size_t ,loff_t *); +extern ssize_t tty_write (struct file *,const char __user *,size_t ,loff_t *); +extern unsigned int tty_poll (struct file *,poll_table *); +#ifdef CONFIG_COMPAT +extern long tty_compat_ioctl (struct file *file,unsigned int cmd, +unsigned long arg); +#else +#define tty_compat_ioctl NULL +#endif +extern int tty_release (struct inode *,struct file *); +extern int tty_fasync (int fd,struct file *filp,int on);/* n_tty.c */ extern struct tty_ldisc_ops tty_ldisc_N_TTY;include/net/tcp.h +1
-0@@ -1414,6 +1414,7 @@ enum tcp_seq_states {struct tcp_seq_afinfo {char *name;sa_family_t family; +/* cannot be const */ struct file_operations seq_fops;struct seq_operations seq_ops; };include/net/udp.h +1
-0@@ -187,6 +187,7 @@ struct udp_seq_afinfo {char *name;sa_family_t family;struct udp_table *udp_table; +/* cannot be const */ struct file_operations seq_fops;struct seq_operations seq_ops; };kernel/trace/trace_events.c +2
-0@@ -951,6 +951,8 @@ static LIST_HEAD(ftrace_module_file_list);* Modules must own their file_operations to keep up with * reference counting. */ + +/* cannot be const */ struct ftrace_module_file_ops {struct list_head list;struct module *mod;virt/kvm/kvm_main.c +3
-0@@ -1745,6 +1745,7 @@ static int kvm_vcpu_release(struct inode *inode, struct file *filp)return 0 ; } +/* cannot be const */ static struct file_operations kvm_vcpu_fops = { .release = kvm_vcpu_release, .unlocked_ioctl = kvm_vcpu_ioctl,@@ -2341,6 +2342,7 @@ static int kvm_vm_mmap(struct file *file, struct vm_area_struct *vma)return 0 ; } +/* cannot be const */ static struct file_operations kvm_vm_fops = { .release = kvm_vm_release, .unlocked_ioctl = kvm_vm_ioctl,@@ -2428,6 +2430,7 @@ out:return r; } +/* cannot be const */ static struct file_operations kvm_chardev_ops = { .unlocked_ioctl = kvm_dev_ioctl, .compat_ioctl = kvm_dev_ioctl,
David Miller
maintainerRe: [PATCH 22/31] Constify struct neigh_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Date: Sat, 05 Dec 2009 00:02:48 +0100
Quoted 1 line
Added [email protected] to CC.
It is better to make the proper patch posting again to netdev, otherwise your patch will not get tracked and watched over at patchwork.ozlabs.org
Re: [PATCH 29/31] Constify struct sysfs_ops for 2.6.32 v1
In reply to Emese RevfyQuoted 5 lines · On Fri, 04 Dec 2009 23:49:06 +0100 Emese Revfy <[email protected]> wrote:
From: Emese Revfy <[email protected]>
Constify struct
sysfs_ops.Signed-off-by Emese Revfy <[email protected]>
Re: [PATCH 22/31] Constify struct neigh_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct neigh_ops.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- include/net/neighbour.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
include/net/neighbour.h +6 -6
@@ -125,12 +125,12 @@ struct neighbourstruct neigh_ops {int family; -void (*solicit)(struct neighbour *,struct sk_buff *); -void (*error_report)(struct neighbour *,struct sk_buff *); -int (*output)(struct sk_buff *); -int (*connected_output)(struct sk_buff *); -int (*hh_output)(struct sk_buff *); -int (*queue_xmit)(struct sk_buff *); +void (*const solicit)(struct neighbour *,struct sk_buff *); +void (*const error_report)(struct neighbour *,struct sk_buff *); +int (*const output)(struct sk_buff *); +int (*const connected_output)(struct sk_buff *); +int (*const hh_output)(struct sk_buff *); +int (*const queue_xmit)(struct sk_buff *); };struct pneigh_entry
Re: [PATCH 08/31] Constify struct e1000_phy_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_phy_operations.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- drivers/net/e1000e/82571.c | 6 +++--- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/e1000e/82571.c +3 -3
@@ -1674,7 +1674,7 @@ static struct e1000_mac_operations e82571_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations e82_phy_ops_igp = { +static const struct e1000_phy_operations e82_phy_ops_igp = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy =NULL ,
@@ -1691,7 +1691,7 @@ static struct e1000_phy_operations e82_phy_ops_igp = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_m88 = { +static const struct e1000_phy_operations e82_phy_ops_m88 = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
@@ -1708,7 +1708,7 @@ static struct e1000_phy_operations e82_phy_ops_m88 = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_bm = { +static const struct e1000_phy_operations e82_phy_ops_bm = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
drivers/net/e1000e/e1000.h +1 -1
@@ -376,7 +376,7 @@ struct e1000_info {u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
drivers/net/e1000e/es2lan.c +1 -1
@@ -1383,7 +1383,7 @@ static struct e1000_mac_operations es2_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations es2_phy_ops = { +static const struct e1000_phy_operations es2_phy_ops = { .acquire_phy = e1000_acquire_phy_80003es2lan, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3469,7 +3469,7 @@ static struct e1000_mac_operations ich8_mac_ops = {/* id_led_init dependent on mac type */ }; -static struct e1000_phy_operations ich8_phy_ops = { +static const struct e1000_phy_operations ich8_phy_ops = { .acquire_phy = e1000_acquire_swflag_ich8lan, .check_reset_block = e1000_check_reset_block_ich8lan, .commit_phy =NULL ,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1409,7 +1409,7 @@ static struct e1000_mac_operations e1000_mac_ops_82575 = { .get_speed_and_duplex = igb_get_speed_and_duplex_copper, }; -static struct e1000_phy_operations e1000_phy_ops_82575 = { +static const struct e1000_phy_operations e1000_phy_ops_82575 = { .acquire = igb_acquire_phy_82575, .get_cfg_done = igb_get_cfg_done_82575, .release = igb_release_phy_82575,
drivers/net/igb/e1000_hw.h +1 -1
@@ -311,7 +311,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
Re: [PATCH 06/31] Constify struct e1000_mac_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_mac_operations with some exceptions.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- drivers/net/e1000e/82571.c | 3 ++- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 3 ++- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/e1000e/82571.c +2 -1
@@ -212,6 +212,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;u32 swsm =0 ;u32 swsm2 =0 ;
@@ -1656,7 +1657,7 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations e82571_mac_ops = { +static const struct e1000_mac_operations e82571_mac_ops = {/* .check_mng_mode: mac type dependent */ /* .check_for_link: media type dependent */ .id_led_init = e1000e_id_led_init,
drivers/net/e1000e/e1000.h +1 -1
@@ -375,7 +375,7 @@ struct e1000_info {u32 pba;u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
drivers/net/e1000e/es2lan.c +2 -1
@@ -207,6 +207,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;/* Set media type */
@@ -1365,7 +1366,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations es2_mac_ops = { +static const struct e1000_mac_operations es2_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000e_check_mng_mode_generic,/* check_for_link dependent on media type */
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3451,7 +3451,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) } } -static struct e1000_mac_operations ich8_mac_ops = { +static const struct e1000_mac_operations ich8_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000_check_mng_mode_ich8lan, .check_for_link = e1000_check_for_copper_link_ich8lan,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1400,7 +1400,7 @@ void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable)wr32 (E1000_VT_CTL , vt_ctl); } -static struct e1000_mac_operations e1000_mac_ops_82575 = { +static const struct e1000_mac_operations e1000_mac_ops_82575 = { .reset_hw = igb_reset_hw_82575, .init_hw = igb_init_hw_82575, .check_for_link = igb_check_for_link_82575,
drivers/net/igb/e1000_hw.h +1 -1
@@ -310,7 +310,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
Re: [PATCH 08/31] Constify struct e1000_phy_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_phy_operations.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- drivers/net/e1000e/82571.c | 6 +++--- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/e1000e/82571.c +3 -3
@@ -1674,7 +1674,7 @@ static struct e1000_mac_operations e82571_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations e82_phy_ops_igp = { +static const struct e1000_phy_operations e82_phy_ops_igp = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy =NULL ,
@@ -1691,7 +1691,7 @@ static struct e1000_phy_operations e82_phy_ops_igp = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_m88 = { +static const struct e1000_phy_operations e82_phy_ops_m88 = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
@@ -1708,7 +1708,7 @@ static struct e1000_phy_operations e82_phy_ops_m88 = { .cfg_on_link_up = NULL, }; -static struct e1000_phy_operations e82_phy_ops_bm = { +static const struct e1000_phy_operations e82_phy_ops_bm = { .acquire_phy = e1000_get_hw_semaphore_82571, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
drivers/net/e1000e/e1000.h +1 -1
@@ -376,7 +376,7 @@ struct e1000_info {u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
drivers/net/e1000e/es2lan.c +1 -1
@@ -1383,7 +1383,7 @@ static struct e1000_mac_operations es2_mac_ops = { .setup_led = e1000e_setup_led_generic, }; -static struct e1000_phy_operations es2_phy_ops = { +static const struct e1000_phy_operations es2_phy_ops = { .acquire_phy = e1000_acquire_phy_80003es2lan, .check_reset_block = e1000e_check_reset_block_generic, .commit_phy = e1000e_phy_sw_reset,
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3469,7 +3469,7 @@ static struct e1000_mac_operations ich8_mac_ops = {/* id_led_init dependent on mac type */ }; -static struct e1000_phy_operations ich8_phy_ops = { +static const struct e1000_phy_operations ich8_phy_ops = { .acquire_phy = e1000_acquire_swflag_ich8lan, .check_reset_block = e1000_check_reset_block_ich8lan, .commit_phy =NULL ,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1409,7 +1409,7 @@ static struct e1000_mac_operations e1000_mac_ops_82575 = { .get_speed_and_duplex = igb_get_speed_and_duplex_copper, }; -static struct e1000_phy_operations e1000_phy_ops_82575 = { +static const struct e1000_phy_operations e1000_phy_ops_82575 = { .acquire = igb_acquire_phy_82575, .get_cfg_done = igb_get_cfg_done_82575, .release = igb_release_phy_82575,
drivers/net/igb/e1000_hw.h +1 -1
@@ -311,7 +311,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *);struct e1000_mac_operations *mac_ops; -struct e1000_phy_operations *phy_ops; +const struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
Re: [PATCH 07/31] Constify struct e1000_nvm_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_nvm_operations.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- drivers/net/e1000e/82571.c | 2 +- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 2 +- drivers/net/e1000e/hw.h | 16 ++++++++-------- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 12 ++++++------ 7 files changed, 19 insertions(+), 19 deletions(-)
drivers/net/e1000e/82571.c +1 -1
@@ -1725,7 +1725,7 @@ static struct e1000_phy_operations e82_phy_ops_bm = { .cfg_on_link_up = NULL, }; -static struct e1000_nvm_operations e82571_nvm_ops = { +static const struct e1000_nvm_operations e82571_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_82571, .read_nvm = e1000e_read_nvm_eerd, .release_nvm = e1000_release_nvm_82571,
drivers/net/e1000e/e1000.h +1 -1
@@ -377,7 +377,7 @@ struct e1000_info {s32 (*get_variants)(struct e1000_adapter *);struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops; -struct e1000_nvm_operations *nvm_ops; +const struct e1000_nvm_operations *nvm_ops; };/* hardware capability, feature, and workaround flags */
drivers/net/e1000e/es2lan.c +1 -1
@@ -1400,7 +1400,7 @@ static struct e1000_phy_operations es2_phy_ops = { .cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan, }; -static struct e1000_nvm_operations es2_nvm_ops = { +static const struct e1000_nvm_operations es2_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_80003es2lan, .read_nvm = e1000e_read_nvm_eerd, .release_nvm = e1000_release_nvm_80003es2lan,
drivers/net/e1000e/hw.h +8 -8
@@ -776,13 +776,13 @@ struct e1000_phy_operations {/* Function pointers for the NVM. */ struct e1000_nvm_operations { -s32 (*acquire_nvm)(struct e1000_hw *); -s32 (*read_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); -void (*release_nvm)(struct e1000_hw *); -s32 (*update_nvm)(struct e1000_hw *); -s32 (*valid_led_default)(struct e1000_hw *,u16 *); -s32 (*validate_nvm)(struct e1000_hw *); -s32 (*write_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); +s32 (*const acquire_nvm)(struct e1000_hw *); +s32 (*const read_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); +void (*const release_nvm)(struct e1000_hw *); +s32 (*const update_nvm)(struct e1000_hw *); +s32 (*const valid_led_default)(struct e1000_hw *,u16 *); +s32 (*const validate_nvm)(struct e1000_hw *); +s32 (*const write_nvm)(struct e1000_hw *,u16 ,u16 ,u16 *); };struct e1000_mac_info {
@@ -856,7 +856,7 @@ struct e1000_phy_info { };struct e1000_nvm_info { -struct e1000_nvm_operations ops; +const struct e1000_nvm_operations ops;enum e1000_nvm_type type;enum e1000_nvm_override override;
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3485,7 +3485,7 @@ static struct e1000_phy_operations ich8_phy_ops = { .write_phy_reg = e1000e_write_phy_reg_igp, }; -static struct e1000_nvm_operations ich8_nvm_ops = { +static const struct e1000_nvm_operations ich8_nvm_ops = { .acquire_nvm = e1000_acquire_nvm_ich8lan, .read_nvm = e1000_read_nvm_ich8lan, .release_nvm = e1000_release_nvm_ich8lan,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1415,7 +1415,7 @@ static struct e1000_phy_operations e1000_phy_ops_82575 = { .release = igb_release_phy_82575, }; -static struct e1000_nvm_operations e1000_nvm_ops_82575 = { +static const struct e1000_nvm_operations e1000_nvm_ops_82575 = { .acquire = igb_acquire_nvm_82575, .read = igb_read_nvm_eerd, .release = igb_release_nvm_82575,
drivers/net/igb/e1000_hw.h +6 -6
@@ -302,17 +302,17 @@ struct e1000_phy_operations { };struct e1000_nvm_operations { -s32 (*acquire)(struct e1000_hw *); -s32 (*read)(struct e1000_hw *,u16 ,u16 ,u16 *); -void (*release)(struct e1000_hw *); -s32 (*write)(struct e1000_hw *,u16 ,u16 ,u16 *); +s32 (*const acquire)(struct e1000_hw *); +s32 (*const read)(struct e1000_hw *,u16 ,u16 ,u16 *); +void (*const release)(struct e1000_hw *); +s32 (*const write)(struct e1000_hw *,u16 ,u16 ,u16 *); };struct e1000_info {s32 (*get_invariants)(struct e1000_hw *);struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops; -struct e1000_nvm_operations *nvm_ops; +const struct e1000_nvm_operations *nvm_ops; };extern const struct e1000_info e1000_82575_info;
@@ -397,7 +397,7 @@ struct e1000_phy_info { };struct e1000_nvm_info { -struct e1000_nvm_operations ops; +const struct e1000_nvm_operations ops;enum e1000_nvm_type type;enum e1000_nvm_override override;
Re: [PATCH 06/31] Constify struct e1000_mac_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct e1000_mac_operations with some exceptions.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- drivers/net/e1000e/82571.c | 3 ++- drivers/net/e1000e/e1000.h | 2 +- drivers/net/e1000e/es2lan.c | 3 ++- drivers/net/e1000e/ich8lan.c | 2 +- drivers/net/igb/e1000_82575.c | 2 +- drivers/net/igb/e1000_hw.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/e1000e/82571.c +2 -1
@@ -212,6 +212,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;u32 swsm =0 ;u32 swsm2 =0 ;
@@ -1656,7 +1657,7 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations e82571_mac_ops = { +static const struct e1000_mac_operations e82571_mac_ops = {/* .check_mng_mode: mac type dependent */ /* .check_for_link: media type dependent */ .id_led_init = e1000e_id_led_init,
drivers/net/e1000e/e1000.h +1 -1
@@ -375,7 +375,7 @@ struct e1000_info {u32 pba;u32 max_hw_frame_size;s32 (*get_variants)(struct e1000_adapter *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
drivers/net/e1000e/es2lan.c +2 -1
@@ -207,6 +207,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;/* Set media type */
@@ -1365,7 +1366,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) temp =er32 (ICRXDMTC ); } -static struct e1000_mac_operations es2_mac_ops = { +static const struct e1000_mac_operations es2_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000e_check_mng_mode_generic,/* check_for_link dependent on media type */
drivers/net/e1000e/ich8lan.c +1 -1
@@ -3451,7 +3451,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) } } -static struct e1000_mac_operations ich8_mac_ops = { +static const struct e1000_mac_operations ich8_mac_ops = { .id_led_init = e1000e_id_led_init, .check_mng_mode = e1000_check_mng_mode_ich8lan, .check_for_link = e1000_check_for_copper_link_ich8lan,
drivers/net/igb/e1000_82575.c +1 -1
@@ -1400,7 +1400,7 @@ void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable)wr32 (E1000_VT_CTL , vt_ctl); } -static struct e1000_mac_operations e1000_mac_ops_82575 = { +static const struct e1000_mac_operations e1000_mac_ops_82575 = { .reset_hw = igb_reset_hw_82575, .init_hw = igb_init_hw_82575, .check_for_link = igb_check_for_link_82575,
drivers/net/igb/e1000_hw.h +1 -1
@@ -310,7 +310,7 @@ struct e1000_nvm_operations {struct e1000_info {s32 (*get_invariants)(struct e1000_hw *); -struct e1000_mac_operations *mac_ops; +const struct e1000_mac_operations *mac_ops;struct e1000_phy_operations *phy_ops;struct e1000_nvm_operations *nvm_ops; };
Re: [PATCH 11/31] Constify struct file_operations for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct file_operations with some exceptions.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- drivers/acpi/battery.c | 2 +- drivers/char/pty.c | 16 +++++++++--- drivers/char/tty_io.c | 28 ++++----------------- drivers/media/dvb/dvb-core/dvbdev.c | 1 + drivers/net/wireless/b43/debugfs.c | 2 +- drivers/net/wireless/b43legacy/debugfs.c | 2 +- drivers/net/wireless/libertas/debugfs.c | 2 +- drivers/staging/b3dfg/b3dfg.c | 2 +- drivers/staging/dream/qdsp5/adsp_driver.c | 2 +- drivers/staging/dream/qdsp5/audio_aac.c | 2 +- drivers/staging/dream/qdsp5/audio_amrnb.c | 2 +- drivers/staging/dream/qdsp5/audio_evrc.c | 2 +- drivers/staging/dream/qdsp5/audio_in.c | 4 +- drivers/staging/dream/qdsp5/audio_mp3.c | 2 +- drivers/staging/dream/qdsp5/audio_out.c | 4 +- drivers/staging/dream/qdsp5/audio_qcelp.c | 2 +- drivers/staging/dream/qdsp5/snd.c | 2 +- drivers/staging/dream/smd/smd_qmi.c | 2 +- drivers/staging/dream/smd/smd_rpcrouter_device.c | 4 +- drivers/staging/panel/panel.c | 4 +- drivers/staging/poch/poch.c | 2 +- drivers/staging/sep/sep_driver.c | 2 +- drivers/staging/vme/devices/vme_user.c | 2 +- fs/fuse/cuse.c | 20 +++++++++------ fs/fuse/dev.c | 8 +++--- fs/fuse/fuse_i.h | 10 ++++++++ include/linux/tty.h | 14 ++++++++++- include/net/tcp.h | 1 + include/net/udp.h | 1 + kernel/trace/trace_events.c | 2 + virt/kvm/kvm_main.c | 3 ++ 31 files changed, 89 insertions(+), 63 deletions(-)
drivers/acpi/battery.c +1 -1
@@ -763,7 +763,7 @@ DECLARE_FILE_FUNCTIONS(alarm); }static struct battery_file { -struct file_operations ops; +const struct file_operations ops;mode_t mode;const char *name; } acpi_battery_file[] = {
drivers/char/pty.c +12 -4
@@ -682,7 +682,18 @@ static int ptmx_open(struct inode *inode, struct file *filp)return ret; } -static struct file_operations ptmx_fops; +static const struct file_operations ptmx_fops = { + .llseek = no_llseek, + .read = tty_read, + .write = tty_write, + .poll = tty_poll, + .unlocked_ioctl = tty_ioctl, + .compat_ioctl = tty_compat_ioctl, + .open = ptmx_open, + .release = tty_release, + .fasync = tty_fasync, +}; +static void __init unix98_pty_init (void ) {
@@ -736,9 +747,6 @@ static void __init unix98_pty_init(void)register_sysctl_table (pty_root_table);/* Now create the /dev/ptmx special device */ -tty_default_fops (&ptmx_fops); - ptmx_fops.open = ptmx_open; -cdev_init (&ptmx_cdev, &ptmx_fops);if (cdev_add (&ptmx_cdev,MKDEV (TTYAUX_MAJOR ,2 ),1 ) ||register_chrdev_region (MKDEV (TTYAUX_MAJOR ,2 ),1 ,"/dev/ptmx" ) <0 )
drivers/char/tty_io.c +6 -22
@@ -136,21 +136,10 @@ LIST_HEAD(tty_drivers); /* linked list of tty drivers */DEFINE_MUTEX (tty_mutex);EXPORT_SYMBOL (tty_mutex); -static ssize_t tty_read (struct file *,char __user *,size_t ,loff_t *); -static ssize_t tty_write (struct file *,const char __user *,size_t ,loff_t *);ssize_t redirected_tty_write (struct file *,const char __user *,size_t ,loff_t *); -static unsigned int tty_poll (struct file *,poll_table *);static int tty_open (struct inode *,struct file *); -static int tty_release (struct inode *,struct file *);long tty_ioctl (struct file *file,unsigned int cmd,unsigned long arg); -#ifdef CONFIG_COMPAT -static long tty_compat_ioctl (struct file *file,unsigned int cmd, -unsigned long arg); -#else -#define tty_compat_ioctl NULL -#endif -static int tty_fasync (int fd,struct file *filp,int on);static void release_tty (struct tty_struct *tty,int idx);static void __proc_set_tty (struct task_struct *tsk,struct tty_struct *tty);static void proc_set_tty (struct task_struct *tsk,struct tty_struct *tty);
@@ -870,7 +859,7 @@ EXPORT_SYMBOL(start_tty);* read calls may be outstanding in parallel. */ -static ssize_t tty_read (struct file *file,char __user *buf,size_t count, +ssize_t tty_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) {int i;
@@ -1045,7 +1034,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)* write method will not be invoked in parallel for each device. */ -static ssize_t tty_write (struct file *file,const char __user *buf, +ssize_t tty_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) {struct tty_struct *tty;
@@ -1865,7 +1854,7 @@ static int tty_open(struct inode *inode, struct file *filp)* Takes bkl. See tty_release_dev */ -static int tty_release (struct inode *inode,struct file *filp) +int tty_release (struct inode *inode,struct file *filp) {lock_kernel ();tty_release_dev (filp);
@@ -1885,7 +1874,7 @@ static int tty_release(struct inode *inode, struct file *filp)* may be re-entered freely by other callers. */ -static unsigned int tty_poll (struct file *filp,poll_table *wait) +unsigned int tty_poll (struct file *filp,poll_table *wait) {struct tty_struct *tty;struct tty_ldisc *ld;
@@ -1902,7 +1891,7 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)return ret; } -static int tty_fasync (int fd,struct file *filp,int on) +int tty_fasync (int fd,struct file *filp,int on) {struct tty_struct *tty;unsigned long flags;
@@ -2579,7 +2568,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) }#ifdef CONFIG_COMPAT -static long tty_compat_ioctl (struct file *file,unsigned int cmd, +long tty_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct inode *inode = file->f_dentry->d_inode;
@@ -3046,11 +3035,6 @@ struct tty_struct *get_current_tty(void) }EXPORT_SYMBOL_GPL (get_current_tty); -void tty_default_fops (struct file_operations *fops) -{ - *fops = tty_fops; -} -/* * Initialize the console device. This is called *early*, so * we can't necessarily depend on lots of kernel help here.
drivers/media/dvb/dvb-core/dvbdev.c +1 -0
@@ -191,6 +191,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, const struct dvb_device *template, void *priv, int type) { struct dvb_device *dvbdev; +/* cannot be const */ struct file_operations *dvbdevfops;struct device *clsdev;int minor;
drivers/net/wireless/b43/debugfs.c +1 -1
@@ -43,7 +43,7 @@ static struct dentry *rootdir;struct b43_debugfs_fops {ssize_t (*read)(struct b43_wldev *dev,char *buf,size_t bufsize);int (*write)(struct b43_wldev *dev,const char *buf,size_t count); -struct file_operations fops; +const struct file_operations fops;/* Offset of struct b43_dfs_file in struct b43_dfsentry */ size_t file_struct_offset; };
drivers/net/wireless/b43legacy/debugfs.c +1 -1
@@ -44,7 +44,7 @@ static struct dentry *rootdir;struct b43legacy_debugfs_fops {ssize_t (*read)(struct b43legacy_wldev *dev,char *buf,size_t bufsize);int (*write)(struct b43legacy_wldev *dev,const char *buf,size_t count); -struct file_operations fops; +const struct file_operations fops;/* Offset of struct b43legacy_dfs_file in struct b43legacy_dfsentry */ size_t file_struct_offset;/* Take wl->irq_lock before calling read/write? */
drivers/net/wireless/libertas/debugfs.c +1 -1
@@ -708,7 +708,7 @@ out_unlock:struct lbs_debugfs_files {const char *name;int perm; -struct file_operations fops; +const struct file_operations fops; };static const struct lbs_debugfs_files debugfs_files[] = {
drivers/staging/b3dfg/b3dfg.c +1 -1
@@ -848,7 +848,7 @@ static int b3dfg_mmap(struct file *filp, struct vm_area_struct *vma)return r; } -static struct file_operations b3dfg_fops = { +static const struct file_operations b3dfg_fops = { .owner =THIS_MODULE , .open = b3dfg_open, .release = b3dfg_release,
drivers/staging/dream/qdsp5/adsp_driver.c +1 -1
@@ -576,7 +576,7 @@ static struct adsp_device *inode_to_device(struct inode *inode)static dev_t adsp_devno;static struct class *adsp_class; -static struct file_operations adsp_fops = { +static const struct file_operations adsp_fops = { .owner =THIS_MODULE , .open = adsp_open, .unlocked_ioctl = adsp_ioctl,
drivers/staging/dream/qdsp5/audio_aac.c +1 -1
@@ -1022,7 +1022,7 @@ done:return rc; } -static struct file_operations audio_aac_fops = { +static const struct file_operations audio_aac_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,
drivers/staging/dream/qdsp5/audio_amrnb.c +1 -1
@@ -833,7 +833,7 @@ done:return rc; } -static struct file_operations audio_amrnb_fops = { +static const struct file_operations audio_amrnb_fops = { .owner =THIS_MODULE , .open = audamrnb_open, .release = audamrnb_release,
drivers/staging/dream/qdsp5/audio_evrc.c +1 -1
@@ -805,7 +805,7 @@ dma_fail:return rc; } -static struct file_operations audio_evrc_fops = { +static const struct file_operations audio_evrc_fops = { .owner =THIS_MODULE , .open = audevrc_open, .release = audevrc_release,
drivers/staging/dream/qdsp5/audio_in.c +2 -2
@@ -913,7 +913,7 @@ static int audpre_open(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations audio_fops = { +static const struct file_operations audio_fops = { .owner =THIS_MODULE , .open = audio_in_open, .release = audio_in_release,
@@ -922,7 +922,7 @@ static struct file_operations audio_fops = { .unlocked_ioctl = audio_in_ioctl, }; -static struct file_operations audpre_fops = { +static const struct file_operations audpre_fops = { .owner =THIS_MODULE , .open = audpre_open, .unlocked_ioctl = audpre_ioctl,
drivers/staging/dream/qdsp5/audio_mp3.c +1 -1
@@ -941,7 +941,7 @@ done:return rc; } -static struct file_operations audio_mp3_fops = { +static const struct file_operations audio_mp3_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,
drivers/staging/dream/qdsp5/audio_out.c +2 -2
@@ -810,7 +810,7 @@ static int audpp_open(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations audio_fops = { +static const struct file_operations audio_fops = { .owner =THIS_MODULE , .open = audio_open, .release = audio_release,
@@ -819,7 +819,7 @@ static struct file_operations audio_fops = { .unlocked_ioctl = audio_ioctl, }; -static struct file_operations audpp_fops = { +static const struct file_operations audpp_fops = { .owner =THIS_MODULE , .open = audpp_open, .unlocked_ioctl = audpp_ioctl,
drivers/staging/dream/qdsp5/audio_qcelp.c +1 -1
@@ -816,7 +816,7 @@ err:return rc; } -static struct file_operations audio_qcelp_fops = { +static const struct file_operations audio_qcelp_fops = { .owner =THIS_MODULE , .open = audqcelp_open, .release = audqcelp_release,
drivers/staging/dream/qdsp5/snd.c +1 -1
@@ -242,7 +242,7 @@ err:return rc; } -static struct file_operations snd_fops = { +static const struct file_operations snd_fops = { .owner =THIS_MODULE , .open = snd_open, .release = snd_release,
drivers/staging/dream/smd/smd_qmi.c +1 -1
@@ -793,7 +793,7 @@ static int qmi_release(struct inode *ip, struct file *fp)return 0 ; } -static struct file_operations qmi_fops = { +static const struct file_operations qmi_fops = { .owner =THIS_MODULE , .read = qmi_read, .write = qmi_write,
drivers/staging/dream/smd/smd_rpcrouter_device.c +2 -2
@@ -214,7 +214,7 @@ static long rpcrouter_ioctl(struct file *filp, unsigned int cmd,return rc; } -static struct file_operations rpcrouter_server_fops = { +static const struct file_operations rpcrouter_server_fops = { .owner =THIS_MODULE , .open = rpcrouter_open, .release = rpcrouter_release,
@@ -224,7 +224,7 @@ static struct file_operations rpcrouter_server_fops = { .unlocked_ioctl = rpcrouter_ioctl, }; -static struct file_operations rpcrouter_router_fops = { +static const struct file_operations rpcrouter_router_fops = { .owner =THIS_MODULE , .open = rpcrouter_open, .release = rpcrouter_release,
drivers/staging/panel/panel.c +2 -2
@@ -1305,7 +1305,7 @@ static int lcd_release(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations lcd_fops = { +static const struct file_operations lcd_fops = { .write = lcd_write, .open = lcd_open, .release = lcd_release,
@@ -1565,7 +1565,7 @@ static int keypad_release(struct inode *inode, struct file *file)return 0 ; } -static struct file_operations keypad_fops = { +static const struct file_operations keypad_fops = { .read = keypad_read,/* read */ .open = keypad_open,/* open */ .release = keypad_release,/* close */
drivers/staging/poch/poch.c +1 -1
@@ -1057,7 +1057,7 @@ static int poch_ioctl(struct inode *inode, struct file *filp,return 0 ; } -static struct file_operations poch_fops = { +static const struct file_operations poch_fops = { .owner =THIS_MODULE , .open = poch_open, .release = poch_release,
drivers/staging/sep/sep_driver.c +1 -1
@@ -2603,7 +2603,7 @@ static struct pci_driver sep_pci_driver = {static dev_t sep_devno;/* the files operations structure of the driver */ -static struct file_operations sep_file_operations = { +static const struct file_operations sep_file_operations = { .owner =THIS_MODULE , .ioctl = sep_ioctl, .poll = sep_poll,
drivers/staging/vme/devices/vme_user.c +1 -1
@@ -136,7 +136,7 @@ static int vme_user_ioctl(struct inode *, struct file *, unsigned int,static int __init vme_user_probe (struct device *,int ,int ); static int __exit vme_user_remove(struct device *, int, int); -static struct file_operations vme_user_fops = { +static const struct file_operations vme_user_fops = { .open = vme_user_open, .release = vme_user_release, .read = vme_user_read,
fs/fuse/cuse.c +12 -8
@@ -528,8 +528,18 @@ static int cuse_channel_release(struct inode *inode, struct file *file)return rc; } -static struct file_operations cuse_channel_fops;/* initialized during init */ - +static const struct file_operations cuse_channel_fops = {/* initialized during init */ + .owner =THIS_MODULE , + .llseek = no_llseek, + .read = do_sync_read, + .aio_read = fuse_dev_read, + .write = do_sync_write, + .aio_write = fuse_dev_write, + .poll = fuse_dev_poll, + .open = cuse_channel_open, + .release = cuse_channel_release, + .fasync = fuse_dev_fasync, +};/************************************************************************** * Misc stuff and module initializatiion
@@ -575,12 +585,6 @@ static int __init cuse_init(void)for (i =0 ; i <CUSE_CONNTBL_LEN ; i++)INIT_LIST_HEAD (&cuse_conntbl[i]); -/* inherit and extend fuse_dev_operations */ - cuse_channel_fops = fuse_dev_operations; - cuse_channel_fops.owner =THIS_MODULE ; - cuse_channel_fops.open = cuse_channel_open; - cuse_channel_fops.release = cuse_channel_release; - cuse_class =class_create (THIS_MODULE ,"cuse" );if (IS_ERR (cuse_class))return PTR_ERR (cuse_class);
fs/fuse/dev.c +4 -4
@@ -745,7 +745,7 @@ __releases(&fc->lock)* request_end(). Otherwise add it to the processing list, and set * the 'sent' flag. */ -static ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov, +ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos) {int err;
@@ -987,7 +987,7 @@ static int copy_out_args(struct fuse_copy_state *cs, struct fuse_out *out,* it from the list and copy the rest of the buffer to the request. * The request is finished by calling request_end() */ -static ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov, +ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos) {int err;
@@ -1084,7 +1084,7 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,return err; } -static unsigned fuse_dev_poll (struct file *file,poll_table *wait) +unsigned fuse_dev_poll (struct file *file,poll_table *wait) {unsigned mask =POLLOUT |POLLWRNORM ;struct fuse_conn *fc =fuse_get_conn (file);
@@ -1210,7 +1210,7 @@ int fuse_dev_release(struct inode *inode, struct file *file) }EXPORT_SYMBOL_GPL (fuse_dev_release); -static int fuse_dev_fasync (int fd,struct file *file,int on) +int fuse_dev_fasync (int fd,struct file *file,int on) {struct fuse_conn *fc =fuse_get_conn (file);if (!fc)
fs/fuse/fuse_i.h +10 -0
@@ -521,6 +521,16 @@ extern const struct file_operations fuse_dev_operations;extern const struct dentry_operations fuse_dentry_operations; +extern ssize_t fuse_dev_read (struct kiocb *iocb,const struct iovec *iov, +unsigned long nr_segs,loff_t pos); + +extern ssize_t fuse_dev_write (struct kiocb *iocb,const struct iovec *iov, +unsigned long nr_segs,loff_t pos); + +extern unsigned fuse_dev_poll (struct file *file,poll_table *wait); + +extern int fuse_dev_fasync (int fd,struct file *file,int on); +/** * Inode to nodeid comparison. */
include/linux/tty.h +13 -1
@@ -13,6 +13,7 @@#include <linux/tty_driver.h> #include <linux/tty_ldisc.h> #include <linux/mutex.h> +#include <linux/poll.h> #include <asm/system.h>
@@ -432,7 +433,6 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);extern dev_t tty_devnum (struct tty_struct *tty);extern void proc_clear_tty (struct task_struct *p);extern struct tty_struct *get_current_tty (void ); -extern void tty_default_fops (struct file_operations *fops);extern struct tty_struct *alloc_tty_struct (void );extern void free_tty_struct (struct tty_struct *tty); extern void initialize_tty_struct(struct tty_struct *tty,
@@ -482,6 +482,18 @@ extern void tty_ldisc_begin(void);/* This last one is just for the tty layer internals and shouldn't be used elsewhere */ extern void tty_ldisc_enable (struct tty_struct *tty); +/* tty_io.c */ +extern ssize_t tty_read (struct file *,char __user *,size_t ,loff_t *); +extern ssize_t tty_write (struct file *,const char __user *,size_t ,loff_t *); +extern unsigned int tty_poll (struct file *,poll_table *); +#ifdef CONFIG_COMPAT +extern long tty_compat_ioctl (struct file *file,unsigned int cmd, +unsigned long arg); +#else +#define tty_compat_ioctl NULL +#endif +extern int tty_release (struct inode *,struct file *); +extern int tty_fasync (int fd,struct file *filp,int on);/* n_tty.c */ extern struct tty_ldisc_ops tty_ldisc_N_TTY;
include/net/tcp.h +1 -0
@@ -1414,6 +1414,7 @@ enum tcp_seq_states {struct tcp_seq_afinfo {char *name;sa_family_t family; +/* cannot be const */ struct file_operations seq_fops;struct seq_operations seq_ops; };
include/net/udp.h +1 -0
@@ -187,6 +187,7 @@ struct udp_seq_afinfo {char *name;sa_family_t family;struct udp_table *udp_table; +/* cannot be const */ struct file_operations seq_fops;struct seq_operations seq_ops; };
kernel/trace/trace_events.c +2 -0
@@ -951,6 +951,8 @@ static LIST_HEAD(ftrace_module_file_list);* Modules must own their file_operations to keep up with * reference counting. */ + +/* cannot be const */ struct ftrace_module_file_ops {struct list_head list;struct module *mod;
virt/kvm/kvm_main.c +3 -0
@@ -1745,6 +1745,7 @@ static int kvm_vcpu_release(struct inode *inode, struct file *filp)return 0 ; } +/* cannot be const */ static struct file_operations kvm_vcpu_fops = { .release = kvm_vcpu_release, .unlocked_ioctl = kvm_vcpu_ioctl,
@@ -2341,6 +2342,7 @@ static int kvm_vm_mmap(struct file *file, struct vm_area_struct *vma)return 0 ; } +/* cannot be const */ static struct file_operations kvm_vm_fops = { .release = kvm_vm_release, .unlocked_ioctl = kvm_vm_ioctl,
@@ -2428,6 +2430,7 @@ out:return r; } +/* cannot be const */ static struct file_operations kvm_chardev_ops = { .unlocked_ioctl = kvm_dev_ioctl, .compat_ioctl = kvm_dev_ioctl,
Re: [PATCH 29/31] Constify struct sysfs_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct sysfs_ops.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- arch/ia64/kernel/topology.c | 2 +- arch/powerpc/kernel/cacheinfo.c | 2 +- arch/sh/kernel/cpu/sh4/sq.c | 2 +- arch/x86/kernel/cpu/intel_cacheinfo.c | 2 +- arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 +- block/blk-integrity.c | 2 +- block/blk-sysfs.c | 2 +- block/elevator.c | 2 +- drivers/base/bus.c | 4 ++-- drivers/base/class.c | 2 +- drivers/base/core.c | 2 +- drivers/base/sys.c | 4 ++-- drivers/block/pktcdvd.c | 2 +- drivers/cpufreq/cpufreq.c | 2 +- drivers/cpuidle/sysfs.c | 4 ++-- drivers/dma/ioat/dma.c | 2 +- drivers/dma/ioat/dma.h | 2 +- drivers/edac/edac_device_sysfs.c | 6 +++--- drivers/edac/edac_mc_sysfs.c | 4 ++-- drivers/edac/edac_pci_sysfs.c | 4 ++-- drivers/firmware/edd.c | 2 +- drivers/firmware/efivars.c | 2 +- drivers/firmware/iscsi_ibft.c | 2 +- drivers/firmware/memmap.c | 2 +- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- drivers/gpu/drm/ttm/ttm_memory.c | 2 +- drivers/infiniband/core/cm.c | 2 +- drivers/infiniband/core/sysfs.c | 2 +- drivers/md/dm-sysfs.c | 2 +- drivers/md/md.c | 4 ++-- drivers/net/ibmveth.c | 2 +- drivers/net/iseries_veth.c | 4 ++-- drivers/parisc/pdc_stable.c | 2 +- drivers/pci/hotplug/fakephp.c | 2 +- drivers/pci/slot.c | 2 +- drivers/uio/uio.c | 4 ++-- drivers/uwb/wlp/sysfs.c | 3 +-- drivers/xen/sys-hypervisor.c | 2 +- fs/btrfs/sysfs.c | 4 ++-- fs/dlm/lockspace.c | 2 +- fs/ext4/super.c | 2 +- fs/gfs2/sys.c | 2 +- fs/ocfs2/cluster/masklog.c | 2 +- fs/sysfs/file.c | 8 ++++---- include/linux/kobject.h | 4 ++-- include/linux/sysfs.h | 4 ++-- kernel/params.c | 2 +- lib/kobject.c | 2 +- mm/slub.c | 2 +- net/bridge/br_private.h | 2 +- net/bridge/br_sysfs_if.c | 2 +- samples/kobject/kset-example.c | 2 +- 52 files changed, 68 insertions(+), 69 deletions(-)
arch/ia64/kernel/topology.c +1 -1
@@ -282,7 +282,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char *return ret; } -static struct sysfs_ops cache_sysfs_ops = { +static const struct sysfs_ops cache_sysfs_ops = { .show = cache_show };
arch/powerpc/kernel/cacheinfo.c +1 -1
@@ -642,7 +642,7 @@ static struct kobj_attribute *cache_index_opt_attrs[] = { &cache_assoc_attr, }; -static struct sysfs_ops cache_index_ops = { +static const struct sysfs_ops cache_index_ops = { .show = cache_index_show, };
arch/sh/kernel/cpu/sh4/sq.c +1 -1
@@ -327,7 +327,7 @@ static struct attribute *sq_sysfs_attrs[] = { NULL, }; -static struct sysfs_ops sq_sysfs_ops = { +static const struct sysfs_ops sq_sysfs_ops = { .show = sq_sysfs_show, .store = sq_sysfs_store, };
arch/x86/kernel/cpu/intel_cacheinfo.c +1 -1
@@ -860,7 +860,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };
arch/x86/kernel/cpu/mcheck/mce_amd.c +1 -1
@@ -388,7 +388,7 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops threshold_ops = { +static const struct sysfs_ops threshold_ops = { .show = show, .store = store, };
block/blk-integrity.c +1 -1
@@ -278,7 +278,7 @@ static struct attribute *integrity_attrs[] = { NULL, }; -static struct sysfs_ops integrity_ops = { +static const struct sysfs_ops integrity_ops = { .show = &integrity_attr_show, .store = &integrity_attr_store, };
block/blk-sysfs.c +1 -1
@@ -414,7 +414,7 @@ static void blk_release_queue(struct kobject *kobj)kmem_cache_free (blk_requestq_cachep, q); } -static struct sysfs_ops queue_sysfs_ops = { +static const struct sysfs_ops queue_sysfs_ops = { .show = queue_attr_show, .store = queue_attr_store, };
block/elevator.c +1 -1
@@ -889,7 +889,7 @@ elv_attr_store(struct kobject *kobj, struct attribute *attr,return error; } -static struct sysfs_ops elv_sysfs_ops = { +static const struct sysfs_ops elv_sysfs_ops = { .show = elv_attr_show, .store = elv_attr_store, };
drivers/base/bus.c +2 -2
@@ -70,7 +70,7 @@ static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops driver_sysfs_ops = { +static const struct sysfs_ops driver_sysfs_ops = { .show = drv_attr_show, .store = drv_attr_store, };
@@ -115,7 +115,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops bus_sysfs_ops = { +static const struct sysfs_ops bus_sysfs_ops = { .show = bus_attr_show, .store = bus_attr_store, };
drivers/base/class.c +1 -1
@@ -61,7 +61,7 @@ static void class_release(struct kobject *kobj) "be careful\n", class->name); } -static struct sysfs_ops class_sysfs_ops = { +static const struct sysfs_ops class_sysfs_ops = { .show = class_attr_show, .store = class_attr_store, };
drivers/base/core.c +1 -1
@@ -93,7 +93,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops dev_sysfs_ops = { +static const struct sysfs_ops dev_sysfs_ops = { .show = dev_attr_show, .store = dev_attr_store, };
drivers/base/sys.c +2 -2
@@ -54,7 +54,7 @@ sysdev_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = sysdev_show, .store = sysdev_store, };
@@ -104,7 +104,7 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops sysfs_class_ops = { +static const struct sysfs_ops sysfs_class_ops = { .show = sysdev_class_show, .store = sysdev_class_store, };
drivers/block/pktcdvd.c +1 -1
@@ -284,7 +284,7 @@ static ssize_t kobj_pkt_store(struct kobject *kobj,return len; } -static struct sysfs_ops kobj_pkt_ops = { +static const struct sysfs_ops kobj_pkt_ops = { .show = kobj_pkt_show, .store = kobj_pkt_store };
drivers/cpufreq/cpufreq.c +1 -1
@@ -750,7 +750,7 @@ static void cpufreq_sysfs_release(struct kobject *kobj)complete (&policy->kobj_unregister); } -static struct sysfs_ops sysfs_ops = { +static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, };
drivers/cpuidle/sysfs.c +2 -2
@@ -191,7 +191,7 @@ static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr,return ret; } -static struct sysfs_ops cpuidle_sysfs_ops = { +static const struct sysfs_ops cpuidle_sysfs_ops = { .show = cpuidle_show, .store = cpuidle_store, };
@@ -277,7 +277,7 @@ static ssize_t cpuidle_state_show(struct kobject * kobj,return ret; } -static struct sysfs_ops cpuidle_state_sysfs_ops = { +static const struct sysfs_ops cpuidle_state_sysfs_ops = { .show = cpuidle_state_show, };
drivers/dma/ioat/dma.c +1 -1
@@ -1146,7 +1146,7 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)return entry->show (&chan->common, page); } -struct sysfs_ops ioat_sysfs_ops = { +const struct sysfs_ops ioat_sysfs_ops = { .show = ioat_attr_show, };
drivers/dma/ioat/dma.h +1 -1
@@ -329,7 +329,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, unsigned long *phys_complete);void ioat_kobject_add (struct ioatdma_device *device,struct kobj_type *type);void ioat_kobject_del (struct ioatdma_device *device); -extern struct sysfs_ops ioat_sysfs_ops; +extern const struct sysfs_ops ioat_sysfs_ops;extern struct ioat_sysfs_entry ioat_version_attr;extern struct ioat_sysfs_entry ioat_cap_attr;#endif /* IOATDMA_H */
drivers/edac/edac_device_sysfs.c +3 -3
@@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj, }/* edac_dev file operations for an 'ctl_info' */ -static struct sysfs_ops device_ctl_info_ops = { +static const struct sysfs_ops device_ctl_info_ops = { .show = edac_dev_ctl_info_show, .store = edac_dev_ctl_info_store };
@@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj, }/* edac_dev file operations for an 'instance' */ -static struct sysfs_ops device_instance_ops = { +static const struct sysfs_ops device_instance_ops = { .show = edac_dev_instance_show, .store = edac_dev_instance_store };
@@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj, }/* edac_dev file operations for a 'block' */ -static struct sysfs_ops device_block_ops = { +static const struct sysfs_ops device_block_ops = { .show = edac_dev_block_show, .store = edac_dev_block_store };
drivers/edac/edac_mc_sysfs.c +2 -2
@@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr,return -EIO ; } -static struct sysfs_ops csrowfs_ops = { +static const struct sysfs_ops csrowfs_ops = { .show = csrowdev_show, .store = csrowdev_store };
@@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr, }/* Intermediate show/store table */ -static struct sysfs_ops mci_ops = { +static const struct sysfs_ops mci_ops = { .show = mcidev_show, .store = mcidev_store };
drivers/edac/edac_pci_sysfs.c +2 -2
@@ -121,7 +121,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj, }/* fs_ops table */ -static struct sysfs_ops pci_instance_ops = { +static const struct sysfs_ops pci_instance_ops = { .show = edac_pci_instance_show, .store = edac_pci_instance_store };
@@ -261,7 +261,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj,return -EIO ; } -static struct sysfs_ops edac_pci_sysfs_ops = { +static const struct sysfs_ops edac_pci_sysfs_ops = { .show = edac_pci_dev_show, .store = edac_pci_dev_store };
drivers/firmware/edd.c +1 -1
@@ -122,7 +122,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)return ret; } -static struct sysfs_ops edd_attr_ops = { +static const struct sysfs_ops edd_attr_ops = { .show = edd_attr_show, };
drivers/firmware/efivars.c +1 -1
@@ -362,7 +362,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops efivar_attr_ops = { +static const struct sysfs_ops efivar_attr_ops = { .show = efivar_attr_show, .store = efivar_attr_store, };
drivers/firmware/iscsi_ibft.c +1 -1
@@ -525,7 +525,7 @@ static ssize_t ibft_show_attribute(struct kobject *kobj,return ret; } -static struct sysfs_ops ibft_attr_ops = { +static const struct sysfs_ops ibft_attr_ops = { .show = ibft_show_attribute, };
drivers/firmware/memmap.c +1 -1
@@ -74,7 +74,7 @@ static struct attribute *def_attrs[] = { NULL }; -static struct sysfs_ops memmap_attr_ops = { +static const struct sysfs_ops memmap_attr_ops = { .show = memmap_attr_show, };
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
@@ -67,7 +67,7 @@ static struct attribute *ttm_bo_global_attrs[] = { NULL }; -static struct sysfs_ops ttm_bo_global_ops = { +static const struct sysfs_ops ttm_bo_global_ops = { .show = &ttm_bo_global_show };
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
@@ -152,7 +152,7 @@ static struct attribute *ttm_mem_zone_attrs[] = { NULL }; -static struct sysfs_ops ttm_mem_zone_ops = { +static const struct sysfs_ops ttm_mem_zone_ops = { .show = &ttm_mem_zone_show, .store = &ttm_mem_zone_store };
drivers/infiniband/core/cm.c +1 -1
@@ -3597,7 +3597,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr, atomic_long_read(&group->counter[cm_attr->index])); } -static struct sysfs_ops cm_counter_ops = { +static const struct sysfs_ops cm_counter_ops = { .show = cm_show_counter };
drivers/infiniband/core/sysfs.c +1 -1
@@ -79,7 +79,7 @@ static ssize_t port_attr_show(struct kobject *kobj,return port_attr->show (p, port_attr, buf); } -static struct sysfs_ops port_sysfs_ops = { +static const struct sysfs_ops port_sysfs_ops = { .show = port_attr_show };
drivers/md/dm-sysfs.c +1 -1
@@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = { NULL, }; -static struct sysfs_ops dm_sysfs_ops = { +static const struct sysfs_ops dm_sysfs_ops = { .show = dm_attr_show, };
drivers/md/md.c +2 -2
@@ -2505,7 +2505,7 @@ static void rdev_free(struct kobject *ko)mdk_rdev_t *rdev =container_of (ko, mdk_rdev_t, kobj);kfree (rdev); } -static struct sysfs_ops rdev_sysfs_ops = { +static const struct sysfs_ops rdev_sysfs_ops = { .show = rdev_attr_show, .store = rdev_attr_store, };
@@ -3875,7 +3875,7 @@ static void md_free(struct kobject *ko)kfree (mddev); } -static struct sysfs_ops md_sysfs_ops = { +static const struct sysfs_ops md_sysfs_ops = { .show = md_attr_show, .store = md_attr_store, };
drivers/net/ibmveth.c +1 -1
@@ -1577,7 +1577,7 @@ static struct attribute * veth_pool_attrs[] = { NULL, }; -static struct sysfs_ops veth_pool_ops = { +static const struct sysfs_ops veth_pool_ops = { .show = veth_pool_show, .store = veth_pool_store, };
drivers/net/iseries_veth.c +2 -2
@@ -384,7 +384,7 @@ static struct attribute *veth_cnx_default_attrs[] = { NULL }; -static struct sysfs_ops veth_cnx_sysfs_ops = { +static const struct sysfs_ops veth_cnx_sysfs_ops = { .show = veth_cnx_attribute_show };
@@ -441,7 +441,7 @@ static struct attribute *veth_port_default_attrs[] = { NULL }; -static struct sysfs_ops veth_port_sysfs_ops = { +static const struct sysfs_ops veth_port_sysfs_ops = { .show = veth_port_attribute_show };
drivers/parisc/pdc_stable.c +1 -1
@@ -481,7 +481,7 @@ pdcspath_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static struct sysfs_ops pdcspath_attr_ops = { +static const struct sysfs_ops pdcspath_attr_ops = { .show = pdcspath_attr_show, .store = pdcspath_attr_store, };
drivers/pci/hotplug/fakephp.c +1 -1
@@ -73,7 +73,7 @@ static void legacy_release(struct kobject *kobj) }static struct kobj_type legacy_ktype = { - .sysfs_ops = &(struct sysfs_ops ){ + .sysfs_ops = &(const struct sysfs_ops ){ .store = legacy_store, .show = legacy_show }, .release = &legacy_release,
drivers/pci/slot.c +1 -1
@@ -29,7 +29,7 @@ static ssize_t pci_slot_attr_store(struct kobject *kobj,return attribute->store ? attribute->store (slot, buf, len) : -EIO ; } -static struct sysfs_ops pci_slot_sysfs_ops = { +static const struct sysfs_ops pci_slot_sysfs_ops = { .show = pci_slot_attr_show, .store = pci_slot_attr_store, };
drivers/uio/uio.c +2 -2
@@ -129,7 +129,7 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,return entry->show (mem, buf); } -static struct sysfs_ops map_sysfs_ops = { +static const struct sysfs_ops map_sysfs_ops = { .show = map_type_show, };
@@ -217,7 +217,7 @@ static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr,return entry->show (port, buf); } -static struct sysfs_ops portio_sysfs_ops = { +static const struct sysfs_ops portio_sysfs_ops = { .show = portio_type_show, };
drivers/uwb/wlp/sysfs.c +1 -2
@@ -615,8 +615,7 @@ ssize_t wlp_wss_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -static -struct sysfs_ops wss_sysfs_ops = { +static const struct sysfs_ops wss_sysfs_ops = { .show = wlp_wss_attr_show, .store = wlp_wss_attr_store, };
drivers/xen/sys-hypervisor.c +1 -1
@@ -425,7 +425,7 @@ static ssize_t hyp_sysfs_store(struct kobject *kobj,return 0 ; } -static struct sysfs_ops hyp_sysfs_ops = { +static const struct sysfs_ops hyp_sysfs_ops = { .show = hyp_sysfs_show, .store = hyp_sysfs_store, };
fs/btrfs/sysfs.c +2 -2
@@ -164,12 +164,12 @@ static void btrfs_root_release(struct kobject *kobj)complete (&root->kobj_unregister); } -static struct sysfs_ops btrfs_super_attr_ops = { +static const struct sysfs_ops btrfs_super_attr_ops = { .show = btrfs_super_attr_show, .store = btrfs_super_attr_store, }; -static struct sysfs_ops btrfs_root_attr_ops = { +static const struct sysfs_ops btrfs_root_attr_ops = { .show = btrfs_root_attr_show, .store = btrfs_root_attr_store, };
fs/dlm/lockspace.c +1 -1
@@ -148,7 +148,7 @@ static void lockspace_kobj_release(struct kobject *k)kfree (ls); } -static struct sysfs_ops dlm_attr_ops = { +static const struct sysfs_ops dlm_attr_ops = { .show = dlm_attr_show, .store = dlm_attr_store, };
fs/ext4/super.c +1 -1
@@ -2251,7 +2251,7 @@ static void ext4_sb_release(struct kobject *kobj) } -static struct sysfs_ops ext4_attr_ops = { +static const struct sysfs_ops ext4_attr_ops = { .show = ext4_attr_show, .store = ext4_attr_store, };
fs/gfs2/sys.c +1 -1
@@ -49,7 +49,7 @@ static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,return a->store ? a->store (sdp, buf, len) : len; } -static struct sysfs_ops gfs2_attr_ops = { +static const struct sysfs_ops gfs2_attr_ops = { .show = gfs2_attr_show, .store = gfs2_attr_store, };
fs/ocfs2/cluster/masklog.c +1 -1
@@ -135,7 +135,7 @@ static ssize_t mlog_store(struct kobject *obj, struct attribute *attr,return mlog_mask_store (mlog_attr->mask, buf, count); } -static struct sysfs_ops mlog_attr_ops = { +static const struct sysfs_ops mlog_attr_ops = { .show = mlog_show, .store = mlog_store, };
fs/sysfs/file.c +4 -4
@@ -53,7 +53,7 @@ struct sysfs_buffer {size_t count;loff_t pos;char * page; -struct sysfs_ops * ops; +const struct sysfs_ops * ops;struct mutex mutex;int needs_read_fill;int event;
@@ -75,7 +75,7 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int ret =0 ;ssize_t count;
@@ -199,7 +199,7 @@ flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t {struct sysfs_dirent *attr_sd = dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; -struct sysfs_ops * ops = buffer->ops; +const struct sysfs_ops * ops = buffer->ops;int rc;/* need attr_sd for attr and ops, its parent for kobj */
@@ -335,7 +335,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;struct sysfs_buffer *buffer; -struct sysfs_ops *ops; +const struct sysfs_ops *ops;int error = -EACCES ;char *p;
include/linux/kobject.h +2 -2
@@ -106,7 +106,7 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);struct kobj_type {void (*release)(struct kobject *kobj); -struct sysfs_ops *sysfs_ops; +const struct sysfs_ops *sysfs_ops;struct attribute **default_attrs; };
@@ -132,7 +132,7 @@ struct kobj_attribute { const char *buf, size_t count); }; -extern struct sysfs_ops kobj_sysfs_ops; +extern const struct sysfs_ops kobj_sysfs_ops;/** * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
include/linux/sysfs.h +2 -2
@@ -75,8 +75,8 @@ struct bin_attribute { };struct sysfs_ops { -ssize_t (*show)(struct kobject *,struct attribute *,char *); -ssize_t (*store)(struct kobject *,struct attribute *,const char *,size_t ); +ssize_t (*const show)(struct kobject *,struct attribute *,char *); +ssize_t (*const store)(struct kobject *,struct attribute *,const char *,size_t ); };struct sysfs_dirent ;
kernel/params.c +1 -1
@@ -725,7 +725,7 @@ static ssize_t module_attr_store(struct kobject *kobj,return ret; } -static struct sysfs_ops module_sysfs_ops = { +static const struct sysfs_ops module_sysfs_ops = { .show = module_attr_show, .store = module_attr_store, };
lib/kobject.c +1 -1
@@ -700,7 +700,7 @@ static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr,return ret; } -struct sysfs_ops kobj_sysfs_ops = { +const struct sysfs_ops kobj_sysfs_ops = { .show = kobj_attr_show, .store = kobj_attr_store, };
mm/slub.c +1 -1
@@ -4503,7 +4503,7 @@ static void kmem_cache_release(struct kobject *kobj)kfree (s); } -static struct sysfs_ops slab_sysfs_ops = { +static const struct sysfs_ops slab_sysfs_ops = { .show = slab_attr_show, .store = slab_attr_store, };
net/bridge/br_private.h +1 -1
@@ -254,7 +254,7 @@ extern void br_ifinfo_notify(int event, struct net_bridge_port *port);#ifdef CONFIG_SYSFS /* br_sysfs_if.c */ -extern struct sysfs_ops brport_sysfs_ops; +extern const struct sysfs_ops brport_sysfs_ops;extern int br_sysfs_addif (struct net_bridge_port *p);/* br_sysfs_br.c */
net/bridge/br_sysfs_if.c +1 -1
@@ -220,7 +220,7 @@ static ssize_t brport_store(struct kobject * kobj,return ret; } -struct sysfs_ops brport_sysfs_ops = { +const struct sysfs_ops brport_sysfs_ops = { .show = brport_show, .store = brport_store, };
samples/kobject/kset-example.c +1 -1
@@ -87,7 +87,7 @@ static ssize_t foo_attr_store(struct kobject *kobj, }/* Our custom sysfs_ops that we will associate with our ktype later on */ -static struct sysfs_ops foo_sysfs_ops = { +static const struct sysfs_ops foo_sysfs_ops = { .show = foo_attr_show, .store = foo_attr_store, };
Re: [PATCH 15/31] Constify struct iwl_ops for 2.6.32 v1
In reply to Emese RevfyFrom: Emese Revfy <[email protected]>
Constify struct iwl_ops.
Per Dave Miller's suggestion, resend with proper CC list and patch format.
--- drivers/net/wireless/iwlwifi/iwl-1000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.c | 2 +- drivers/net/wireless/iwlwifi/iwl-5000.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-6000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-dev.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +1 -1
@@ -137,7 +137,7 @@ static struct iwl_lib_ops iwl1000_lib = { }, }; -static struct iwl_ops iwl1000_ops = { +static const struct iwl_ops iwl1000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl1000_lib, .hcmd = &iwl5000_hcmd,
drivers/net/wireless/iwlwifi/iwl-3945.c +1 -1
@@ -2876,7 +2876,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { .build_addsta_hcmd = iwl3945_build_addsta_hcmd, }; -static struct iwl_ops iwl3945_ops = { +static const struct iwl_ops iwl3945_ops = { .ucode = &iwl3945_ucode, .lib = &iwl3945_lib, .hcmd = &iwl3945_hcmd,
drivers/net/wireless/iwlwifi/iwl-4965.c +1 -1
@@ -2335,7 +2335,7 @@ static struct iwl_lib_ops iwl4965_lib = { }, }; -static struct iwl_ops iwl4965_ops = { +static const struct iwl_ops iwl4965_ops = { .ucode = &iwl4965_ucode, .lib = &iwl4965_lib, .hcmd = &iwl4965_hcmd,
drivers/net/wireless/iwlwifi/iwl-5000.c +2 -2
@@ -1627,14 +1627,14 @@ static struct iwl_lib_ops iwl5150_lib = { }, }; -struct iwl_ops iwl5000_ops = { +const struct iwl_ops iwl5000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl5000_lib, .hcmd = &iwl5000_hcmd, .utils = &iwl5000_hcmd_utils, }; -static struct iwl_ops iwl5150_ops = { +static const struct iwl_ops iwl5150_ops = { .ucode = &iwl5000_ucode, .lib = &iwl5150_lib, .hcmd = &iwl5000_hcmd,
drivers/net/wireless/iwlwifi/iwl-6000.c +1 -1
@@ -146,7 +146,7 @@ static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = { .calc_rssi = iwl5000_calc_rssi, }; -static struct iwl_ops iwl6000_ops = { +static const struct iwl_ops iwl6000_ops = { .ucode = &iwl5000_ucode, .lib = &iwl6000_lib, .hcmd = &iwl5000_hcmd,
drivers/net/wireless/iwlwifi/iwl-dev.h +1 -1
@@ -67,7 +67,7 @@ struct iwl_tx_queue;/* shared structures from iwl-5000.c */ extern struct iwl_mod_params iwl50_mod_params; -extern struct iwl_ops iwl5000_ops; +extern const struct iwl_ops iwl5000_ops;extern struct iwl_ucode_ops iwl5000_ucode;extern struct iwl_lib_ops iwl5000_lib;extern struct iwl_hcmd_ops iwl5000_hcmd;
Re: [PATCH 02/31] Constify struct address_space_operations for 2.6.32 v1
In reply to Emese Revfyinclude/linux/fs.h typedef int (*read_actor_t)(read_descriptor_t *, struct page *, · line 570
Quoted 7 lines · Emese Revfy
struct
address_space_operations{include/linux/fs.h +3
-3-int (*writepage)(struct page *page,struct writeback_control *wbc); -int (*readpage)(struct file *,struct page *); -void (*sync_page)(struct page *); +int (*const writepage)(struct page *page,struct writeback_control *wbc); +int (*const readpage)(struct file *,struct page *); +void (*const sync_page)(struct page *);
Umm. What effect does this have? Aren't functions implicitly constant? What changes as a result of this patch?
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Re: [PATCH 11/31] Constify struct file_operations for 2.6.32 v1
In reply to Emese RevfyQuoted 63 lines · Emese Revfy
From: Emese Revfy <[email protected]>
Constify struct
file_operationswith some exceptions.
Per Dave Miller's suggestion, resend with proper CC list and patch format.Signed-off-by Emese Revfy <[email protected]>--- drivers/acpi/battery.c | 2 +- drivers/char/pty.c | 16 +++++++++--- drivers/char/tty_io.c | 28 ++++----------------- drivers/media/dvb/dvb-core/dvbdev.c | 1 + drivers/net/wireless/b43/debugfs.c | 2 +- drivers/net/wireless/b43legacy/debugfs.c | 2 +- drivers/net/wireless/libertas/debugfs.c | 2 +- drivers/staging/b3dfg/b3dfg.c | 2 +- drivers/staging/dream/qdsp5/adsp_driver.c | 2 +- drivers/staging/dream/qdsp5/audio_aac.c | 2 +- drivers/staging/dream/qdsp5/audio_amrnb.c | 2 +- drivers/staging/dream/qdsp5/audio_evrc.c | 2 +- drivers/staging/dream/qdsp5/audio_in.c | 4 +- drivers/staging/dream/qdsp5/audio_mp3.c | 2 +- drivers/staging/dream/qdsp5/audio_out.c | 4 +- drivers/staging/dream/qdsp5/audio_qcelp.c | 2 +- drivers/staging/dream/qdsp5/snd.c | 2 +- drivers/staging/dream/smd/smd_qmi.c | 2 +- drivers/staging/dream/smd/smd_rpcrouter_device.c | 4 +- drivers/staging/panel/panel.c | 4 +- drivers/staging/poch/poch.c | 2 +- drivers/staging/sep/sep_driver.c | 2 +- drivers/staging/vme/devices/vme_user.c | 2 +- fs/fuse/cuse.c | 20 +++++++++------ fs/fuse/dev.c | 8 +++--- fs/fuse/fuse_i.h | 10 ++++++++ include/linux/tty.h | 14 ++++++++++- include/net/tcp.h | 1 + include/net/udp.h | 1 + kernel/trace/trace_events.c | 2 + virt/kvm/kvm_main.c | 3 ++ 31 files changed, 89 insertions(+), 63 deletions(-)drivers/acpi/battery.c +1
-1@@ -763,7 +763,7 @@ DECLARE_FILE_FUNCTIONS(alarm); }static struct battery_file { -struct file_operations ops; +const struct file_operations ops;mode_t mode;const char *name; } acpi_battery_file[] = {drivers/char/pty.c +1
-1@@ -682,7 +682,18 @@ static int ptmx_open(struct inode *inode, struct file *filp)return ret; } -static struct file_operations ptmx_fops; +static const struct file_operations ptmx_fops = {
drivers/char/pty.c static int ptmx_open(struct inode *inode, struct file *filp) · line 695
Quoted 10 lines
drivers/char/pty.c +10
-0+ .llseek = no_llseek, + .read = tty_read, + .write = tty_write, + .poll = tty_poll, + .unlocked_ioctl = tty_ioctl, + .compat_ioctl = tty_compat_ioctl, + .open = ptmx_open, + .release = tty_release, + .fasync = tty_fasync, +};
You just made these functions all global, for no real good reason. Why did you do this?
confused,
greg k-h
Re: [PATCH 02/31] Constify struct address_space_operations for 2.6.32 v1
In reply to Matthew WilcoxQuoted 11 lines · Matthew Wilcox
include/linux/fs.h typedef int (*read_actor_t)(read_descriptor_t *, struct page *, · line 570
Quoted 7 lines · Emese Revfy
struct
address_space_operations{include/linux/fs.h +3
-3-int (*writepage)(struct page *page,struct writeback_control *wbc); -int (*readpage)(struct file *,struct page *); -void (*sync_page)(struct page *); +int (*const writepage)(struct page *page,struct writeback_control *wbc); +int (*const readpage)(struct file *,struct page *); +void (*const sync_page)(struct page *);Umm. What effect does this have?
What changes as a result of this patch?
My idea was that since all variables of this type are const, we might as well have the compiler enforce it for the future if you think that these fields should not be writable at all.
Quoted 1 line
Aren't functions implicitly constant?
They are, but these are function pointer fields in a structure, not the functions themselves.
--
Emese
Re: [PATCH 06/31] Constify struct e1000_mac_operations for 2.6.32 v1
In reply to Emese RevfyHi Emese,
drivers/net/e1000e/82571.c static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) · line 216
Quoted 9 lines · On Sat, 05 Dec 2009 01:03:03 +0100 Emese Revfy <[email protected]> wrote:
drivers/net/e1000e/82571.c +1
-0@@ -212,6 +212,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;
Adding to the comment to say why it can't be const may allow us to fix this later ...
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1
In reply to Emese RevfyHi Emese,
arch/powerpc/kernel/vio.c static void vio_dma_iommu_unmap_sg(struct device *dev, · line 605
Quoted 9 lines · On Fri, 04 Dec 2009 23:14:08 +0100 Emese Revfy <[email protected]> wrote:
arch/powerpc/kernel/vio.c +1
-0@@ -601,6 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,vio_cmo_dealloc (viodev, alloc_size); } +/* cannot be const */ struct dma_map_ops vio_dma_mapping_ops = {
The problem with leaving this not const is that a pointer to it is later assigned to an archdata::dma_ops which you have made into a const pointer earlier in this patch. This will generate a warning which is fatal in arch/powerpc as we compile that directory with -Werror.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 06/31] Constify struct e1000_mac_operations for 2.6.32 v1
In reply to Stephen RothwellQuoted 14 lines · Stephen Rothwell
Hi Emese,
drivers/net/e1000e/82571.c static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) · line 216
Quoted 8 lines · On Sat, 05 Dec 2009 01:03:03 +0100 Emese Revfy <[email protected]> wrote:
drivers/net/e1000e/82571.c +1
-0@@ -212,6 +212,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) {struct e1000_hw *hw = &adapter->hw;struct e1000_mac_info *mac = &hw->mac; +/* cannot be const */ struct e1000_mac_operations *func = &mac->ops;Adding to the comment to say why it can't be const may allow us to fix this later ...
Ok, in the next patch series I will explain each case.
Re: [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1
In reply to Stephen RothwellHi Emese,
Quoted 9 lines · On Sat, 5 Dec 2009 11:59:36 +1100 Stephen Rothwell <[email protected]> wrote:
Quoted 7 lines · On Fri, 04 Dec 2009 23:14:08 +0100 Emese Revfy <[email protected]> wrote:
arch/powerpc/kernel/vio.c +0
-0@@ -601,6 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,vio_cmo_dealloc (viodev, alloc_size); }
Quoted 7 lines
arch/powerpc/kernel/vio.c static void vio_dma_iommu_unmap_sg(struct device *dev, · line 605
Quoted 2 lines
arch/powerpc/kernel/vio.c +1
-0+/* cannot be const */ struct dma_map_ops vio_dma_mapping_ops = {The problem with leaving this not const is that a pointer to it is later assigned to an
archdata::dma_opswhich you have made into a const pointer earlier in this patch. This will generate a warning which is fatal inarch/powerpcas we compile that directory with -Werror.
Actually with a little more work, it can be made const. The only assignment to it can be put in the initialiser instead ... As an aside, it should also be made static.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 06/31] Constify struct e1000_mac_operations for 2.6.32 v1
In reply to Emese Revfy2009/12/4 Emese Revfy <[email protected]>:
Quoted 16 lines
Quoted 14 lines · Stephen Rothwell
Hi Emese,
drivers/net/e1000e/82571.c static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) · line 216
Quoted 8 lines · On Sat, 05 Dec 2009 01:03:03 +0100 Emese Revfy <[email protected]> wrote:
drivers/net/e1000e/82571.c +1
-0@@ -212,6 +212,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; struct e1000_mac_info *mac = &hw->mac; + /* cannot be const */ struct e1000_mac_operations *func = &mac->ops;Adding to the comment to say why it can't be const may allow us to fix this later ...
Quoted 2 lines
Ok, in the next patch series I will explain each case. --
Also, please sync up your patches with what is in Dave's net-next-2.6 tree, because some of the changes made no longer apply since the code was either changed or removed.
Signature · 2 lines
Cheers, Jeff
Re: [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1
In reply to Stephen RothwellQuoted 17 lines · Stephen Rothwell
Hi Emese,
Quoted 7 lines · On Sat, 5 Dec 2009 11:59:36 +1100 Stephen Rothwell <[email protected]> wrote:
Quoted 6 lines · On Fri, 04 Dec 2009 23:14:08 +0100 Emese Revfy <[email protected]> wrote:
arch/powerpc/kernel/vio.c +0
-0@@ -601,6 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,vio_cmo_dealloc (viodev, alloc_size); }Quoted 6 lines
arch/powerpc/kernel/vio.c static void vio_dma_iommu_unmap_sg(struct device *dev, · line 605
Quoted 2 lines
arch/powerpc/kernel/vio.c +1
-0+/* cannot be const */ struct dma_map_ops vio_dma_mapping_ops = {The problem with leaving this not const is that a pointer to it is later assigned to an
archdata::dma_opswhich you have made into a const pointer earlier in this patch. This will generate a warning which is fatal inarch/powerpcas we compile that directory with -Werror.
Quoted 3 lines
Actually with a little more work, it can be made const. The only assignment to it can be put in the initialiser instead ... As an aside, it should also be made static.
Ok, I made the changes, I also removed the vio_cmo_set_dma_ops function because I think it is now unnecessary.
From: Emese Revfy <[email protected]>
Constify struct dma_map_ops.
--- arch/ia64/hp/common/hwsw_iommu.c | 4 +- arch/ia64/hp/common/sba_iommu.c | 4 +- arch/ia64/include/asm/dma-mapping.h | 10 ++++---- arch/ia64/include/asm/machvec.h | 4 +- arch/ia64/kernel/dma-mapping.c | 4 +- arch/ia64/kernel/pci-dma.c | 2 +- arch/ia64/kernel/pci-swiotlb.c | 2 +- arch/ia64/sn/pci/pci_dma.c | 2 +- arch/powerpc/include/asm/device.h | 2 +- arch/powerpc/include/asm/dma-mapping.h | 18 ++++++++-------- arch/powerpc/include/asm/iommu.h | 3 ++ arch/powerpc/include/asm/pci.h | 4 +- arch/powerpc/include/asm/swiotlb.h | 2 +- arch/powerpc/kernel/dma-iommu.c | 4 +- arch/powerpc/kernel/dma-swiotlb.c | 2 +- arch/powerpc/kernel/dma.c | 2 +- arch/powerpc/kernel/ibmebus.c | 2 +- arch/powerpc/kernel/pci-common.c | 6 ++-- arch/powerpc/kernel/vio.c | 13 ++--------- arch/powerpc/platforms/cell/iommu.c | 2 +- arch/powerpc/platforms/ps3/system-bus.c | 4 +- arch/sparc/include/asm/dma-mapping.h | 8 +++--- arch/sparc/kernel/iommu.c | 4 +- arch/sparc/kernel/ioport.c | 6 ++-- arch/sparc/kernel/pci_sun4v.c | 2 +- arch/x86/include/asm/device.h | 2 +- arch/x86/include/asm/dma-mapping.h | 10 ++++---- arch/x86/include/asm/iommu.h | 2 +- arch/x86/kernel/amd_iommu.c | 2 +- arch/x86/kernel/pci-calgary_64.c | 2 +- arch/x86/kernel/pci-dma.c | 4 +- arch/x86/kernel/pci-gart_64.c | 2 +- arch/x86/kernel/pci-nommu.c | 2 +- arch/x86/kernel/pci-swiotlb.c | 2 +- drivers/pci/intel-iommu.c | 2 +- include/asm-generic/dma-mapping-common.h | 24 +++++++++++----------- include/linux/dma-mapping.h | 32 +++++++++++++++--------------- 37 files changed, 99 insertions(+), 103 deletions(-)
arch/ia64/hp/common/hwsw_iommu.c +2 -2
@@ -17,7 +17,7 @@#include <linux/swiotlb.h> #include <asm/machvec.h> -extern struct dma_map_ops sba_dma_ops, swiotlb_dma_ops; +extern const struct dma_map_ops sba_dma_ops, swiotlb_dma_ops;/* swiotlb declarations & definitions: */ extern int swiotlb_late_init_with_default_size (size_t size);
@@ -33,7 +33,7 @@ static inline int use_swiotlb(struct device *dev) !sba_dma_ops.dma_supported (dev, *dev->dma_mask); } -struct dma_map_ops *hwsw_dma_get_ops (struct device *dev) +const struct dma_map_ops *hwsw_dma_get_ops (struct device *dev) {if (use_swiotlb (dev))return &swiotlb_dma_ops;
arch/ia64/hp/common/sba_iommu.c +2 -2
@@ -2077,7 +2077,7 @@ static struct acpi_driver acpi_sba_ioc_driver = { }, }; -extern struct dma_map_ops swiotlb_dma_ops; +extern const struct dma_map_ops swiotlb_dma_ops;static int __init sba_init (void )
@@ -2191,7 +2191,7 @@ sba_page_override(char *str)__setup ("sbapagesize=" ,sba_page_override); -struct dma_map_ops sba_dma_ops = { +const struct dma_map_ops sba_dma_ops = { .alloc_coherent = sba_alloc_coherent, .free_coherent = sba_free_coherent, .map_page = sba_map_page,
arch/ia64/include/asm/dma-mapping.h +5 -5
@@ -12,7 +12,7 @@#define ARCH_HAS_DMA_GET_REQUIRED_MASK -extern struct dma_map_ops *dma_ops; +extern const struct dma_map_ops *dma_ops;extern struct ia64_machine_vector ia64_mv;extern void set_iommu_machvec (void );
@@ -24,7 +24,7 @@ extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int,static inline void *dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *daddr,gfp_t gfp) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);void *caddr; caddr = ops->alloc_coherent (dev, size, daddr, gfp);
@@ -35,7 +35,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,static inline void dma_free_coherent (struct device *dev,size_t size,void *caddr,dma_addr_t daddr) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);debug_dma_free_coherent (dev, size, caddr, daddr); ops->free_coherent (dev, size, caddr, daddr); }
@@ -49,13 +49,13 @@ static inline void dma_free_coherent(struct device *dev, size_t size,static inline int dma_mapping_error (struct device *dev,dma_addr_t daddr) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);return ops->mapping_error (dev, daddr); }static inline int dma_supported (struct device *dev,u64 mask) { -struct dma_map_ops *ops =platform_dma_get_ops (dev); +const struct dma_map_ops *ops =platform_dma_get_ops (dev);return ops->dma_supported (dev, mask); }
arch/ia64/include/asm/machvec.h +2 -2
@@ -45,7 +45,7 @@ typedef void ia64_mv_kernel_launch_event_t(void);/* DMA-mapping interface: */ typedef void ia64_mv_dma_init (void );typedef u64 ia64_mv_dma_get_required_mask (struct device *); -typedef struct dma_map_ops *ia64_mv_dma_get_ops (struct device *); +typedef const struct dma_map_ops *ia64_mv_dma_get_ops (struct device *);/* * WARNING: The legacy I/O space is _architected_. Platforms are
@@ -251,7 +251,7 @@ extern void machvec_init_from_cmdline(const char *cmdline);# endif /* CONFIG_IA64_GENERIC */ extern void swiotlb_dma_init (void ); -extern struct dma_map_ops *dma_get_ops (struct device *); +extern const struct dma_map_ops *dma_get_ops (struct device *);/* * Define default versions so we can extend machvec for new platforms without having
arch/ia64/kernel/dma-mapping.c +2 -2
@@ -3,7 +3,7 @@/* Set this to 1 if there is a HW IOMMU in the system */ int iommu_detected__read_mostly ; -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;EXPORT_SYMBOL (dma_ops);#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
@@ -16,7 +16,7 @@ static int __init dma_init(void) }fs_initcall (dma_init); -struct dma_map_ops *dma_get_ops (struct device *dev) +const struct dma_map_ops *dma_get_ops (struct device *dev) {return dma_ops; }
arch/ia64/kernel/pci-dma.c +1 -1
@@ -43,7 +43,7 @@ struct device fallback_dev = { .dma_mask = &fallback_dev.coherent_dma_mask, }; -extern struct dma_map_ops intel_dma_ops; +extern const struct dma_map_ops intel_dma_ops;static int __init pci_iommu_init (void ) {
arch/ia64/kernel/pci-swiotlb.c +1 -1
@@ -21,7 +21,7 @@ static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size,return swiotlb_alloc_coherent (dev, size, dma_handle, gfp); } -struct dma_map_ops swiotlb_dma_ops = { +const struct dma_map_ops swiotlb_dma_ops = { .alloc_coherent = ia64_swiotlb_alloc_coherent, .free_coherent = swiotlb_free_coherent, .map_page = swiotlb_map_page,
arch/ia64/sn/pci/pci_dma.c +1 -1
@@ -464,7 +464,7 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)return ret; } -static struct dma_map_ops sn_dma_ops = { +static const struct dma_map_ops sn_dma_ops = { .alloc_coherent = sn_dma_alloc_coherent, .free_coherent = sn_dma_free_coherent, .map_page = sn_dma_map_page,
arch/powerpc/include/asm/device.h +1 -1
@@ -14,7 +14,7 @@ struct dev_archdata {struct device_node *of_node;/* DMA operations on that device */ -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;/* * When an iommu is in use, dma_data is used as a ptr to the base of the
arch/powerpc/include/asm/dma-mapping.h +9 -9
@@ -67,11 +67,11 @@ static inline unsigned long device_to_mask(struct device *dev)* Available generic sets of operations */ #ifdef CONFIG_PPC64 -extern struct dma_map_ops dma_iommu_ops; +extern const struct dma_map_ops dma_iommu_ops;#endif -extern struct dma_map_ops dma_direct_ops; +extern const struct dma_map_ops dma_direct_ops; -static inline struct dma_map_ops *get_dma_ops (struct device *dev) +static inline const struct dma_map_ops *get_dma_ops (struct device *dev) {/* We don't handle the NULL dev case for ISA for now. We could * do it via an out of line call but it is not needed for now. The
@@ -84,7 +84,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)return dev->archdata.dma_ops; } -static inline void set_dma_ops (struct device *dev,struct dma_map_ops *ops) +static inline void set_dma_ops (struct device *dev,const struct dma_map_ops *ops) { dev->archdata.dma_ops = ops; }
@@ -118,7 +118,7 @@ static inline void set_dma_offset(struct device *dev, dma_addr_t off)static inline int dma_supported (struct device *dev,u64 mask) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);if (unlikely (dma_ops ==NULL ))return 0 ;
@@ -132,7 +132,7 @@ static inline int dma_supported(struct device *dev, u64 mask)static inline int dma_set_mask (struct device *dev,u64 dma_mask) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);if (unlikely (dma_ops ==NULL ))return -EIO ;
@@ -147,7 +147,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)static inline void *dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);void *cpu_addr;BUG_ON (!dma_ops);
@@ -162,7 +162,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,static inline void dma_free_coherent (struct device *dev,size_t size,void *cpu_addr,dma_addr_t dma_handle) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);BUG_ON (!dma_ops);
@@ -173,7 +173,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size,static inline int dma_mapping_error (struct device *dev,dma_addr_t dma_addr) { -struct dma_map_ops *dma_ops =get_dma_ops (dev); +const struct dma_map_ops *dma_ops =get_dma_ops (dev);if (dma_ops->mapping_error)return dma_ops->mapping_error (dev, dma_addr);
arch/powerpc/include/asm/iommu.h +3 -0
@@ -116,6 +116,9 @@ extern void iommu_init_early_iSeries(void);extern void iommu_init_early_dart (void );extern void iommu_init_early_pasemi (void ); +/* dma-iommu.c */ +extern int dma_iommu_dma_supported (struct device *dev,u64 mask); +#ifdef CONFIG_PCI extern void pci_iommu_init (void );extern void pci_direct_iommu_init (void );
arch/powerpc/include/asm/pci.h +2 -2
@@ -65,8 +65,8 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) }#ifdef CONFIG_PCI -extern void set_pci_dma_ops (struct dma_map_ops *dma_ops); -extern struct dma_map_ops *get_pci_dma_ops (void ); +extern void set_pci_dma_ops (const struct dma_map_ops *dma_ops); +extern const struct dma_map_ops *get_pci_dma_ops (void );#else /* CONFIG_PCI */ #define set_pci_dma_ops (d)#define get_pci_dma_ops () NULL
arch/powerpc/include/asm/swiotlb.h +1 -1
@@ -13,7 +13,7 @@#include <linux/swiotlb.h> -extern struct dma_map_ops swiotlb_dma_ops; +extern const struct dma_map_ops swiotlb_dma_ops;static inline void dma_mark_clean (void *addr,size_t size) {}
arch/powerpc/kernel/dma-iommu.c +2 -2
@@ -70,7 +70,7 @@ static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, }/* We support DMA to/from any memory page via the iommu */ -static int dma_iommu_dma_supported (struct device *dev,u64 mask) +int dma_iommu_dma_supported (struct device *dev,u64 mask) {struct iommu_table *tbl =get_iommu_table_base (dev);
@@ -89,7 +89,7 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)return 1 ; } -struct dma_map_ops dma_iommu_ops = { +const struct dma_map_ops dma_iommu_ops = { .alloc_coherent = dma_iommu_alloc_coherent, .free_coherent = dma_iommu_free_coherent, .map_sg = dma_iommu_map_sg,
arch/powerpc/kernel/dma-swiotlb.c +1 -1
@@ -31,7 +31,7 @@ unsigned int ppc_swiotlb_enable;* map_page, and unmap_page on highmem, use normal dma_ops * for everything else. */ -struct dma_map_ops swiotlb_dma_ops = { +const struct dma_map_ops swiotlb_dma_ops = { .alloc_coherent = dma_direct_alloc_coherent, .free_coherent = dma_direct_free_coherent, .map_sg = swiotlb_map_sg_attrs,
arch/powerpc/kernel/dma.c +1 -1
@@ -134,7 +134,7 @@ static inline void dma_direct_sync_single_range(struct device *dev, }#endif -struct dma_map_ops dma_direct_ops = { +const struct dma_map_ops dma_direct_ops = { .alloc_coherent = dma_direct_alloc_coherent, .free_coherent = dma_direct_free_coherent, .map_sg = dma_direct_map_sg,
arch/powerpc/kernel/ibmebus.c +1 -1
@@ -127,7 +127,7 @@ static int ibmebus_dma_supported(struct device *dev, u64 mask)return 1 ; } -static struct dma_map_ops ibmebus_dma_ops = { +static const struct dma_map_ops ibmebus_dma_ops = { .alloc_coherent = ibmebus_alloc_coherent, .free_coherent = ibmebus_free_coherent, .map_sg = ibmebus_map_sg,
arch/powerpc/kernel/pci-common.c +3 -3
@@ -50,14 +50,14 @@ resource_size_t isa_mem_base;unsigned int ppc_pci_flags =0 ; -static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; +static const struct dma_map_ops *pci_dma_ops = &dma_direct_ops; -void set_pci_dma_ops (struct dma_map_ops *dma_ops) +void set_pci_dma_ops (const struct dma_map_ops *dma_ops) { pci_dma_ops = dma_ops; } -struct dma_map_ops *get_pci_dma_ops (void ) +const struct dma_map_ops *get_pci_dma_ops (void ) {return pci_dma_ops; }
arch/powerpc/kernel/vio.c +3 -10
@@ -601,14 +601,14 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,vio_cmo_dealloc (viodev, alloc_size); } -struct dma_map_ops vio_dma_mapping_ops = { +static const struct dma_map_ops vio_dma_mapping_ops = { .alloc_coherent = vio_dma_iommu_alloc_coherent, .free_coherent = vio_dma_iommu_free_coherent, .map_sg = vio_dma_iommu_map_sg, .unmap_sg = vio_dma_iommu_unmap_sg, + .dma_supported = dma_iommu_dma_supported, .map_page = vio_dma_iommu_map_page, .unmap_page = vio_dma_iommu_unmap_page, - };/**
@@ -855,12 +855,6 @@ static void vio_cmo_bus_remove(struct vio_dev *viodev)spin_unlock_irqrestore (&vio_cmo.lock, flags); } -static void vio_cmo_set_dma_ops (struct vio_dev *viodev) -{ - vio_dma_mapping_ops.dma_supported = dma_iommu_ops.dma_supported; - viodev->dev.archdata.dma_ops = &vio_dma_mapping_ops; -} -/** * vio_cmo_bus_init - CMO entitlement initialization at bus init time *
@@ -1032,7 +1026,6 @@ int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }void vio_cmo_set_dev_desired (struct vio_dev *viodev,size_t desired) {}static int vio_cmo_bus_probe (struct vio_dev *viodev) {return 0 ; }static void vio_cmo_bus_remove (struct vio_dev *viodev) {} -static void vio_cmo_set_dma_ops (struct vio_dev *viodev) {}static void vio_cmo_bus_init (void ) {}static void vio_cmo_sysfs_init (void ) { }#endif /* CONFIG_PPC_SMLPAR */
@@ -1232,7 +1225,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) viodev->dev.archdata.of_node =of_node_get (of_node);if (firmware_has_feature (FW_FEATURE_CMO )) -vio_cmo_set_dma_ops (viodev); + viodev->dev.archdata.dma_ops = &vio_dma_mapping_ops;else viodev->dev.archdata.dma_ops = &dma_iommu_ops;set_iommu_table_base (&viodev->dev,vio_build_iommu_table (viodev));
arch/powerpc/platforms/cell/iommu.c +1 -1
@@ -642,7 +642,7 @@ static int dma_fixed_dma_supported(struct device *dev, u64 mask)static int dma_set_mask_and_switch (struct device *dev,u64 dma_mask); -struct dma_map_ops dma_iommu_fixed_ops = { +const struct dma_map_ops dma_iommu_fixed_ops = { .alloc_coherent = dma_fixed_alloc_coherent, .free_coherent = dma_fixed_free_coherent, .map_sg = dma_fixed_map_sg,
arch/powerpc/platforms/ps3/system-bus.c +2 -2
@@ -694,7 +694,7 @@ static int ps3_dma_supported(struct device *_dev, u64 mask)return mask >=DMA_BIT_MASK (32 ); } -static struct dma_map_ops ps3_sb_dma_ops = { +static const struct dma_map_ops ps3_sb_dma_ops = { .alloc_coherent = ps3_alloc_coherent, .free_coherent = ps3_free_coherent, .map_sg = ps3_sb_map_sg,
@@ -704,7 +704,7 @@ static struct dma_map_ops ps3_sb_dma_ops = { .unmap_page = ps3_unmap_page, }; -static struct dma_map_ops ps3_ioc0_dma_ops = { +static const struct dma_map_ops ps3_ioc0_dma_ops = { .alloc_coherent = ps3_alloc_coherent, .free_coherent = ps3_free_coherent, .map_sg = ps3_ioc0_map_sg,
arch/sparc/include/asm/dma-mapping.h +4 -4
@@ -14,10 +14,10 @@ extern int dma_set_mask(struct device *dev, u64 dma_mask);#define dma_free_noncoherent (d, s, v, h) dma_free_coherent(d, s, v, h)#define dma_is_consistent (d, h) (1) -extern struct dma_map_ops *dma_ops, pci32_dma_ops; +extern struct const dma_map_ops *dma_ops, pci32_dma_ops;extern struct bus_type pci_bus_type; -static inline struct dma_map_ops *get_dma_ops (struct device *dev) +static inline const struct dma_map_ops *get_dma_ops (struct device *dev) {#if defined(CONFIG_SPARC32 ) && defined(CONFIG_PCI )if (dev->bus == &pci_bus_type)
@@ -31,7 +31,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)static inline void *dma_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t flag) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);void *cpu_addr; cpu_addr = ops->alloc_coherent (dev, size, dma_handle, flag);
@@ -42,7 +42,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,static inline void dma_free_coherent (struct device *dev,size_t size,void *cpu_addr,dma_addr_t dma_handle) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);debug_dma_free_coherent (dev, size, cpu_addr, dma_handle); ops->free_coherent (dev, size, cpu_addr, dma_handle);
arch/sparc/kernel/iommu.c +2 -2
@@ -826,7 +826,7 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev,spin_unlock_irqrestore (&iommu->lock, flags); } -static struct dma_map_ops sun4u_dma_ops = { +static const struct dma_map_ops sun4u_dma_ops = { .alloc_coherent = dma_4u_alloc_coherent, .free_coherent = dma_4u_free_coherent, .map_page = dma_4u_map_page,
@@ -837,7 +837,7 @@ static struct dma_map_ops sun4u_dma_ops = { .sync_sg_for_cpu = dma_4u_sync_sg_for_cpu, }; -struct dma_map_ops *dma_ops = &sun4u_dma_ops; +const struct dma_map_ops *dma_ops = &sun4u_dma_ops;EXPORT_SYMBOL (dma_ops);extern int pci64_dma_supported (struct pci_dev *pdev,u64 device_mask);
arch/sparc/kernel/ioport.c +3 -3
@@ -392,7 +392,7 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg,BUG (); } -struct dma_map_ops sbus_dma_ops = { +const struct dma_map_ops sbus_dma_ops = { .alloc_coherent = sbus_alloc_coherent, .free_coherent = sbus_free_coherent, .map_page = sbus_map_page,
@@ -403,7 +403,7 @@ struct dma_map_ops sbus_dma_ops = { .sync_sg_for_device = sbus_sync_sg_for_device, }; -struct dma_map_ops *dma_ops = &sbus_dma_ops; +const struct dma_map_ops *dma_ops = &sbus_dma_ops;EXPORT_SYMBOL (dma_ops);static int __init sparc_register_ioport (void )
@@ -640,7 +640,7 @@ static void pci32_sync_sg_for_device(struct device *device, struct scatterlist * } } -struct dma_map_ops pci32_dma_ops = { +const struct dma_map_ops pci32_dma_ops = { .alloc_coherent = pci32_alloc_coherent, .free_coherent = pci32_free_coherent, .map_page = pci32_map_page,
arch/sparc/kernel/pci_sun4v.c +1 -1
@@ -525,7 +525,7 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,spin_unlock_irqrestore (&iommu->lock, flags); } -static struct dma_map_ops sun4v_dma_ops = { +static const struct dma_map_ops sun4v_dma_ops = { .alloc_coherent = dma_4v_alloc_coherent, .free_coherent = dma_4v_free_coherent, .map_page = dma_4v_map_page,
arch/x86/include/asm/device.h +1 -1
@@ -6,7 +6,7 @@ struct dev_archdata {void *acpi_handle;#endif #ifdef CONFIG_X86_64 -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;#endif #ifdef CONFIG_DMAR void *iommu;/* hook for IOMMU specific extension */
arch/x86/include/asm/dma-mapping.h +5 -5
@@ -25,9 +25,9 @@ extern int iommu_merge;extern struct device x86_dma_fallback_dev;extern int panic_on_overflow; -extern struct dma_map_ops *dma_ops; +extern const struct dma_map_ops *dma_ops; -static inline struct dma_map_ops *get_dma_ops (struct device *dev) +static inline const struct dma_map_ops *get_dma_ops (struct device *dev) {#ifdef CONFIG_X86_32 return dma_ops;
@@ -44,7 +44,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)/* Make sure we keep the same behaviour */ static inline int dma_mapping_error (struct device *dev,dma_addr_t dma_addr) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);if (ops->mapping_error)return ops->mapping_error (dev, dma_addr);
@@ -122,7 +122,7 @@ static inline void * dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);void *memory; gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
@@ -149,7 +149,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,static inline void dma_free_coherent (struct device *dev,size_t size,void *vaddr,dma_addr_t bus) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);WARN_ON (irqs_disabled ());/* for portability */
arch/x86/include/asm/iommu.h +1 -1
@@ -3,7 +3,7 @@extern void pci_iommu_shutdown (void );extern void no_iommu_init (void ); -extern struct dma_map_ops nommu_dma_ops; +extern const struct dma_map_ops nommu_dma_ops;extern int force_iommu, no_iommu;extern int iommu_detected;extern int iommu_pass_through;
arch/x86/kernel/amd_iommu.c +1 -1
@@ -2069,7 +2069,7 @@ static void prealloc_protection_domains(void) } } -static struct dma_map_ops amd_iommu_dma_ops = { +static const struct dma_map_ops amd_iommu_dma_ops = { .alloc_coherent = alloc_coherent, .free_coherent = free_coherent, .map_page = map_page,
arch/x86/kernel/pci-calgary_64.c +1 -1
@@ -470,7 +470,7 @@ static void calgary_free_coherent(struct device *dev, size_t size,free_pages ((unsigned long )vaddr,get_order (size)); } -static struct dma_map_ops calgary_dma_ops = { +static const struct dma_map_ops calgary_dma_ops = { .alloc_coherent = calgary_alloc_coherent, .free_coherent = calgary_free_coherent, .map_sg = calgary_map_sg,
arch/x86/kernel/pci-dma.c +2 -2
@@ -14,7 +14,7 @@static int forbid_dac__read_mostly ; -struct dma_map_ops *dma_ops; +const struct dma_map_ops *dma_ops;EXPORT_SYMBOL (dma_ops);static int iommu_sac_force__read_mostly ;
@@ -243,7 +243,7 @@ early_param("iommu", iommu_setup);int dma_supported (struct device *dev,u64 mask) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);#ifdef CONFIG_PCI if (mask >0xffffffff && forbid_dac >0 ) {
arch/x86/kernel/pci-gart_64.c +1 -1
@@ -679,7 +679,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info)return -1 ; } -static struct dma_map_ops gart_dma_ops = { +static const struct dma_map_ops gart_dma_ops = { .map_sg = gart_map_sg, .unmap_sg = gart_unmap_sg, .map_page = gart_map_page,
arch/x86/kernel/pci-nommu.c +1 -1
@@ -94,7 +94,7 @@ static void nommu_sync_sg_for_device(struct device *dev,flush_write_buffers (); } -struct dma_map_ops nommu_dma_ops = { +const struct dma_map_ops nommu_dma_ops = { .alloc_coherent = dma_generic_alloc_coherent, .free_coherent = nommu_free_coherent, .map_sg = nommu_map_sg,
arch/x86/kernel/pci-swiotlb.c +1 -1
@@ -25,7 +25,7 @@ static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size,return swiotlb_alloc_coherent (hwdev, size, dma_handle, flags); } -static struct dma_map_ops swiotlb_dma_ops = { +static const struct dma_map_ops swiotlb_dma_ops = { .mapping_error = swiotlb_dma_mapping_error, .alloc_coherent = x86_swiotlb_alloc_coherent, .free_coherent = swiotlb_free_coherent,
drivers/pci/intel-iommu.c +1 -1
@@ -2937,7 +2937,7 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr)return !dma_addr; } -struct dma_map_ops intel_dma_ops = { +const struct dma_map_ops intel_dma_ops = { .alloc_coherent = intel_alloc_coherent, .free_coherent = intel_free_coherent, .map_sg = intel_map_sg,
include/asm-generic/dma-mapping-common.h +12 -12
@@ -11,7 +11,7 @@ static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);dma_addr_t addr;kmemcheck_mark_initialized (ptr, size);
@@ -30,7 +30,7 @@ static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr,enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));if (ops->unmap_page)
@@ -42,7 +42,7 @@ static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);int i, ents;struct scatterlist *s;
@@ -59,7 +59,7 @@ static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));debug_dma_unmap_sg (dev, sg, nents, dir);
@@ -71,7 +71,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, size_t offset, size_t size, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); +const struct dma_map_ops *ops =get_dma_ops (dev);dma_addr_t addr;kmemcheck_mark_initialized (page_address (page) + offset, size);
@@ -85,7 +85,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,static inline void dma_unmap_page (struct device *dev,dma_addr_t addr,size_t size,enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->unmap_page)
@@ -97,7 +97,7 @@ static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_for_cpu)
@@ -109,7 +109,7 @@ static inline void dma_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_for_device)
@@ -123,7 +123,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev, size_t size, enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_range_for_cpu) {
@@ -140,7 +140,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev, size_t size, enum dma_data_direction dir) { -struct dma_map_ops *ops =get_dma_ops (dev); +const struct dma_map_ops *ops =get_dma_ops (dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_single_range_for_device) {
@@ -155,7 +155,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_sg_for_cpu)
@@ -167,7 +167,7 @@ static inline void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) { - struct dma_map_ops *ops = get_dma_ops(dev); + const struct dma_map_ops *ops = get_dma_ops(dev);BUG_ON (!valid_dma_direction (dir));if (ops->sync_sg_for_device)
include/linux/dma-mapping.h +16 -16
@@ -16,50 +16,50 @@ enum dma_data_direction { };struct dma_map_ops { -void * (*alloc_coherent)(struct device *dev,size_t size, +void * (*const alloc_coherent)(struct device *dev,size_t size,dma_addr_t *dma_handle,gfp_t gfp); -void (*free_coherent)(struct device *dev,size_t size, +void (*const free_coherent)(struct device *dev,size_t size,void *vaddr,dma_addr_t dma_handle); -dma_addr_t (*map_page)(struct device *dev,struct page *page, +dma_addr_t (*const map_page)(struct device *dev,struct page *page,unsigned long offset,size_t size,enum dma_data_direction dir,struct dma_attrs *attrs); -void (*unmap_page)(struct device *dev,dma_addr_t dma_handle, +void (*const unmap_page)(struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction dir,struct dma_attrs *attrs); -int (*map_sg)(struct device *dev,struct scatterlist *sg, +int (*const map_sg)(struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir,struct dma_attrs *attrs); -void (*unmap_sg)(struct device *dev, +void (*const unmap_sg)(struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir,struct dma_attrs *attrs); -void (*sync_single_for_cpu)(struct device *dev, +void (*const sync_single_for_cpu)(struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction dir); -void (*sync_single_for_device)(struct device *dev, +void (*const sync_single_for_device)(struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction dir); -void (*sync_single_range_for_cpu)(struct device *dev, +void (*const sync_single_range_for_cpu)(struct device *dev,dma_addr_t dma_handle,unsigned long offset,size_t size,enum dma_data_direction dir); -void (*sync_single_range_for_device)(struct device *dev, +void (*const sync_single_range_for_device)(struct device *dev,dma_addr_t dma_handle,unsigned long offset,size_t size,enum dma_data_direction dir); -void (*sync_sg_for_cpu)(struct device *dev, +void (*const sync_sg_for_cpu)(struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir); -void (*sync_sg_for_device)(struct device *dev, +void (*const sync_sg_for_device)(struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir); -int (*mapping_error)(struct device *dev,dma_addr_t dma_addr); -int (*dma_supported)(struct device *dev,u64 mask); -int (*set_dma_mask)(struct device *dev,u64 mask); -int is_phys; +int (*const mapping_error)(struct device *dev,dma_addr_t dma_addr); +int (*const dma_supported)(struct device *dev,u64 mask); +int (*const set_dma_mask)(struct device *dev,u64 mask); +const int is_phys; };#define DMA_BIT_MASK (n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
Re: [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1
Hi Emese,
Quoted 3 lines · On Sat, 05 Dec 2009 03:00:25 +0100 Emese Revfy <[email protected]> wrote:
Ok, I made the changes, I also removed the
vio_cmo_set_dma_opsfunction because I think it is now unnecessary.
It is necessary because vio_dma_mapping_ops is only defined when CONFIG_PPC_SMLPAR is set, but that function was called from unconditional code (and there was a trivial version for when CONFIG_PPC_SMLPAR was not set) i.e. we only want the dma_ops set if we were built with CONFIG_PPC_SMLPAR.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1
Quoted 11 lines · Stephen Rothwell
Hi Emese,
Quoted 2 lines · On Sat, 05 Dec 2009 03:00:25 +0100 Emese Revfy <[email protected]> wrote:
Ok, I made the changes, I also removed the
vio_cmo_set_dma_opsfunction because I think it is now unnecessary.It is necessary because
vio_dma_mapping_opsis only defined whenCONFIG_PPC_SMLPARis set, but that function was called from unconditional code (and there was a trivial version for whenCONFIG_PPC_SMLPARwas not set) i.e. we only want thedma_opsset if we were built withCONFIG_PPC_SMLPAR.
I already took care of these, look at these hunks:
@@ -1033,7 +1026,6 @@ int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {} static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; }
static void vio_cmo_bus_remove(struct vio_dev *viodev) {}
-static void vio_cmo_set_dma_ops(struct vio_dev *viodev) {}
static void vio_cmo_bus_init(void) {}
static void vio_cmo_sysfs_init(void) { }
#endif /* CONFIG_PPC_SMLPAR */
@@ -1233,7 +1225,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
viodev->dev.archdata.of_node = of_node_get(of_node);
if (firmware_has_feature(FW_FEATURE_CMO))
- vio_cmo_set_dma_ops(viodev);
+ viodev->dev.archdata.dma_ops = &vio_dma_mapping_ops;
else
viodev->dev.archdata.dma_ops = &dma_iommu_ops;
set_iommu_table_base(&viodev->dev, vio_build_iommu_table(viodev));
If you think it's not enough please let me know.
--
Emese
Re: [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1
Hi Emese,
Quoted 12 lines · On Sat, 05 Dec 2009 03:25:23 +0100 Emese Revfy <[email protected]> wrote:
I already took care of these, look at these hunks:
arch/powerpc/kernel/vio.c +0
-1@@ -1033,7 +1026,6 @@ int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }void vio_cmo_set_dev_desired (struct vio_dev *viodev,size_t desired) {}static int vio_cmo_bus_probe (struct vio_dev *viodev) {return 0 ; }static void vio_cmo_bus_remove (struct vio_dev *viodev) {} -static void vio_cmo_set_dma_ops (struct vio_dev *viodev) {}static void vio_cmo_bus_init (void ) {}static void vio_cmo_sysfs_init (void ) { }#endif /* CONFIG_PPC_SMLPAR */
arch/powerpc/kernel/vio.c struct vio_dev *vio_register_device_node(struct device_node *of_node) · line 1228
Quoted 5 lines
arch/powerpc/kernel/vio.c +1
-1@@ -1233,7 +1225,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) viodev->dev.archdata.of_node =of_node_get (of_node);if (firmware_has_feature (FW_FEATURE_CMO )) -vio_cmo_set_dma_ops (viodev); + viodev->dev.archdata.dma_ops = &vio_dma_mapping_ops;
This code is not inside a #ifdef CONFIG_PPC_SMLPAR section, so vio_dma_mapping_ops may not exist here.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 11/31] Constify struct file_operations for 2.6.32 v1
In reply to Greg KHQuoted 78 lines · Greg KH
Quoted 63 lines · Emese Revfy
From: Emese Revfy <[email protected]>
Constify struct
file_operationswith some exceptions.
Per Dave Miller's suggestion, resend with proper CC list and patch format.Signed-off-by Emese Revfy <[email protected]>--- drivers/acpi/battery.c | 2 +- drivers/char/pty.c | 16 +++++++++--- drivers/char/tty_io.c | 28 ++++----------------- drivers/media/dvb/dvb-core/dvbdev.c | 1 + drivers/net/wireless/b43/debugfs.c | 2 +- drivers/net/wireless/b43legacy/debugfs.c | 2 +- drivers/net/wireless/libertas/debugfs.c | 2 +- drivers/staging/b3dfg/b3dfg.c | 2 +- drivers/staging/dream/qdsp5/adsp_driver.c | 2 +- drivers/staging/dream/qdsp5/audio_aac.c | 2 +- drivers/staging/dream/qdsp5/audio_amrnb.c | 2 +- drivers/staging/dream/qdsp5/audio_evrc.c | 2 +- drivers/staging/dream/qdsp5/audio_in.c | 4 +- drivers/staging/dream/qdsp5/audio_mp3.c | 2 +- drivers/staging/dream/qdsp5/audio_out.c | 4 +- drivers/staging/dream/qdsp5/audio_qcelp.c | 2 +- drivers/staging/dream/qdsp5/snd.c | 2 +- drivers/staging/dream/smd/smd_qmi.c | 2 +- drivers/staging/dream/smd/smd_rpcrouter_device.c | 4 +- drivers/staging/panel/panel.c | 4 +- drivers/staging/poch/poch.c | 2 +- drivers/staging/sep/sep_driver.c | 2 +- drivers/staging/vme/devices/vme_user.c | 2 +- fs/fuse/cuse.c | 20 +++++++++------ fs/fuse/dev.c | 8 +++--- fs/fuse/fuse_i.h | 10 ++++++++ include/linux/tty.h | 14 ++++++++++- include/net/tcp.h | 1 + include/net/udp.h | 1 + kernel/trace/trace_events.c | 2 + virt/kvm/kvm_main.c | 3 ++ 31 files changed, 89 insertions(+), 63 deletions(-)drivers/acpi/battery.c +1
-1@@ -763,7 +763,7 @@ DECLARE_FILE_FUNCTIONS(alarm); }static struct battery_file { -struct file_operations ops; +const struct file_operations ops;mode_t mode;const char *name; } acpi_battery_file[] = {drivers/char/pty.c +1
-1@@ -682,7 +682,18 @@ static int ptmx_open(struct inode *inode, struct file *filp)return ret; } -static struct file_operations ptmx_fops; +static const struct file_operations ptmx_fops = {drivers/char/pty.c static int ptmx_open(struct inode *inode, struct file *filp) · line 695
Quoted 10 lines
drivers/char/pty.c +10
-0+ .llseek = no_llseek, + .read = tty_read, + .write = tty_write, + .poll = tty_poll, + .unlocked_ioctl = tty_ioctl, + .compat_ioctl = tty_compat_ioctl, + .open = ptmx_open, + .release = tty_release, + .fasync = tty_fasync, +};You just made these functions all global, for no real good reason. Why did you do this?
Quoted 3 lines
confused,
greg k-h
I think this is the only way to make ptmx_fops const, provided we want to. --
Emese