/* =====================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 */
static void __exit kylew_modexit(void) { platform_device_unregister(kylew_snd_device); }
static void __exit msm_audio_exit(void) { msm8660_wm8903_unprepare(); platform_device_unregister(msm_snd_device); }
static void __exit sc881x_modexit(void) { platform_device_unregister(sc881x_snd_device); }
static void __exit imx_phycore_exit(void) { platform_device_unregister(imx_phycore_snd_device); platform_device_unregister(imx_phycore_snd_ac97_device); }
static void __exit rx1950_exit(void) { platform_device_unregister(s3c24xx_snd_device); gpio_free(S3C2410_GPA(1)); }
int ctrl_bridge_probe(struct usb_interface *ifc, struct usb_host_endpoint *int_in, int id) { struct ctrl_bridge *dev; struct usb_device *udev; struct usb_endpoint_descriptor *ep; u16 wMaxPacketSize; int retval = 0; int interval; udev = interface_to_usbdev(ifc); dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) { dev_err(&ifc->dev, "%s: unable to allocate dev\n", __func__); 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; }
static void __exit tc1100_exit(void) { platform_device_unregister(tc1100_device); platform_driver_unregister(&tc1100_driver); }
static void lirc_dove_exit(void) { platform_device_unregister(lirc_dove_dev); platform_driver_unregister(&lirc_dove_driver); lirc_buffer_free(&rbuf); }
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); }
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); out_driver: platform_driver_unregister(&hdaps_driver); hdaps_device_shutdown(); out: printk(KERN_WARNING "hdaps: driver init failed (ret=%d)!\n", ret); return ret; }
static void __exit q40kbd_exit(void) { serio_unregister_port(q40kbd_port); platform_device_unregister(q40kbd_device); }
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; }
static __exit void fake_exit(void) { platform_driver_unregister(&ieee802154fake_driver); platform_device_unregister(ieee802154fake_dev); }
static void __exit pavo_exit(void) { platform_device_unregister(pavo_snd_device); }
static void __exit imx_3stack_asoc_exit(void) { platform_driver_unregister(&imx_3stack_cs42888_driver); platform_device_unregister(imx_3stack_snd_device); }
static void __exit gp_ext_rtc_exit(void) { platform_driver_unregister(&gp_ext_rtc_driver); platform_device_unregister(&gp_ext_rtc_device); }
static void __exit test_exit(void) { platform_device_unregister(test0); platform_device_unregister(test1); platform_driver_unregister(&test_driver); }
static void __exit imapx200_exit(void) { platform_device_unregister(imapx200_snd_device); }
static void __exit uio_kpart_exit(void) { printk(KERN_ERR "uio_kpart_exit"); platform_device_unregister(uio_dummy_device); driver_unregister(&uio_dummy_driver); }
static void __exit smdk64xx_audio_exit(void) { platform_device_unregister(smdk64xx_snd_device); }
static void __exit i5k_amb_exit(void) { platform_device_unregister(amb_pdev); platform_driver_unregister(&i5k_amb_driver); }
static void asus_platform_exit(struct asus_laptop *asus) { sysfs_remove_group(&asus->platform_device->dev.kobj, &asus_attr_group); platform_device_unregister(asus->platform_device); }
static void __exit cosmopolitan_soc_exit(void) { regulator_put(av_switch_reg); platform_device_unregister(sdp4430_snd_device); }
static void __exit sp5100_tco_cleanup_module(void) { platform_device_unregister(sp5100_tco_platform_device); platform_driver_unregister(&sp5100_tco_driver); ; }
static void __exit acer_hs_exit(void) { platform_device_unregister(&acer_hs_device); platform_driver_unregister(&acer_hs_driver); }
static void __exit geodewdt_exit(void) { platform_device_unregister(geodewdt_platform_device); platform_driver_unregister(&geodewdt_driver); }
static void __exit smartq_exit(void) { gpio_free(S3C64XX_GPK(12)); platform_device_unregister(smartq_snd_device); }
static int omap_usbhs_alloc_children(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct usbhs_hcd_omap *omap; struct ehci_hcd_omap_platform_data *ehci_data; struct ohci_hcd_omap_platform_data *ohci_data; struct platform_device *ehci; struct platform_device *ohci; struct resource *res; struct resource resources[2]; int ret; omap = platform_get_drvdata(pdev); ehci_data = omap->platdata.ehci_data; ohci_data = omap->platdata.ohci_data; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci"); if (!res) { dev_err(dev, "EHCI get resource IORESOURCE_MEM failed\n"); ret = -ENODEV; goto err_end; } resources[0] = *res; res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ehci-irq"); if (!res) { dev_err(dev, " EHCI get resource IORESOURCE_IRQ failed\n"); ret = -ENODEV; goto err_end; } resources[1] = *res; ehci = omap_usbhs_alloc_child(OMAP_EHCI_DEVICE, resources, 2, ehci_data, sizeof(*ehci_data), dev); if (!ehci) { dev_err(dev, "omap_usbhs_alloc_child failed\n"); ret = -ENOMEM; goto err_end; } res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ohci"); if (!res) { dev_err(dev, "OHCI get resource IORESOURCE_MEM failed\n"); ret = -ENODEV; goto err_ehci; } resources[0] = *res; res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ohci-irq"); if (!res) { dev_err(dev, "OHCI get resource IORESOURCE_IRQ failed\n"); ret = -ENODEV; goto err_ehci; } resources[1] = *res; ohci = omap_usbhs_alloc_child(OMAP_OHCI_DEVICE, resources, 2, ohci_data, sizeof(*ohci_data), dev); if (!ohci) { dev_err(dev, "omap_usbhs_alloc_child failed\n"); ret = -ENOMEM; goto err_ehci; } return 0; err_ehci: platform_device_unregister(ehci); err_end: return ret; }
static void __exit q40kbd_exit(void) { platform_device_unregister(q40kbd_device); platform_driver_unregister(&q40kbd_driver); }