Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[firefly-linux-kernel-4.4.55.git] / drivers / staging / emxx_udc / emxx_udc.c
index f62636462fe46e297a321f0188c0a781f0ffe978..4e6c16af40fc5f8fa2065dacb946ad2a78adf0e9 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
 
 #include "emxx_udc.h"
 
-#define        DRIVER_DESC     "EMXX UDC driver"
 #define        DMA_ADDR_INVALID        (~(dma_addr_t)0)
 
 static const char      driver_name[] = "emxx_udc";
-static const char      driver_desc[] = DRIVER_DESC;
 
 /*===========================================================================*/
 /* Prototype */
@@ -213,7 +211,7 @@ static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc)
                }
 
                if ((data >> 16) > last_ram_adr)
-                       last_ram_adr = data>>16;
+                       last_ram_adr = data >> 16;
        }
 
        return last_ram_adr + use_ram_size;
@@ -1269,7 +1267,7 @@ static int _nbu2ss_start_transfer(
                /* EPn */
                if (ep->direct == USB_DIR_OUT) {
                        /* OUT */
-                       if (bflag == FALSE)
+                       if (!bflag)
                                nret = _nbu2ss_epn_out_transfer(udc, ep, req);
                } else {
                        /* IN */
@@ -1511,7 +1509,7 @@ static inline int _nbu2ss_req_feature(struct nbu2ss_udc *udc, bool bset)
                if (0x0000 == (wIndex & 0xFF70)) {
                        if (selector == USB_ENDPOINT_HALT) {
                                ep_adrs = wIndex & 0xFF;
-                               if (bset == FALSE) {
+                               if (!bset) {
                                        _nbu2ss_endpoint_toggle_reset(
                                                udc, ep_adrs);
                                }
@@ -1758,7 +1756,7 @@ static inline int _nbu2ss_decode_request(struct nbu2ss_udc *udc)
                }
        }
 
-       if (bcall_back == FALSE) {
+       if (!bcall_back) {
                if (udc->ep0state == EP0_IN_STATUS_PHASE) {
                        if (nret >= 0) {
                                /*--------------------------------------*/
@@ -2046,7 +2044,7 @@ static inline void _nbu2ss_epn_in_dma_int(
 
        preq = &req->req;
 
-       if (req->dma_flag == FALSE)
+       if (!req->dma_flag)
                return;
 
        preq->actual += req->div_len;
@@ -2758,7 +2756,7 @@ static int nbu2ss_ep_queue(
        bflag = list_empty(&ep->queue);
        list_add_tail(&req->queue, &ep->queue);
 
-       if ((bflag != FALSE) && (ep->stalled == FALSE)) {
+       if (bflag && !ep->stalled) {
 
                result = _nbu2ss_start_transfer(udc, ep, req, FALSE);
                if (result < 0) {
@@ -3320,28 +3318,6 @@ static void nbu2ss_drv_shutdown(struct platform_device *pdev)
        _nbu2ss_disable_controller(udc);
 }
 
-/*-------------------------------------------------------------------------*/
-static int __exit nbu2ss_drv_remove(struct platform_device *pdev)
-{
-       struct nbu2ss_udc       *udc;
-       struct nbu2ss_ep        *ep;
-       int     i;
-
-       udc = &udc_controller;
-
-       for (i = 0; i < NUM_ENDPOINTS; i++) {
-               ep = &udc->ep[i];
-               if (ep->virt_buf)
-                       dma_free_coherent(NULL, PAGE_SIZE,
-                               (void *)ep->virt_buf, ep->phys_buf);
-       }
-
-       /* Interrupt Handler - Release */
-       free_irq(INT_VBUS, udc);
-
-       return 0;
-}
-
 /*-------------------------------------------------------------------------*/
 static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state)
 {
@@ -3394,17 +3370,12 @@ static int nbu2ss_drv_resume(struct platform_device *pdev)
 static struct platform_driver udc_driver = {
        .probe          = nbu2ss_drv_probe,
        .shutdown       = nbu2ss_drv_shutdown,
-       .remove         = __exit_p(nbu2ss_drv_remove),
        .suspend        = nbu2ss_drv_suspend,
        .resume         = nbu2ss_drv_resume,
        .driver         = {
-               .name   = driver_name,
+               .name                   = driver_name,
+               .suppress_bind_attrs    = true,
        },
 };
 
-module_platform_driver(udc_driver);
-
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_AUTHOR("Renesas Electronics Corporation");
-MODULE_LICENSE("GPL");
-
+builtin_platform_driver(udc_driver);