2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-27 12:04:22 +08:00

driver core: make struct bus_type.uevent() take a const *

The uevent() callback in struct bus_type should not be modifying the
device that is passed into it, so mark it as a const * and propagate the
function signature changes out into all relevant subsystems that use
this callback.

Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230111113018.459199-16-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2023-01-11 12:30:17 +01:00
parent c6e8418521
commit 2a81ada32f
81 changed files with 160 additions and 160 deletions

View File

@ -199,9 +199,9 @@ static struct attribute *gio_dev_attrs[] = {
};
ATTRIBUTE_GROUPS(gio_dev);
static int gio_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static int gio_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct gio_device *gio_dev = to_gio_device(dev);
const struct gio_device *gio_dev = to_gio_device(dev);
add_uevent_var(env, "MODALIAS=gio:%x", gio_dev->id.id);
return 0;

View File

@ -552,7 +552,7 @@ static int parisc_generic_match(struct device *dev, struct device_driver *drv)
return match_device(to_parisc_driver(drv), to_parisc_device(dev));
}
static ssize_t make_modalias(struct device *dev, char *buf)
static ssize_t make_modalias(const struct device *dev, char *buf)
{
const struct parisc_device *padev = to_parisc_device(dev);
const struct parisc_device_id *id = &padev->id;
@ -562,7 +562,7 @@ static ssize_t make_modalias(struct device *dev, char *buf)
(u32)id->sversion);
}
static int parisc_uevent(struct device *dev, struct kobj_uevent_env *env)
static int parisc_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const struct parisc_device *padev;
char modalias[40];

View File

@ -1609,10 +1609,10 @@ static int vio_bus_match(struct device *dev, struct device_driver *drv)
return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL);
}
static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
static int vio_hotplug(const struct device *dev, struct kobj_uevent_env *env)
{
const struct vio_dev *vio_dev = to_vio_dev(dev);
struct device_node *dn;
const struct device_node *dn;
const char *cp;
dn = dev->of_node;

View File

@ -46,7 +46,7 @@ static const struct vio_device_id *vio_match_device(
return NULL;
}
static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
static int vio_hotplug(const struct device *dev, struct kobj_uevent_env *env)
{
const struct vio_dev *vio_dev = to_vio_dev(dev);

View File

@ -1014,7 +1014,7 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv)
&& !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
}
static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static int acpi_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
return __acpi_device_uevent_modalias(to_acpi_device(dev), env);
}

View File

@ -235,9 +235,9 @@ static int amba_match(struct device *dev, struct device_driver *drv)
return amba_lookup(pcdrv->id_table, pcdev) != NULL;
}
static int amba_uevent(struct device *dev, struct kobj_uevent_env *env)
static int amba_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct amba_device *pcdev = to_amba_device(dev);
const struct amba_device *pcdev = to_amba_device(dev);
int retval = 0;
retval = add_uevent_var(env, "AMBA_ID=%08x", pcdev->periphid);

View File

@ -185,7 +185,7 @@ static int auxiliary_match(struct device *dev, struct device_driver *drv)
return !!auxiliary_match_id(auxdrv->id_table, auxdev);
}
static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env)
static int auxiliary_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const char *name, *p;

View File

@ -336,7 +336,7 @@ static ssize_t print_cpu_modalias(struct device *dev,
return len;
}
static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env)
static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (buf) {

View File

@ -1353,9 +1353,9 @@ static int platform_match(struct device *dev, struct device_driver *drv)
return (strcmp(pdev->name, drv->name) == 0);
}
static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
static int platform_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct platform_device *pdev = to_platform_device(dev);
const struct platform_device *pdev = to_platform_device(dev);
int rc;
/* Some devices have extra OF data and an OF-style MODALIAS */

View File

@ -28,7 +28,7 @@ static DEFINE_MUTEX(bcma_buses_mutex);
static int bcma_bus_match(struct device *dev, struct device_driver *drv);
static int bcma_device_probe(struct device *dev);
static void bcma_device_remove(struct device *dev);
static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env);
static int bcma_device_uevent(const struct device *dev, struct kobj_uevent_env *env);
static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, char *buf)
{
@ -627,9 +627,9 @@ static void bcma_device_remove(struct device *dev)
put_device(dev);
}
static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static int bcma_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct bcma_device *core = container_of(dev, struct bcma_device, dev);
const struct bcma_device *core = container_of_const(dev, struct bcma_device, dev);
return add_uevent_var(env,
"MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X",

View File

@ -124,9 +124,9 @@ out:
/*
* fsl_mc_bus_uevent - callback invoked when a device is added
*/
static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int fsl_mc_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
const struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
if (add_uevent_var(env, "MODALIAS=fsl-mc:v%08Xd%s",
mc_dev->obj_desc.vendor,

View File

@ -1543,9 +1543,9 @@ void mhi_ep_driver_unregister(struct mhi_ep_driver *mhi_drv)
}
EXPORT_SYMBOL_GPL(mhi_ep_driver_unregister);
static int mhi_ep_uevent(struct device *dev, struct kobj_uevent_env *env)
static int mhi_ep_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct mhi_ep_device *mhi_dev = to_mhi_ep_device(dev);
const struct mhi_ep_device *mhi_dev = to_mhi_ep_device(dev);
return add_uevent_var(env, "MODALIAS=" MHI_EP_DEVICE_MODALIAS_FMT,
mhi_dev->name);

View File

@ -1395,9 +1395,9 @@ void mhi_driver_unregister(struct mhi_driver *mhi_drv)
}
EXPORT_SYMBOL_GPL(mhi_driver_unregister);
static int mhi_uevent(struct device *dev, struct kobj_uevent_env *env)
static int mhi_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct mhi_device *mhi_dev = to_mhi_device(dev);
const struct mhi_device *mhi_dev = to_mhi_device(dev);
return add_uevent_var(env, "MODALIAS=" MHI_DEVICE_MODALIAS_FMT,
mhi_dev->name);

View File

@ -67,9 +67,9 @@ static int mips_cdmm_match(struct device *dev, struct device_driver *drv)
return mips_cdmm_lookup(cdrv->id_table, cdev) != NULL;
}
static int mips_cdmm_uevent(struct device *dev, struct kobj_uevent_env *env)
static int mips_cdmm_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct mips_cdmm_device *cdev = to_mips_cdmm_device(dev);
const struct mips_cdmm_device *cdev = to_mips_cdmm_device(dev);
int retval = 0;
retval = add_uevent_var(env, "CDMM_CPU=%u", cdev->cpu);

View File

@ -172,7 +172,7 @@ static void sunxi_rsb_device_remove(struct device *dev)
drv->remove(to_sunxi_rsb_device(dev));
}
static int sunxi_rsb_device_modalias(struct device *dev, struct kobj_uevent_env *env)
static int sunxi_rsb_device_modalias(const struct device *dev, struct kobj_uevent_env *env)
{
return of_device_uevent_modalias(dev, env);
}

View File

@ -162,7 +162,7 @@ static const struct device_type cxl_memdev_type = {
.groups = cxl_memdev_attribute_groups,
};
bool is_cxl_memdev(struct device *dev)
bool is_cxl_memdev(const struct device *dev)
{
return dev->type == &cxl_memdev_type;
}

View File

@ -38,7 +38,7 @@ static ssize_t devtype_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(devtype);
static int cxl_device_id(struct device *dev)
static int cxl_device_id(const struct device *dev)
{
if (dev->type == &cxl_nvdimm_bridge_type)
return CXL_DEVICE_NVDIMM_BRIDGE;
@ -523,13 +523,13 @@ static const struct device_type cxl_port_type = {
.groups = cxl_port_attribute_groups,
};
bool is_cxl_port(struct device *dev)
bool is_cxl_port(const struct device *dev)
{
return dev->type == &cxl_port_type;
}
EXPORT_SYMBOL_NS_GPL(is_cxl_port, CXL);
struct cxl_port *to_cxl_port(struct device *dev)
struct cxl_port *to_cxl_port(const struct device *dev)
{
if (dev_WARN_ONCE(dev, dev->type != &cxl_port_type,
"not a cxl_port device\n"))
@ -1826,7 +1826,7 @@ void cxl_driver_unregister(struct cxl_driver *cxl_drv)
}
EXPORT_SYMBOL_NS_GPL(cxl_driver_unregister, CXL);
static int cxl_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int cxl_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
return add_uevent_var(env, "MODALIAS=" CXL_MODALIAS_FMT,
cxl_device_id(dev));

View File

@ -588,8 +588,8 @@ static inline bool is_cxl_root(struct cxl_port *port)
return port->uport == port->dev.parent;
}
bool is_cxl_port(struct device *dev);
struct cxl_port *to_cxl_port(struct device *dev);
bool is_cxl_port(const struct device *dev);
struct cxl_port *to_cxl_port(const struct device *dev);
struct pci_bus;
int devm_cxl_register_pci_bus(struct device *host, struct device *uport,
struct pci_bus *bus);

View File

@ -72,7 +72,7 @@ cxled_to_memdev(struct cxl_endpoint_decoder *cxled)
return to_cxl_memdev(port->uport);
}
bool is_cxl_memdev(struct device *dev);
bool is_cxl_memdev(const struct device *dev);
static inline bool is_cxl_endpoint(struct cxl_port *port)
{
return is_cxl_memdev(port->uport);

View File

@ -18,7 +18,7 @@ struct dax_id {
char dev_name[DAX_NAME_LEN];
};
static int dax_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int dax_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
/*
* We only ever expect to handle device-dax instances, i.e. the

View File

@ -127,9 +127,9 @@ static int eisa_bus_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int eisa_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int eisa_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct eisa_device *edev = to_eisa_device(dev);
const struct eisa_device *edev = to_eisa_device(dev);
add_uevent_var(env, "MODALIAS=" EISA_DEVICE_MODALIAS_FMT, edev->id.sig);
return 0;

View File

@ -56,9 +56,9 @@ static void ffa_device_remove(struct device *dev)
ffa_drv->remove(to_ffa_dev(dev));
}
static int ffa_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static int ffa_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct ffa_device *ffa_dev = to_ffa_dev(dev);
const struct ffa_device *ffa_dev = to_ffa_dev(dev);
return add_uevent_var(env, "MODALIAS=arm_ffa:%04x:%pUb",
ffa_dev->vm_id, &ffa_dev->uuid);

View File

@ -293,9 +293,9 @@ static void dfl_bus_remove(struct device *dev)
ddrv->remove(ddev);
}
static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int dfl_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct dfl_device *ddev = to_dfl_dev(dev);
const struct dfl_device *ddev = to_dfl_dev(dev);
return add_uevent_var(env, "MODALIAS=dfl:t%04Xf%04X",
ddev->type, ddev->feature_id);

View File

@ -62,9 +62,9 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env)
static int mipi_dsi_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
const struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
int err;
err = of_device_uevent_modalias(dev, env);

View File

@ -338,7 +338,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)
return strcmp(dev_name(dev), drv->name) == 0;
}
static int host1x_device_uevent(struct device *dev,
static int host1x_device_uevent(const struct device *dev,
struct kobj_uevent_env *env)
{
struct device_node *np = dev->parent->of_node;

View File

@ -78,14 +78,14 @@ static int greybus_match_device(struct device *dev, struct device_driver *drv)
return 0;
}
static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int greybus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct gb_host_device *hd;
struct gb_module *module = NULL;
struct gb_interface *intf = NULL;
struct gb_control *control = NULL;
struct gb_bundle *bundle = NULL;
struct gb_svc *svc = NULL;
const struct gb_host_device *hd;
const struct gb_module *module = NULL;
const struct gb_interface *intf = NULL;
const struct gb_control *control = NULL;
const struct gb_bundle *bundle = NULL;
const struct gb_svc *svc = NULL;
if (is_gb_host_device(dev)) {
hd = to_gb_host_device(dev);

View File

@ -2664,9 +2664,9 @@ static const struct attribute_group hid_dev_group = {
};
__ATTRIBUTE_GROUPS(hid_dev);
static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct hid_device *hdev = to_hid_device(dev);
const struct hid_device *hdev = to_hid_device(dev);
if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X",
hdev->bus, hdev->vendor, hdev->product))

View File

@ -361,7 +361,7 @@ static struct attribute *ishtp_cl_dev_attrs[] = {
};
ATTRIBUTE_GROUPS(ishtp_cl_dev);
static int ishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
static int ishtp_cl_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
if (add_uevent_var(env, "MODALIAS=" ISHTP_MODULE_PREFIX "%s", dev_name(dev)))
return -ENOMEM;

View File

@ -30,7 +30,7 @@ static struct attribute *hsi_bus_dev_attrs[] = {
};
ATTRIBUTE_GROUPS(hsi_bus_dev);
static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int hsi_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev));

View File

@ -711,9 +711,9 @@ __ATTRIBUTE_GROUPS(vmbus_bus);
* representation of the device guid (each byte of the guid will be
* represented with two hex characters.
*/
static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
static int vmbus_uevent(const struct device *device, struct kobj_uevent_env *env)
{
struct hv_device *dev = device_to_hv_device(device);
const struct hv_device *dev = device_to_hv_device(device);
const char *format = "MODALIAS=vmbus:%*phN";
return add_uevent_var(env, format, UUID_SIZE, &dev->dev_type);

View File

@ -895,9 +895,9 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)
return err; \
} while (0)
static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
static int serio_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct serio *serio;
const struct serio *serio;
if (!dev)
return -ENODEV;

View File

@ -76,9 +76,9 @@ static void ipack_bus_remove(struct device *device)
drv->ops->remove(dev);
}
static int ipack_uevent(struct device *dev, struct kobj_uevent_env *env)
static int ipack_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct ipack_device *idev;
const struct ipack_device *idev;
if (!dev)
return -ENODEV;

View File

@ -128,7 +128,7 @@ static int macio_device_resume(struct device * dev)
return 0;
}
static int macio_device_modalias(struct device *dev, struct kobj_uevent_env *env)
static int macio_device_modalias(const struct device *dev, struct kobj_uevent_env *env)
{
return of_device_uevent_modalias(dev, env);
}

View File

@ -41,9 +41,9 @@ static int mcb_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int mcb_uevent(struct device *dev, struct kobj_uevent_env *env)
static int mcb_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct mcb_device *mdev = to_mcb_device(dev);
const struct mcb_device *mdev = to_mcb_device(dev);
int ret;
ret = add_uevent_var(env, "MODALIAS=mcb:16z%03d", mdev->id);

View File

@ -57,10 +57,10 @@ static int memstick_bus_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int memstick_uevent(struct device *dev, struct kobj_uevent_env *env)
static int memstick_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct memstick_dev *card = container_of(dev, struct memstick_dev,
dev);
const struct memstick_dev *card = container_of_const(dev, struct memstick_dev,
dev);
if (add_uevent_var(env, "MEMSTICK_TYPE=%02X", card->id.type))
return -ENOMEM;

View File

@ -1227,9 +1227,9 @@ ATTRIBUTE_GROUPS(mei_cldev);
*
* Return: 0 on success -ENOMEM on when add_uevent_var fails
*/
static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static int mei_cl_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct mei_cl_device *cldev = to_mei_cl_device(dev);
const struct mei_cl_device *cldev = to_mei_cl_device(dev);
const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
u8 version = mei_me_cl_ver(cldev->me_cl);

View File

@ -55,9 +55,9 @@ static int tifm_bus_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int tifm_uevent(struct device *dev, struct kobj_uevent_env *env)
static int tifm_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
const struct tifm_dev *sock = container_of_const(dev, struct tifm_dev, dev);
if (add_uevent_var(env, "TIFM_CARD_TYPE=%s", tifm_media_type_name(sock->type, 1)))
return -ENOMEM;

View File

@ -55,9 +55,9 @@ static struct attribute *mmc_dev_attrs[] = {
ATTRIBUTE_GROUPS(mmc_dev);
static int
mmc_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
mmc_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct mmc_card *card = mmc_dev_to_card(dev);
const struct mmc_card *card = mmc_dev_to_card(dev);
const char *type;
unsigned int i;
int retval = 0;

View File

@ -120,9 +120,9 @@ static int sdio_bus_match(struct device *dev, struct device_driver *drv)
}
static int
sdio_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
sdio_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct sdio_func *func = dev_to_sdio_func(dev);
const struct sdio_func *func = dev_to_sdio_func(dev);
unsigned int i;
if (add_uevent_var(env,

View File

@ -1000,7 +1000,7 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
static int mdio_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
int rc;

View File

@ -200,7 +200,7 @@ static void xenvif_debugfs_delif(struct xenvif *vif)
* and vif variables to the environment, for the benefit of the vif-* hotplug
* scripts.
*/
static int netback_uevent(struct xenbus_device *xdev,
static int netback_uevent(const struct xenbus_device *xdev,
struct kobj_uevent_env *env)
{
struct backend_info *be = dev_get_drvdata(&xdev->dev);

View File

@ -28,7 +28,7 @@ static int nvdimm_bus_major;
struct class *nd_class;
static DEFINE_IDA(nd_ida);
static int to_nd_device_type(struct device *dev)
static int to_nd_device_type(const struct device *dev)
{
if (is_nvdimm(dev))
return ND_DEVICE_DIMM;
@ -42,7 +42,7 @@ static int to_nd_device_type(struct device *dev)
return 0;
}
static int nvdimm_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int nvdimm_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
return add_uevent_var(env, "MODALIAS=" ND_DEVICE_MODALIAS_FMT,
to_nd_device_type(dev));

View File

@ -38,7 +38,7 @@ static const struct device_type nd_dax_device_type = {
.groups = nd_pfn_attribute_groups,
};
bool is_nd_dax(struct device *dev)
bool is_nd_dax(const struct device *dev)
{
return dev ? dev->type == &nd_dax_device_type : false;
}

View File

@ -572,7 +572,7 @@ static const struct device_type nvdimm_device_type = {
.groups = nvdimm_attribute_groups,
};
bool is_nvdimm(struct device *dev)
bool is_nvdimm(const struct device *dev)
{
return dev->type == &nvdimm_device_type;
}

View File

@ -82,14 +82,14 @@ static inline void nvdimm_security_overwrite_query(struct work_struct *work)
}
#endif
bool is_nvdimm(struct device *dev);
bool is_nd_pmem(struct device *dev);
bool is_nd_volatile(struct device *dev);
static inline bool is_nd_region(struct device *dev)
bool is_nvdimm(const struct device *dev);
bool is_nd_pmem(const struct device *dev);
bool is_nd_volatile(const struct device *dev);
static inline bool is_nd_region(const struct device *dev)
{
return is_nd_pmem(dev) || is_nd_volatile(dev);
}
static inline bool is_memory(struct device *dev)
static inline bool is_memory(const struct device *dev)
{
return is_nd_pmem(dev) || is_nd_volatile(dev);
}

View File

@ -599,7 +599,7 @@ static inline int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
struct nd_dax *to_nd_dax(struct device *dev);
#if IS_ENABLED(CONFIG_NVDIMM_DAX)
int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns);
bool is_nd_dax(struct device *dev);
bool is_nd_dax(const struct device *dev);
struct device *nd_dax_create(struct nd_region *nd_region);
#else
static inline int nd_dax_probe(struct device *dev,
@ -608,7 +608,7 @@ static inline int nd_dax_probe(struct device *dev,
return -ENODEV;
}
static inline bool is_nd_dax(struct device *dev)
static inline bool is_nd_dax(const struct device *dev)
{
return false;
}

View File

@ -839,12 +839,12 @@ static const struct device_type nd_volatile_device_type = {
.groups = nd_region_attribute_groups,
};
bool is_nd_pmem(struct device *dev)
bool is_nd_pmem(const struct device *dev)
{
return dev ? dev->type == &nd_pmem_device_type : false;
}
bool is_nd_volatile(struct device *dev)
bool is_nd_volatile(const struct device *dev)
{
return dev ? dev->type == &nd_volatile_device_type : false;
}

View File

@ -1545,9 +1545,9 @@ void pci_dev_put(struct pci_dev *dev)
}
EXPORT_SYMBOL(pci_dev_put);
static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
static int pci_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct pci_dev *pdev;
const struct pci_dev *pdev;
if (!dev)
return -ENODEV;

View File

@ -927,9 +927,9 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int pcmcia_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct pcmcia_device *p_dev;
const struct pcmcia_device *p_dev;
int i;
u32 hash[4] = { 0, 0, 0, 0};

View File

@ -797,9 +797,9 @@ static struct attribute *wmi_method_attrs[] = {
};
ATTRIBUTE_GROUPS(wmi_method);
static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
static int wmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct wmi_block *wblock = dev_to_wblock(dev);
const struct wmi_block *wblock = dev_to_wblock(dev);
if (add_uevent_var(env, "MODALIAS=wmi:%pUL", &wblock->gblock.guid))
return -ENOMEM;

View File

@ -204,9 +204,9 @@ static int rio_match_bus(struct device *dev, struct device_driver *drv)
out:return 0;
}
static int rio_uevent(struct device *dev, struct kobj_uevent_env *env)
static int rio_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct rio_dev *rdev;
const struct rio_dev *rdev;
if (!dev)
return -ENODEV;

View File

@ -492,9 +492,9 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)
return of_driver_match_device(dev, drv);
}
static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env)
static int rpmsg_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct rpmsg_device *rpdev = to_rpmsg_device(dev);
const struct rpmsg_device *rpdev = to_rpmsg_device(dev);
int ret;
ret = of_device_uevent_modalias(dev, env);

View File

@ -1402,9 +1402,9 @@ static void css_shutdown(struct device *dev)
sch->driver->shutdown(sch);
}
static int css_uevent(struct device *dev, struct kobj_uevent_env *env)
static int css_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct subchannel *sch = to_subchannel(dev);
const struct subchannel *sch = to_subchannel(dev);
int ret;
ret = add_uevent_var(env, "ST=%01X", sch->st);

View File

@ -80,7 +80,7 @@ ccw_bus_match (struct device * dev, struct device_driver * drv)
* specified size. Return length of resulting string (excluding trailing '\0')
* even if string doesn't fit buffer (snprintf semantics). */
static int snprint_alias(char *buf, size_t size,
struct ccw_device_id *id, const char *suffix)
const struct ccw_device_id *id, const char *suffix)
{
int len;
@ -101,10 +101,10 @@ static int snprint_alias(char *buf, size_t size,
/* Set up environment variables for ccw device uevent. Return 0 on success,
* non-zero otherwise. */
static int ccw_uevent(struct device *dev, struct kobj_uevent_env *env)
static int ccw_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct ccw_device *cdev = to_ccwdev(dev);
struct ccw_device_id *id = &(cdev->id);
const struct ccw_device *cdev = to_ccwdev(dev);
const struct ccw_device_id *id = &(cdev->id);
int ret;
char modalias_buf[30];

View File

@ -37,7 +37,7 @@ static void scmdev_remove(struct device *dev)
scmdrv->remove(scmdev);
}
static int scmdev_uevent(struct device *dev, struct kobj_uevent_env *env)
static int scmdev_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
return add_uevent_var(env, "MODALIAS=scm:scmdev");
}

View File

@ -613,10 +613,10 @@ static int ap_bus_match(struct device *dev, struct device_driver *drv)
* It sets up a single environment variable DEV_TYPE which contains the
* hardware device type.
*/
static int ap_uevent(struct device *dev, struct kobj_uevent_env *env)
static int ap_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
int rc = 0;
struct ap_device *ap_dev = to_ap_dev(dev);
const struct ap_device *ap_dev = to_ap_dev(dev);
/* Uevents from ap bus core don't need extensions to the env */
if (dev == ap_root_device)

View File

@ -534,9 +534,9 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
}
static int scsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int scsi_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct scsi_device *sdev;
const struct scsi_device *sdev;
if (dev->type != &scsi_dev_type)
return 0;

View File

@ -93,9 +93,9 @@ static void slim_device_remove(struct device *dev)
}
}
static int slim_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static int slim_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct slim_device *sbdev = to_slim_device(dev);
const struct slim_device *sbdev = to_slim_device(dev);
return add_uevent_var(env, "MODALIAS=slim:%s", dev_name(&sbdev->dev));
}

View File

@ -387,9 +387,9 @@ static void apr_device_remove(struct device *dev)
spin_unlock(&apr->svcs_lock);
}
static int apr_uevent(struct device *dev, struct kobj_uevent_env *env)
static int apr_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct apr_device *adev = to_apr_device(dev);
const struct apr_device *adev = to_apr_device(dev);
int ret;
ret = of_device_uevent_modalias(dev, env);

View File

@ -395,7 +395,7 @@ static int spi_match_device(struct device *dev, struct device_driver *drv)
return strcmp(spi->modalias, drv->name) == 0;
}
static int spi_uevent(struct device *dev, struct kobj_uevent_env *env)
static int spi_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const struct spi_device *spi = to_spi_device(dev);
int rc;

View File

@ -366,7 +366,7 @@ static void spmi_drv_shutdown(struct device *dev)
sdrv->shutdown(to_spmi_device(dev));
}
static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env)
static int spmi_drv_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
int ret;

View File

@ -339,9 +339,9 @@ static int ssb_bus_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
static int ssb_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
const struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
if (!dev)
return -ENODEV;

View File

@ -71,14 +71,14 @@ static const struct device_type greybus_gbphy_dev_type = {
.pm = &gb_gbphy_pm_ops,
};
static int gbphy_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
static int gbphy_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc;
struct gb_bundle *bundle = gbphy_dev->bundle;
struct gb_interface *intf = bundle->intf;
struct gb_module *module = intf->module;
struct gb_host_device *hd = intf->hd;
const struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
const struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc;
const struct gb_bundle *bundle = gbphy_dev->bundle;
const struct gb_interface *intf = bundle->intf;
const struct gb_module *module = intf->module;
const struct gb_host_device *hd = intf->hd;
if (add_uevent_var(env, "BUS=%u", hd->bus_id))
return -ENOMEM;

View File

@ -1207,7 +1207,7 @@ static int tee_client_device_match(struct device *dev,
return 0;
}
static int tee_client_device_uevent(struct device *dev,
static int tee_client_device_uevent(const struct device *dev,
struct kobj_uevent_env *env)
{
uuid_t *dev_id = &to_tee_client_device(dev)->id.uuid;

View File

@ -55,9 +55,9 @@ static int ulpi_match(struct device *dev, struct device_driver *driver)
return 0;
}
static int ulpi_uevent(struct device *dev, struct kobj_uevent_env *env)
static int ulpi_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct ulpi *ulpi = to_ulpi_dev(dev);
const struct ulpi *ulpi = to_ulpi_dev(dev);
int ret;
ret = of_device_uevent_modalias(dev, env);

View File

@ -899,14 +899,14 @@ static int usb_device_match(struct device *dev, struct device_driver *drv)
return 0;
}
static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
static int usb_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct usb_device *usb_dev;
const struct usb_device *usb_dev;
if (is_usb_device(dev)) {
usb_dev = to_usb_device(dev);
} else if (is_usb_interface(dev)) {
struct usb_interface *intf = to_usb_interface(dev);
const struct usb_interface *intf = to_usb_interface(dev);
usb_dev = interface_to_usbdev(intf);
} else {

View File

@ -321,9 +321,9 @@ static int typec_match(struct device *dev, struct device_driver *driver)
return 0;
}
static int typec_uevent(struct device *dev, struct kobj_uevent_env *env)
static int typec_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct typec_altmode *altmode = to_typec_altmode(dev);
const struct typec_altmode *altmode = to_typec_altmode(dev);
if (add_uevent_var(env, "SVID=%04X", altmode->svid))
return -ENOMEM;

View File

@ -95,9 +95,9 @@ static int virtio_dev_match(struct device *_dv, struct device_driver *_dr)
return 0;
}
static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env)
static int virtio_uevent(const struct device *_dv, struct kobj_uevent_env *env)
{
struct virtio_device *dev = dev_to_virtio(_dv);
const struct virtio_device *dev = dev_to_virtio(_dv);
return add_uevent_var(env, "MODALIAS=virtio:d%08Xv%08X",
dev->id.device, dev->id.vendor);

View File

@ -170,7 +170,7 @@ static struct w1_family w1_default_family = {
.fops = &w1_default_fops,
};
static int w1_uevent(struct device *dev, struct kobj_uevent_env *env);
static int w1_uevent(const struct device *dev, struct kobj_uevent_env *env);
static struct bus_type w1_bus_type = {
.name = "w1",
@ -577,11 +577,11 @@ void w1_destroy_master_attributes(struct w1_master *master)
sysfs_remove_group(&master->dev.kobj, &w1_master_defattr_group);
}
static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
static int w1_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct w1_master *md = NULL;
struct w1_slave *sl = NULL;
char *event_owner, *name;
const struct w1_master *md = NULL;
const struct w1_slave *sl = NULL;
const char *event_owner, *name;
int err = 0;
if (dev->driver == &w1_master_driver) {

View File

@ -1185,7 +1185,7 @@ static void pvcalls_back_remove(struct xenbus_device *dev)
{
}
static int pvcalls_back_uevent(struct xenbus_device *xdev,
static int pvcalls_back_uevent(const struct xenbus_device *xdev,
struct kobj_uevent_env *env)
{
return 0;

View File

@ -92,12 +92,12 @@ static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)
return 0;
}
static int xenbus_uevent_backend(struct device *dev,
static int xenbus_uevent_backend(const struct device *dev,
struct kobj_uevent_env *env)
{
struct xenbus_device *xdev;
struct xenbus_driver *drv;
struct xen_bus_type *bus;
const struct xenbus_device *xdev;
const struct xenbus_driver *drv;
const struct xen_bus_type *bus;
DPRINTK("");

View File

@ -73,10 +73,10 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type,
return err;
}
static int xenbus_uevent_frontend(struct device *_dev,
static int xenbus_uevent_frontend(const struct device *_dev,
struct kobj_uevent_env *env)
{
struct xenbus_device *dev = to_xenbus_device(_dev);
const struct xenbus_device *dev = to_xenbus_device(_dev);
if (add_uevent_var(env, "MODALIAS=xen:%s", dev->devicetype))
return -ENOMEM;

View File

@ -130,9 +130,9 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)
return !!zorro_match_device(ids, z);
}
static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
static int zorro_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct zorro_dev *z;
const struct zorro_dev *z;
if (!dev)
return -ENODEV;

View File

@ -90,7 +90,7 @@ struct bus_type {
const struct attribute_group **drv_groups;
int (*match)(struct device *dev, struct device_driver *drv);
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
int (*uevent)(const struct device *dev, struct kobj_uevent_env *env);
int (*probe)(struct device *dev);
void (*sync_state)(struct device *dev);
void (*remove)(struct device *dev);

View File

@ -223,7 +223,7 @@ struct spi_device {
static_assert((SPI_MODE_KERNEL_MASK & SPI_MODE_USER_MASK) == 0,
"SPI_MODE_USER_MASK & SPI_MODE_KERNEL_MASK must not overlap");
static inline struct spi_device *to_spi_device(struct device *dev)
static inline struct spi_device *to_spi_device(const struct device *dev)
{
return dev ? container_of(dev, struct spi_device, dev) : NULL;
}

View File

@ -285,7 +285,7 @@ struct ssb_device {
/* Go from struct device to struct ssb_device. */
static inline
struct ssb_device * dev_to_ssb_dev(struct device *dev)
struct ssb_device * dev_to_ssb_dev(const struct device *dev)
{
struct __ssb_dev_wrapper *wrap;
wrap = container_of(dev, struct __ssb_dev_wrapper, dev);

View File

@ -123,7 +123,7 @@ void snd_hdac_device_exit(struct hdac_device *dev);
int snd_hdac_device_register(struct hdac_device *codec);
void snd_hdac_device_unregister(struct hdac_device *codec);
int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name);
int snd_hdac_codec_modalias(struct hdac_device *hdac, char *buf, size_t size);
int snd_hdac_codec_modalias(const struct hdac_device *hdac, char *buf, size_t size);
int snd_hdac_refresh_widgets(struct hdac_device *codec);

View File

@ -117,7 +117,7 @@ struct xenbus_driver {
void (*remove)(struct xenbus_device *dev);
int (*suspend)(struct xenbus_device *dev);
int (*resume)(struct xenbus_device *dev);
int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
int (*uevent)(const struct xenbus_device *, struct kobj_uevent_env *);
struct device_driver driver;
int (*read_otherend_details)(struct xenbus_device *dev);
int (*is_ready)(struct xenbus_device *dev);

View File

@ -55,10 +55,10 @@ static int soundbus_probe(struct device *dev)
}
static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env)
static int soundbus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
struct soundbus_dev * soundbus_dev;
struct platform_device * of;
const struct soundbus_dev * soundbus_dev;
const struct platform_device * of;
const char *compat;
int retval = 0;
int cplen, seen = 0;

View File

@ -65,7 +65,7 @@ static int hda_bus_match(struct device *dev, struct device_driver *drv)
return 1;
}
static int hda_uevent(struct device *dev, struct kobj_uevent_env *env)
static int hda_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
char modalias[32];

View File

@ -204,7 +204,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_set_chip_name);
*
* Returns the size of string, like snprintf(), or a negative error code.
*/
int snd_hdac_codec_modalias(struct hdac_device *codec, char *buf, size_t size)
int snd_hdac_codec_modalias(const struct hdac_device *codec, char *buf, size_t size)
{
return scnprintf(buf, size, "hdaudio:v%08Xr%08Xa%02X\n",
codec->vendor_id, codec->revision_id, codec->type);