iput(disk->part0->bd_inode);    /* frees the disk */
 }
 
-static int block_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int block_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct gendisk *disk = dev_to_disk(dev);
+       const struct gendisk *disk = dev_to_disk(dev);
 
        return add_uevent_var(env, "DISKSEQ=%llu", disk->diskseq);
 }
 
 };
 ATTRIBUTE_GROUPS(firmware_class);
 
-static int do_firmware_uevent(struct fw_sysfs *fw_sysfs, struct kobj_uevent_env *env)
+static int do_firmware_uevent(const struct fw_sysfs *fw_sysfs, struct kobj_uevent_env *env)
 {
        if (add_uevent_var(env, "FIRMWARE=%s", fw_sysfs->fw_priv->fw_name))
                return -ENOMEM;
        return 0;
 }
 
-static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int firmware_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
+       const struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
        int err = 0;
 
        mutex_lock(&fw_lock);
 
        void *fw_upload_priv;
 };
 
-static inline struct fw_sysfs *to_fw_sysfs(struct device *dev)
+static inline struct fw_sysfs *to_fw_sysfs(const struct device *dev)
 {
        return container_of(dev, struct fw_sysfs, dev);
 }
 
        NULL
 };
 
-static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
        ssize_t len;
 
 
        [GNSS_TYPE_MTK]         = "MTK",
 };
 
-static const char *gnss_type_name(struct gnss_device *gdev)
+static const char *gnss_type_name(const struct gnss_device *gdev)
 {
        const char *name = NULL;
 
 };
 ATTRIBUTE_GROUPS(gnss);
 
-static int gnss_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int gnss_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct gnss_device *gdev = to_gnss_device(dev);
+       const struct gnss_device *gdev = to_gnss_device(dev);
        int ret;
 
        ret = add_uevent_var(env, "GNSS_TYPE=%s", gnss_type_name(gdev));
 
        kfree_rcu(dev, rcu_head);
 }
 
-static int ib_device_uevent(struct device *device,
+static int ib_device_uevent(const struct device *device,
                            struct kobj_uevent_env *env)
 {
        if (add_uevent_var(env, "NAME=%s", dev_name(device)))
 
 };
 ATTRIBUTE_GROUPS(mISDN);
 
-static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int mISDN_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct mISDNdevice *mdev = dev_to_mISDN(dev);
+       const struct mISDNdevice *mdev = dev_to_mISDN(dev);
 
        if (!mdev)
                return 0;
 
 EXPORT_SYMBOL_GPL(dvb_module_release);
 #endif
 
-static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int dvb_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct dvb_device *dvbdev = dev_get_drvdata(dev);
+       const struct dvb_device *dvbdev = dev_get_drvdata(dev);
 
        add_uevent_var(env, "DVB_ADAPTER_NUM=%d", dvbdev->adapter->num);
        add_uevent_var(env, "DVB_DEVICE_TYPE=%s", dnames[dvbdev->type]);
 
 }
 EXPORT_SYMBOL_GPL(nvme_remove_namespaces);
 
-static int nvme_class_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int nvme_class_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct nvme_ctrl *ctrl =
+       const struct nvme_ctrl *ctrl =
                container_of(dev, struct nvme_ctrl, ctrl_device);
        struct nvmf_ctrl_options *opts = ctrl->opts;
        int ret;
 
 EXPORT_SYMBOL(pcmcia_reset_card);
 
 
-static int pcmcia_socket_uevent(struct device *dev,
+static int pcmcia_socket_uevent(const struct device *dev,
                                struct kobj_uevent_env *env)
 {
-       struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
+       const struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
 
        if (add_uevent_var(env, "SOCKET_NO=%u", s->sock))
                return -ENOMEM;
 
 #ifdef CONFIG_SYSFS
 
 extern void power_supply_init_attrs(struct device_type *dev_type);
-extern int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env);
+extern int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env);
 
 #else
 
 
        }
 }
 
-static int add_prop_uevent(struct device *dev, struct kobj_uevent_env *env,
+static int add_prop_uevent(const struct device *dev, struct kobj_uevent_env *env,
                           enum power_supply_property prop, char *prop_buf)
 {
        int ret = 0;
        pwr_attr = &power_supply_attrs[prop];
        dev_attr = &pwr_attr->dev_attr;
 
-       ret = power_supply_show_property(dev, dev_attr, prop_buf);
+       ret = power_supply_show_property((struct device *)dev, dev_attr, prop_buf);
        if (ret == -ENODEV || ret == -ENODATA) {
                /*
                 * When a battery is absent, we expect -ENODEV. Don't abort;
                              pwr_attr->prop_name, prop_buf);
 }
 
-int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
+int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       const struct power_supply *psy = dev_get_drvdata(dev);
        int ret = 0, j;
        char *prop_buf;
 
 
        NULL,
 };
 
-static int usb_udc_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int usb_udc_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
-       struct usb_udc          *udc = container_of(dev, struct usb_udc, dev);
+       const struct usb_udc    *udc = container_of(dev, struct usb_udc, dev);
        int                     ret;
 
        ret = add_uevent_var(env, "USB_UDC_NAME=%s", udc->gadget->name);
 
        const struct attribute_group    **dev_groups;
        struct kobject                  *dev_kobj;
 
-       int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
+       int (*dev_uevent)(const struct device *dev, struct kobj_uevent_env *env);
        char *(*devnode)(struct device *dev, umode_t *mode);
 
        void (*class_release)(struct class *class);
 
                                                void *);
 extern void    mISDN_unregister_clock(struct mISDNclock *);
 
-static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
+static inline struct mISDNdevice *dev_to_mISDN(const struct device *dev)
 {
        if (dev)
                return dev_get_drvdata(dev);
 
 };
 
 
-static int atm_uevent(struct device *cdev, struct kobj_uevent_env *env)
+static int atm_uevent(const struct device *cdev, struct kobj_uevent_env *env)
 {
-       struct atm_dev *adev;
+       const struct atm_dev *adev;
 
        if (!cdev)
                return -ENODEV;
 
 };
 EXPORT_SYMBOL_GPL(net_ns_type_operations);
 
-static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
+static int netdev_uevent(const struct device *d, struct kobj_uevent_env *env)
 {
-       struct net_device *dev = to_net_dev(d);
+       const struct net_device *dev = to_net_dev(d);
        int retval;
 
        /* pass interface to uevent. */
 
        kfree(rfkill);
 }
 
-static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int rfkill_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
 {
        struct rfkill *rfkill = to_rfkill(dev);
        unsigned long flags;