本文整理汇总了C++中platform_device_unregister函数的典型用法代码示例。如果您正苦于以下问题:C++ platform_device_unregister函数的具体用法?C++ platform_device_unregister怎么用?C++ platform_device_unregister使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_device_unregister函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rsz_init
/*
=====================rsz_init===========================
function to register resizer character driver
*/
static __init int rsz_init(void)
{
int result;
/* Register the driver in the kernel */
result = alloc_chrdev_region(&dev, 0, 1, DRIVER_NAME);
if (result < 0) {
printk(KERN_ERR
"DaVinciresizer: could not register character device");
return -ENODEV;
}
/* Initialize of character device */
cdev_init(&c_dev, &rsz_fops);
c_dev.owner = THIS_MODULE;
c_dev.ops = &rsz_fops;
/* addding character device */
result = cdev_add(&c_dev, dev, 1);
if (result) {
printk(KERN_ERR
"DaVinciresizer:Error %d adding"
" Davinciresizer ..error no:",
result);
unregister_chrdev_region(dev, 1);
return result;
}
/* registeration of character device */
register_chrdev(MAJOR(dev), DRIVER_NAME, &rsz_fops);
/* register driver as a platform driver */
if (driver_register(&resizer_driver) != 0) {
unregister_chrdev_region(dev, 1);
cdev_del(&c_dev);
return -EINVAL;
}
/* Register the drive as a platform device */
if (platform_device_register(&resizer_device) != 0) {
driver_unregister(&resizer_driver);
unregister_chrdev_region(dev, 1);
unregister_chrdev(MAJOR(dev), DRIVER_NAME);
cdev_del(&c_dev);
return -EINVAL;
}
rsz_class = class_create(THIS_MODULE, "davinci_resizer");
if (!rsz_class) {
platform_device_unregister(&resizer_device);
cdev_del(&c_dev);
unregister_chrdev(MAJOR(dev), DRIVER_NAME);
return -EIO;
}
device_create(rsz_class, NULL, dev, NULL, "davinci_resizer");
rsz_dev.users = 0;
mutex_init(&rsz_dev.lock);
/* Initialize the serializer */
imp_init_serializer();
imp_hw_if = imp_get_hw_if();
printk(KERN_NOTICE "davinci_resizer initialized\n");
return 0;
} /* End of function resizer_init */
示例2: kylew_modexit
static void __exit kylew_modexit(void)
{
platform_device_unregister(kylew_snd_device);
}
示例3: msm_audio_exit
static void __exit msm_audio_exit(void)
{
msm8660_wm8903_unprepare();
platform_device_unregister(msm_snd_device);
}
示例4: sc881x_modexit
static void __exit sc881x_modexit(void)
{
platform_device_unregister(sc881x_snd_device);
}
示例5: imx_phycore_exit
static void __exit imx_phycore_exit(void)
{
platform_device_unregister(imx_phycore_snd_device);
platform_device_unregister(imx_phycore_snd_ac97_device);
}
示例6: rx1950_exit
static void __exit rx1950_exit(void)
{
platform_device_unregister(s3c24xx_snd_device);
gpio_free(S3C2410_GPA(1));
}
示例7: ctrl_bridge_probe
//.........这里部分代码省略.........
return -ENOMEM;
}
dev->pdev = platform_device_alloc(ctrl_bridge_names[id], id);
if (!dev->pdev) {
dev_err(&ifc->dev, "%s: unable to allocate platform device\n",
__func__);
retval = -ENOMEM;
goto nomem;
}
dev->udev = udev;
dev->int_pipe = usb_rcvintpipe(udev,
int_in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
dev->intf = ifc;
init_usb_anchor(&dev->tx_submitted);
init_usb_anchor(&dev->tx_deferred);
/*use max pkt size from ep desc*/
ep = &dev->intf->cur_altsetting->endpoint[0].desc;
dev->inturb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->inturb) {
dev_err(&ifc->dev, "%s: error allocating int urb\n", __func__);
retval = -ENOMEM;
goto pdev_del;
}
wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize);
dev->intbuf = kmalloc(wMaxPacketSize, GFP_KERNEL);
if (!dev->intbuf) {
dev_err(&ifc->dev, "%s: error allocating int buffer\n",
__func__);
retval = -ENOMEM;
goto free_inturb;
}
interval =
(udev->speed == USB_SPEED_HIGH) ? HS_INTERVAL : FS_LS_INTERVAL;
usb_fill_int_urb(dev->inturb, udev, dev->int_pipe,
dev->intbuf, wMaxPacketSize,
notification_available_cb, dev, interval);
dev->readurb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->readurb) {
dev_err(&ifc->dev, "%s: error allocating read urb\n",
__func__);
retval = -ENOMEM;
goto free_intbuf;
}
dev->readbuf = kmalloc(DEFAULT_READ_URB_LENGTH, GFP_KERNEL);
if (!dev->readbuf) {
dev_err(&ifc->dev, "%s: error allocating read buffer\n",
__func__);
retval = -ENOMEM;
goto free_rurb;
}
dev->in_ctlreq = kmalloc(sizeof(*dev->in_ctlreq), GFP_KERNEL);
if (!dev->in_ctlreq) {
dev_err(&ifc->dev, "%s:error allocating setup packet buffer\n",
__func__);
retval = -ENOMEM;
goto free_rbuf;
}
dev->in_ctlreq->bRequestType =
(USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
dev->in_ctlreq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE;
dev->in_ctlreq->wValue = 0;
dev->in_ctlreq->wIndex =
dev->intf->cur_altsetting->desc.bInterfaceNumber;
dev->in_ctlreq->wLength = cpu_to_le16(DEFAULT_READ_URB_LENGTH);
__dev[id] = dev;
platform_device_add(dev->pdev);
ch_id++;
return ctrl_bridge_start_read(dev);
free_rbuf:
kfree(dev->readbuf);
free_rurb:
usb_free_urb(dev->readurb);
free_intbuf:
kfree(dev->intbuf);
free_inturb:
usb_free_urb(dev->inturb);
pdev_del:
platform_device_unregister(dev->pdev);
nomem:
kfree(dev);
return retval;
}
示例8: tc1100_exit
static void __exit tc1100_exit(void)
{
platform_device_unregister(tc1100_device);
platform_driver_unregister(&tc1100_driver);
}
示例9: lirc_dove_exit
static void lirc_dove_exit(void)
{
platform_device_unregister(lirc_dove_dev);
platform_driver_unregister(&lirc_dove_driver);
lirc_buffer_free(&rbuf);
}
示例10: omap3pandora_soc_exit
static void __exit omap3pandora_soc_exit(void)
{
platform_device_unregister(omap3pandora_snd_device);
gpio_free(OMAP3_PANDORA_AMP_POWER_GPIO);
gpio_free(OMAP3_PANDORA_DAC_POWER_GPIO);
}
示例11: hdaps_init
static int __init hdaps_init(void)
{
int ret;
/* Determine axis orientation orientation */
if (hdaps_invert == HDAPS_ORIENT_UNDEFINED) /* set by module param? */
if (dmi_check_system(hdaps_whitelist) < 1) /* in whitelist? */
hdaps_invert = 0; /* default */
/* Init timer before platform_driver_register, in case of suspend */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
init_timer(&hdaps_timer);
hdaps_timer.function = hdaps_mousedev_poll;
#else
timer_setup(&hdaps_timer, hdaps_mousedev_poll, 0);
#endif
ret = platform_driver_register(&hdaps_driver);
if (ret)
goto out;
pdev = platform_device_register_simple("hdaps", -1, NULL, 0);
if (IS_ERR(pdev)) {
ret = PTR_ERR(pdev);
goto out_driver;
}
ret = sysfs_create_group(&pdev->dev.kobj, &hdaps_attribute_group);
if (ret)
goto out_device;
hdaps_idev = input_allocate_device();
if (!hdaps_idev) {
ret = -ENOMEM;
goto out_group;
}
hdaps_idev_raw = input_allocate_device();
if (!hdaps_idev_raw) {
ret = -ENOMEM;
goto out_idev_first;
}
/* calibration for the input device (deferred to avoid delay) */
needs_calibration = 1;
/* initialize the joystick-like fuzzed input device */
hdaps_idev->name = "ThinkPad HDAPS joystick emulation";
hdaps_idev->phys = "hdaps/input0";
hdaps_idev->id.bustype = BUS_HOST;
hdaps_idev->id.vendor = HDAPS_INPUT_VENDOR;
hdaps_idev->id.product = HDAPS_INPUT_PRODUCT;
hdaps_idev->id.version = HDAPS_INPUT_JS_VERSION;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
hdaps_idev->cdev.dev = &pdev->dev;
#endif
hdaps_idev->evbit[0] = BIT(EV_ABS);
hdaps_idev->open = hdaps_mousedev_open;
hdaps_idev->close = hdaps_mousedev_close;
input_set_abs_params(hdaps_idev, ABS_X,
-256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
input_set_abs_params(hdaps_idev, ABS_Y,
-256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
ret = input_register_device(hdaps_idev);
if (ret)
goto out_idev;
/* initialize the raw data input device */
hdaps_idev_raw->name = "ThinkPad HDAPS accelerometer data";
hdaps_idev_raw->phys = "hdaps/input1";
hdaps_idev_raw->id.bustype = BUS_HOST;
hdaps_idev_raw->id.vendor = HDAPS_INPUT_VENDOR;
hdaps_idev_raw->id.product = HDAPS_INPUT_PRODUCT;
hdaps_idev_raw->id.version = HDAPS_INPUT_RAW_VERSION;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
hdaps_idev_raw->cdev.dev = &pdev->dev;
#endif
hdaps_idev_raw->evbit[0] = BIT(EV_ABS);
hdaps_idev_raw->open = hdaps_mousedev_open;
hdaps_idev_raw->close = hdaps_mousedev_close;
input_set_abs_params(hdaps_idev_raw, ABS_X, -32768, 32767, 0, 0);
input_set_abs_params(hdaps_idev_raw, ABS_Y, -32768, 32767, 0, 0);
ret = input_register_device(hdaps_idev_raw);
if (ret)
goto out_idev_reg_first;
printk(KERN_INFO "hdaps: driver successfully loaded.\n");
return 0;
out_idev_reg_first:
input_unregister_device(hdaps_idev);
out_idev:
input_free_device(hdaps_idev_raw);
out_idev_first:
input_free_device(hdaps_idev);
out_group:
sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
out_device:
platform_device_unregister(pdev);
//.........这里部分代码省略.........
示例12: q40kbd_exit
static void __exit q40kbd_exit(void)
{
serio_unregister_port(q40kbd_port);
platform_device_unregister(q40kbd_device);
}
示例13: bridge_probe
static int __devinit
bridge_probe(struct usb_interface *iface, const struct usb_device_id *id)
{
struct usb_host_endpoint *endpoint = NULL;
struct usb_host_endpoint *bulk_in = NULL;
struct usb_host_endpoint *bulk_out = NULL;
struct usb_host_endpoint *int_in = NULL;
struct usb_device *udev;
int i;
int status = 0;
int numends;
int ch_id;
char **bname = (char **)id->driver_info;
if (iface->num_altsetting != 1) {
err("%s invalid num_altsetting %u\n",
__func__, iface->num_altsetting);
return -EINVAL;
}
udev = interface_to_usbdev(iface);
usb_get_dev(udev);
numends = iface->cur_altsetting->desc.bNumEndpoints;
for (i = 0; i < numends; i++) {
endpoint = iface->cur_altsetting->endpoint + i;
if (!endpoint) {
dev_err(&iface->dev, "%s: invalid endpoint %u\n",
__func__, i);
status = -EINVAL;
goto out;
}
if (usb_endpoint_is_bulk_in(&endpoint->desc))
bulk_in = endpoint;
else if (usb_endpoint_is_bulk_out(&endpoint->desc))
bulk_out = endpoint;
else if (usb_endpoint_is_int_in(&endpoint->desc))
int_in = endpoint;
}
if (!bulk_in || !bulk_out || !int_in) {
dev_err(&iface->dev, "%s: invalid endpoints\n", __func__);
status = -EINVAL;
goto out;
}
ch_id = get_bridge_dev_idx();
if (ch_id < 0) {
err("%s all bridge channels claimed. Probe failed\n", __func__);
return -ENODEV;
}
status = data_bridge_probe(iface, bulk_in, bulk_out,
bname[BRIDGE_DATA_IDX], ch_id);
if (status < 0) {
dev_err(&iface->dev, "data_bridge_probe failed %d\n", status);
goto out;
}
status = ctrl_bridge_probe(iface, int_in, bname[BRIDGE_CTRL_IDX],
ch_id);
if (status < 0) {
dev_err(&iface->dev, "ctrl_bridge_probe failed %d\n", status);
goto error;
}
return 0;
error:
platform_device_unregister(__dev[ch_id]->pdev);
free_rx_urbs(__dev[ch_id]);
usb_set_intfdata(iface, NULL);
out:
usb_put_dev(udev);
return status;
}
示例14: fake_exit
static __exit void fake_exit(void)
{
platform_driver_unregister(&ieee802154fake_driver);
platform_device_unregister(ieee802154fake_dev);
}
示例15: imx_3stack_asoc_exit
static void __exit imx_3stack_asoc_exit(void)
{
platform_driver_unregister(&imx_3stack_cs42888_driver);
platform_device_unregister(imx_3stack_snd_device);
}