Lines Matching +full:sub +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 bttv-gpio.c -- gpio sub drivers
6 sysfs-based sub driver interface for bttv
10 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
11 & Marcus Metzler (mocm@thp.uni-koeln.de)
12 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
28 /* ----------------------------------------------------------------------- */
29 /* internal: the bttv "bus" */
33 const struct bttv_sub_driver *sub = to_bttv_sub_drv(drv); in bttv_sub_bus_match() local
34 int len = strlen(sub->wanted); in bttv_sub_bus_match()
36 if (0 == strncmp(dev_name(dev), sub->wanted, len)) in bttv_sub_bus_match()
44 struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); in bttv_sub_probe() local
46 return sub->probe ? sub->probe(sdev) : -ENODEV; in bttv_sub_probe()
52 struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); in bttv_sub_remove() local
54 if (sub->remove) in bttv_sub_remove()
55 sub->remove(sdev); in bttv_sub_remove()
59 .name = "bttv-sub",
67 struct bttv_sub_device *sub = to_bttv_sub_dev(dev); in release_sub_device() local
68 kfree(sub); in release_sub_device()
73 struct bttv_sub_device *sub; in bttv_sub_add_device() local
76 sub = kzalloc(sizeof(*sub),GFP_KERNEL); in bttv_sub_add_device()
77 if (NULL == sub) in bttv_sub_add_device()
78 return -ENOMEM; in bttv_sub_add_device()
80 sub->core = core; in bttv_sub_add_device()
81 sub->dev.parent = &core->pci->dev; in bttv_sub_add_device()
82 sub->dev.bus = &bttv_sub_bus_type; in bttv_sub_add_device()
83 sub->dev.release = release_sub_device; in bttv_sub_add_device()
84 dev_set_name(&sub->dev, "%s%d", name, core->nr); in bttv_sub_add_device()
86 err = device_register(&sub->dev); in bttv_sub_add_device()
88 put_device(&sub->dev); in bttv_sub_add_device()
91 pr_info("%d: add subdevice \"%s\"\n", core->nr, dev_name(&sub->dev)); in bttv_sub_add_device()
92 list_add_tail(&sub->list,&core->subs); in bttv_sub_add_device()
98 struct bttv_sub_device *sub, *save; in bttv_sub_del_devices() local
100 list_for_each_entry_safe(sub, save, &core->subs, list) { in bttv_sub_del_devices()
101 list_del(&sub->list); in bttv_sub_del_devices()
102 device_unregister(&sub->dev); in bttv_sub_del_devices()
107 /* ----------------------------------------------------------------------- */
108 /* external: sub-driver register/unregister */
110 int bttv_sub_register(struct bttv_sub_driver *sub, char *wanted) in bttv_sub_register() argument
112 sub->drv.bus = &bttv_sub_bus_type; in bttv_sub_register()
113 snprintf(sub->wanted,sizeof(sub->wanted),"%s",wanted); in bttv_sub_register()
114 return driver_register(&sub->drv); in bttv_sub_register()
118 int bttv_sub_unregister(struct bttv_sub_driver *sub) in bttv_sub_unregister() argument
120 driver_unregister(&sub->drv); in bttv_sub_unregister()
125 /* ----------------------------------------------------------------------- */
134 spin_lock_irqsave(&btv->gpio_lock,flags); in bttv_gpio_inout()
139 spin_unlock_irqrestore(&btv->gpio_lock,flags); in bttv_gpio_inout()
164 spin_lock_irqsave(&btv->gpio_lock,flags); in bttv_gpio_bits()
169 spin_unlock_irqrestore(&btv->gpio_lock,flags); in bttv_gpio_bits()