Lines Matching refs:dev
58 void (*dev_release)(struct device *dev);
59 char * (*devnode)(struct device *dev, umode_t *mode);
68 void (*release)(struct device *dev);
129 #define dev_err(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
130 #define dev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
131 #define dev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
132 #define dev_notice(dev, fmt, ...) device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
133 #define dev_printk(lvl, dev, fmt, ...) \
134 device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
137 dev_get_drvdata(const struct device *dev)
140 return dev->driver_data;
144 dev_set_drvdata(struct device *dev, void *data)
147 dev->driver_data = data;
151 get_device(struct device *dev)
154 if (dev)
155 kobject_get(&dev->kobj);
157 return (dev);
161 dev_name(const struct device *dev)
164 return kobject_name(&dev->kobj);
171 put_device(struct device *dev)
174 if (dev)
175 kobject_put(&dev->kobj);
208 device_initialize(struct device *dev)
213 if (dev->devt) {
214 int unit = MINOR(dev->devt);
215 bsddev = devclass_get_device(dev->class->bsdclass, unit);
218 device_set_softc(bsddev, dev);
220 dev->bsddev = bsddev;
221 kobject_init(&dev->kobj, &linux_dev_ktype);
225 device_add(struct device *dev)
227 if (dev->bsddev != NULL) {
228 if (dev->devt == 0)
229 dev->devt = makedev(0, device_get_unit(dev->bsddev));
231 kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev));
236 device_create_release(struct device *dev)
238 kfree(dev);
246 struct device *dev = NULL;
252 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
253 if (!dev) {
258 device_initialize(dev);
259 dev->devt = devt;
260 dev->class = class;
261 dev->parent = parent;
262 dev->groups = groups;
263 dev->release = device_create_release;
264 dev->bsddev = devclass_get_device(dev->class->bsdclass, MINOR(devt));
265 dev_set_drvdata(dev, drvdata);
267 retval = kobject_set_name_vargs(&dev->kobj, fmt, args);
271 retval = device_add(dev);
275 return dev;
278 put_device(dev);
288 struct device *dev;
291 dev = device_create_groups_vargs(class, parent, devt, drvdata,
294 return dev;
298 device_register(struct device *dev)
306 if (dev->devt) {
307 unit = MINOR(dev->devt);
308 bsddev = devclass_get_device(dev->class->bsdclass, unit);
309 } else if (dev->parent == NULL) {
310 bsddev = devclass_get_device(dev->class->bsdclass, 0);
312 if (bsddev == NULL && dev->parent != NULL) {
313 bsddev = device_add_child(dev->parent->bsddev,
314 dev->class->kobj.name, unit);
317 if (dev->devt == 0)
318 dev->devt = makedev(0, device_get_unit(bsddev));
319 device_set_softc(bsddev, dev);
321 dev->bsddev = bsddev;
322 kobject_init(&dev->kobj, &linux_dev_ktype);
323 kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev));
329 device_unregister(struct device *dev)
333 bsddev = dev->bsddev;
334 dev->bsddev = NULL;
341 put_device(dev);
345 device_del(struct device *dev)
349 bsddev = dev->bsddev;
350 dev->bsddev = NULL;
410 device_create_file(struct device *dev, const struct device_attribute *attr)
413 if (dev)
414 return sysfs_create_file(&dev->kobj, &attr->attr);
419 device_remove_file(struct device *dev, const struct device_attribute *attr)
422 if (dev)
423 sysfs_remove_file(&dev->kobj, &attr->attr);
444 dev_to_node(struct device *dev)