static int mbus_uevent(struct device *dv, struct kobj_uevent_env *env) { struct mbus_device *dev = dev_to_mbus(dv); return add_uevent_var(env, "MODALIAS=mbus:d%08Xv%08X", dev->id.device, dev->id.vendor); }
static int gio_device_uevent(struct device *dev, struct kobj_uevent_env *env) { struct gio_device *gio_dev = to_gio_device(dev); add_uevent_var(env, "MODALIAS=gio:%x", gio_dev->id.id); return 0; }
static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env) { struct virtio_device *dev = dev_to_virtio(_dv); return add_uevent_var(env, "MODALIAS=virtio:d%08Xv%08X", dev->id.device, dev->id.vendor); }
/* * Handle the creation of the hotplug script environment. We add the script * and vif variables to the environment, for the benefit of the vif-* hotplug * scripts. */ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *env) { struct backend_info *be = dev_get_drvdata(&xdev->dev); if (!be) return 0; if (add_uevent_var(env, "script=%s", be->hotplug_script)) return -ENOMEM; if (!be->vif) return 0; return add_uevent_var(env, "vif=%s", be->vif->dev->name); }
static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env) { struct rpmsg_channel *rpdev = to_rpmsg_channel(dev); return add_uevent_var(env, "MODALIAS=" RPMSG_DEVICE_MODALIAS_FMT, rpdev->id.name); }
static int ide_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { ide_drive_t *drive = to_ide_device(dev); int i = 0; int length = 0; add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "MEDIA=%s", media_string(drive)); add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "DRIVENAME=%s", drive->name); add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "MODALIAS=ide:m-%s", media_string(drive)); envp[i] = NULL; return 0; }
static int fmc_uevent(struct device *dev, struct kobj_uevent_env *env) { /* struct fmc_device *fdev = to_fmc_device(dev); */ /* FIXME: The MODALIAS */ add_uevent_var(env, "MODALIAS=%s", "fmc"); return 0; }
static int amba_uevent(struct device *dev, struct kobj_uevent_env *env) { struct amba_device *pcdev = to_amba_device(dev); int retval = 0; retval = add_uevent_var(env, "AMBA_ID=%08x", pcdev->periphid); return retval; }
static int lego_bus_uevent(struct device *dev, struct kobj_uevent_env *env) { struct lego_device *ldev = to_lego_device(dev); int err; err = add_uevent_var(env, "LEGO_DRIVER_NAME=%s", ldev->name); if (err) return err; err = add_uevent_var(env, "LEGO_PORT_NAME=%s", ldev->port->port_name); if (err) return err; err = add_uevent_var(env, "MODALIAS=lego:%s", dev->type->name); if (err) return err; return 0; }
int of_device_uevent(struct device *dev, struct kobj_uevent_env *env) { struct of_device *ofdev; const char *compat; int seen = 0, cplen, sl; if (!dev) return -ENODEV; ofdev = to_of_device(dev); if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name)) return -ENOMEM; if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type)) return -ENOMEM; /* Since the compatible field can contain pretty much anything * it's not really legal to split it out with commas. We split it * up using a number of environment variables instead. */ compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen); while (compat && *compat && cplen > 0) { if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat)) return -ENOMEM; sl = strlen (compat) + 1; compat += sl; cplen -= sl; seen++; } if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen)) return -ENOMEM; /* modalias is trickier, we add it in 2 steps */ if (add_uevent_var(env, "MODALIAS=")) return -ENOMEM; sl = of_device_get_modalias(ofdev, &env->buf[env->buflen-1], sizeof(env->buf) - env->buflen); if (sl >= (sizeof(env->buf) - env->buflen)) return -ENOMEM; env->buflen += sl; return 0; }
static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *env) { struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id)) return -ENOMEM; return 0; }
static int mmc_bus_uevent(struct device *dev, struct kobj_uevent_env *env) { struct mmc_card *card = mmc_dev_to_card(dev); const char *type; int retval = 0; switch (card->type) { case MMC_TYPE_MMC: type = "MMC"; break; case MMC_TYPE_SD: type = "SD"; break; case MMC_TYPE_SDIO: type = "SDIO"; break; case MMC_TYPE_SD_COMBO: type = "SDcombo"; break; case MMC_TYPE_SDIO_WIMAX: type = "SDwimax"; break; default: type = NULL; } if (type) { retval = add_uevent_var(env, "MMC_TYPE=%s", type); if (retval) return retval; } retval = add_uevent_var(env, "MMC_NAME=%s", mmc_card_name(card)); if (retval) return retval; /* * Request the mmc_block device. Note: that this is a direct request * for the module it carries no information as to what is inserted. */ retval = add_uevent_var(env, "MODALIAS=mmc:block"); return retval; }
static int ulpi_uevent(struct device *dev, struct kobj_uevent_env *env) { struct ulpi *ulpi = to_ulpi_dev(dev); if (add_uevent_var(env, "MODALIAS=ulpi:v%04xp%04x", ulpi->id.vendor, ulpi->id.product)) return -ENOMEM; return 0; }
static int xenbus_uevent_frontend(struct device *dev, struct kobj_uevent_env *env) { struct xenbus_device *xdev; if (dev == NULL) return -ENODEV; xdev = to_xenbus_device(dev); if (xdev == NULL) return -ENODEV; /* stuff we want to pass to /sbin/hotplug */ if (add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype) || add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename) || add_uevent_var(env, "MODALIAS=xen:%s", xdev->devicetype)) return -ENOMEM; return 0; }
static int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env) { struct xenbus_device *dev = to_xenbus_device(_dev); if (add_uevent_var(env, "MODALIAS=xen:%s", dev->devicetype)) return -ENOMEM; return 0; }
/* * vmbus_uevent - add uevent for our device * * This routine is invoked when a device is added or removed on the vmbus to * generate a uevent to udev in the userspace. The udev will then look at its * rule and the uevent generated here to load the appropriate driver * * The alias string will be of the form vmbus:guid where guid is the string * 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) { struct hv_device *dev = device_to_hv_device(device); int ret; char alias_name[VMBUS_ALIAS_LEN + 1]; print_alias_name(dev, alias_name); ret = add_uevent_var(env, "MODALIAS=vmbus:%s", alias_name); return ret; }
static int xenbus_uevent_backend(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct xenbus_device *xdev; struct xenbus_driver *drv; int i = 0; int length = 0; DPRINTK(""); if (dev == NULL) return -ENODEV; xdev = to_xenbus_device(dev); if (xdev == NULL) return -ENODEV; 2 /* stuff we want to pass to /sbin/hotplug */ add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "XENBUS_TYPE=%s", xdev->devicetype); add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "XENBUS_PATH=%s", xdev->nodename); add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "XENBUS_BASE_PATH=%s", xenbus_backend.root); /* terminate, set to next free slot, shrink available space */ envp[i] = NULL; envp = &envp[i]; num_envp -= i; buffer = &buffer[length]; buffer_size -= length; if (dev->driver) { drv = to_xenbus_driver(dev->driver); if (drv && drv->uevent) return drv->uevent(xdev, envp, num_envp, buffer, buffer_size); } return 0; }
static int xenbus_uevent_frontend(struct device *dev, struct kobj_uevent_env *env) { struct xenbus_device *xdev; if (dev == NULL) return -ENODEV; xdev = to_xenbus_device(dev); if (xdev == NULL) return -ENODEV; /* stuff we want to pass to /sbin/hotplug */ #if defined(CONFIG_XEN) || defined(MODULE) add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype); add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename); #endif add_uevent_var(env, "MODALIAS=xen:%s", xdev->devicetype); return 0; }
static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env) { struct zorro_dev *z; if (!dev) return -ENODEV; z = to_zorro_dev(dev); if (!z) return -ENODEV; if (add_uevent_var(env, "ZORRO_ID=%08X", z->id) || add_uevent_var(env, "ZORRO_SLOT_NAME=%s", dev_name(dev)) || add_uevent_var(env, "ZORRO_SLOT_ADDR=%04X", z->slotaddr) || add_uevent_var(env, "MODALIAS=" ZORRO_DEVICE_MODALIAS_FMT, z->id)) return -ENOMEM; return 0; }
int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env) { char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); if (buf) { arch_print_cpu_modalias(NULL, NULL, buf); add_uevent_var(env, "MODALIAS=%s", buf); kfree(buf); } return 0; }
static int mips_cdmm_uevent(struct device *dev, struct kobj_uevent_env *env) { struct mips_cdmm_device *cdev = to_mips_cdmm_device(dev); int retval = 0; retval = add_uevent_var(env, "CDMM_CPU=%u", cdev->cpu); if (retval) return retval; retval = add_uevent_var(env, "CDMM_TYPE=0x%02x", cdev->type); if (retval) return retval; retval = add_uevent_var(env, "CDMM_REV=%u", cdev->rev); if (retval) return retval; retval = add_uevent_var(env, "MODALIAS=mipscdmm:t%02X", cdev->type); return retval; }
static int mcb_uevent(struct device *dev, struct kobj_uevent_env *env) { struct mcb_device *mdev = to_mcb_device(dev); int ret; ret = add_uevent_var(env, "MODALIAS=mcb:16z%03d", mdev->id); if (ret) return -ENOMEM; return 0; }
static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env) { struct rpmsg_device *rpdev = to_rpmsg_device(dev); int ret; ret = of_device_uevent_modalias(dev, env); if (ret != -ENODEV) return ret; return add_uevent_var(env, "MODALIAS=" RPMSG_DEVICE_MODALIAS_FMT, rpdev->id.name); }
static int my_bus_uevent(struct device *dev, struct kobj_uevent_env *env) { struct my_device *_dev = to_my_dev(dev); int retval = 0; printk(KERN_INFO "my_bus_uevent !\n"); if (!_dev) return -ENODEV; printk(KERN_INFO "goto add_uevent_var !\n"); /* Set up DEV_TYPE environment variable. */ retval = add_uevent_var(env, "DEV_ID=%04X", _dev->devid); if (retval) return retval; /* Add MODALIAS= */ retval = add_uevent_var(env, "MODALIAS=my:%02X", _dev->devid); return retval; }
int leds_uevent(struct device *dev, struct kobj_uevent_env *env) { struct led_classdev *led_cdev = dev_get_drvdata(dev); int ret = 0; static int prev_max_brightness = 255; char up[] = "UP"; char down[] = "DOWN"; ret = add_uevent_var(env, "DIRECTION=%s", (prev_max_brightness > led_cdev->max_brightness) ? up : down); if (ret) return ret; ret = add_uevent_var(env, "MAX=%d", led_cdev->max_brightness); prev_max_brightness = led_cdev->max_brightness; if (ret) return ret; ret = add_uevent_var(env, "CURRENT=%d", led_cdev->brightness); if (ret) return ret; return 0; }
static int xenbus_uevent_frontend(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct xenbus_device *xdev; int length = 0, i = 0; if (dev == NULL) return -ENODEV; xdev = to_xenbus_device(dev); if (xdev == NULL) return -ENODEV; /* stuff we want to pass to /sbin/hotplug */ add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "XENBUS_TYPE=%s", xdev->devicetype); add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "XENBUS_PATH=%s", xdev->nodename); add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "MODALIAS=xen:%s", xdev->devicetype); return 0; }
/** * dm_send_uevents - send uevents for given list * * @events: list of events to send * @kobj: kobject generating event * */ void dm_send_uevents(struct list_head *events, struct kobject *kobj) { int r; struct dm_uevent *event, *next; list_for_each_entry_safe(event, next, events, elist) { list_del_init(&event->elist); /* * Need to call dm_copy_name_and_uuid from here for now. * Context of previous var adds and locking used for * hash_cell not compatable. */ if (dm_copy_name_and_uuid(event->md, event->name, event->uuid)) { DMERR("%s: dm_copy_name_and_uuid() failed", __func__); goto uevent_free; } if (add_uevent_var(&event->ku_env, "DM_NAME=%s", event->name)) { DMERR("%s: add_uevent_var() for DM_NAME failed", __func__); goto uevent_free; } if (add_uevent_var(&event->ku_env, "DM_UUID=%s", event->uuid)) { DMERR("%s: add_uevent_var() for DM_UUID failed", __func__); goto uevent_free; } r = kobject_uevent_env(kobj, event->action, event->ku_env.envp); if (r) DMERR("%s: kobject_uevent_env failed", __func__); uevent_free: dm_uevent_free(event); }
static int ulpi_uevent(struct device *dev, struct kobj_uevent_env *env) { struct ulpi *ulpi = to_ulpi_dev(dev); int ret; ret = of_device_uevent_modalias(dev, env); if (ret != -ENODEV) return ret; if (add_uevent_var(env, "MODALIAS=ulpi:v%04xp%04x", ulpi->id.vendor, ulpi->id.product)) return -ENOMEM; return 0; }
static int ps3_system_bus_uevent(struct device *_dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); int i = 0, length = 0; if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "MODALIAS=ps3:%d", dev->match_id)) return -ENOMEM; envp[i] = NULL; return 0; }
static int host_notify_uevent(struct device *dev, struct kobj_uevent_env *env) { struct host_notify_dev *ndev = (struct host_notify_dev *) dev_get_drvdata(dev); char *state; if (!ndev) { /* this happens when the device is first created */ return 0; } switch (ndev->state) { case NOTIFY_HOST_ADD: state = "ADD"; break; case NOTIFY_HOST_REMOVE: state = "REMOVE"; break; case NOTIFY_HOST_OVERCURRENT: state = "OVERCURRENT"; break; case NOTIFY_HOST_LOWBATT: state = "LOWBATT"; break; case NOTIFY_HOST_UNKNOWN: state = "UNKNOWN"; break; case NOTIFY_HOST_NONE: default: return 0; } if (add_uevent_var(env, "DEVNAME=%s", ndev->dev->kobj.name)) return -ENOMEM; if (add_uevent_var(env, "STATE=%s", state)) return -ENOMEM; return 0; }