From: Daniel Vetter <daniel@ffwll.ch>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Cc: airlied@linux.ie, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, julia.lawall@lip6.fr
Subject: Re: [PATCH] drm/udl: Use module_usb_driver
Date: Wed, 17 Feb 2016 14:19:43 +0100 [thread overview]
Message-ID: <20160217131943.GG32705@phenom.ffwll.local> (raw)
In-Reply-To: <20160217121327.GA29682@amitoj-Inspiron-3542>
On Wed, Feb 17, 2016 at 05:43:27PM +0530, Amitoj Kaur Chawla wrote:
> Macro module_usb_driver is used for drivers whose init and exit paths
> only register and unregister to usb API. So remove boilerplate code to
> make code simpler by using module_usb_driver.
>
> This change was made with the help of the following Coccinelle
> semantic patch:
>
> //<smpl>
> @a@
> identifier f, x;
> @@
> -static f(...) { return usb_register(&x); }
>
> @b depends on a@
> identifier e, a.x;
> @@
> -static e(...) { usb_deregister(&x); }
>
> @c depends on a && b@
> identifier a.f;
> declarer name module_init;
> @@
> -module_init(f);
>
> @d depends on a && b && c@
> identifier b.e, a.x;
> declarer name module_exit;
> declarer name module_usb_driver;
> @@
> -module_exit(e);
> +module_usb_driver(x);
> //</smpl>
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Applied to drm-misc, thanks.
-Daniel
> ---
> drivers/gpu/drm/udl/udl_drv.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index d5728ec..772ec9e 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -125,17 +125,5 @@ static struct usb_driver udl_driver = {
> .disconnect = udl_usb_disconnect,
> .id_table = id_table,
> };
> -
> -static int __init udl_init(void)
> -{
> - return usb_register(&udl_driver);
> -}
> -
> -static void __exit udl_exit(void)
> -{
> - usb_deregister(&udl_driver);
> -}
> -
> -module_init(udl_init);
> -module_exit(udl_exit);
> +module_usb_driver(udl_driver);
> MODULE_LICENSE("GPL");
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2016-02-17 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 12:13 Amitoj Kaur Chawla
2016-02-17 13:19 ` Daniel Vetter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160217131943.GG32705@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=amitoj1606@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®