public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Jim Cromie <jim.cromie@gmail.com>
Cc: linux-kernel@vger.kernel.org, gregkh@suse.de,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 06/23] use register_chrdev_ids in drivers/media/
Date: Sat, 21 May 2011 09:48:11 -0300	[thread overview]
Message-ID: <4DD7B48B.3080507@infradead.org> (raw)
In-Reply-To: <1305840792-25877-7-git-send-email-jim.cromie@gmail.com>

Em 19-05-2011 18:33, Jim Cromie escreveu:
> Since new api passes dev_t*, hoist inline MKDEV out to local var
> assignment, and replace other inline MKDEVs with new var.

While I don't see the need for this change, I'm ok with that.

Please notice that it is not clear if you expect me to apply the patch or not,
as you simply c/c me and Greg on it.

So I'm assuming that somebody else will be applying it. In this case:

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>

> 
> This and 2 subsequent patches brought to you by coccinelle/spatch
> 
> cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> cc: linux-media@vger.kernel.org
> 
> @ rcr_md @
> identifier f;
> expression major, minor;
> expression ct, name;
> @@
> 
> 	f(...) {
> // ++ gives multiple inserts, needed for tty_io.c, fix up manually
> // fresh identifier apparently also helps here
> ++	dev_t devt;
> ++	devt = MKDEV(major,minor);
> 
> <+...
> -	register_chrdev_region
> +	register_chrdev_ids
> 	(
> -	MKDEV(major,minor),
> +	&devt,
> 	ct, name)
> ...+>
> 
> }
> 
> @ all_md depends on rcr_md @	// where above changes made, also do
> identifier f;
> expression major, minor;
> @@
> 
> 	f(...) {
> 	dev_t devt;
> 	devt = MKDEV(major,minor);
> 
> <+...
> -	MKDEV(major,minor)
> +	devt
> ...+>
> 	}
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> ---
>  drivers/media/dvb/dvb-core/dvbdev.c |    6 ++++--
>  drivers/media/media-devnode.c       |    3 +--
>  drivers/media/rc/lirc_dev.c         |    4 ++--
>  drivers/media/video/v4l2-dev.c      |    2 +-
>  4 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
> index f732877..225b9d5 100644
> --- a/drivers/media/dvb/dvb-core/dvbdev.c
> +++ b/drivers/media/dvb/dvb-core/dvbdev.c
> @@ -464,8 +464,10 @@ static int __init init_dvbdev(void)
>  	int retval;
>  	dev_t dev = MKDEV(DVB_MAJOR, 0);
>  
> -	if ((retval = register_chrdev_region(dev, MAX_DVB_MINORS, "DVB")) != 0) {
> -		printk(KERN_ERR "dvb-core: unable to get major %d\n", DVB_MAJOR);
> +	retval = register_chrdev_ids(&dev, MAX_DVB_MINORS, "DVB");
> +	if (retval != 0) {
> +		printk(KERN_ERR "dvb-core: unable to get major %d\n",
> +		       DVB_MAJOR);
>  		return retval;
>  	}
>  
> diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
> index af5263c..e45f322 100644
> --- a/drivers/media/media-devnode.c
> +++ b/drivers/media/media-devnode.c
> @@ -289,8 +289,7 @@ static int __init media_devnode_init(void)
>  	int ret;
>  
>  	printk(KERN_INFO "Linux media interface: v0.10\n");
> -	ret = alloc_chrdev_region(&media_dev_t, 0, MEDIA_NUM_DEVICES,
> -				  MEDIA_NAME);
> +	ret = register_chrdev_ids(&media_dev_t, MEDIA_NUM_DEVICES, MEDIA_NAME);
>  	if (ret < 0) {
>  		printk(KERN_WARNING "media: unable to allocate major\n");
>  		return ret;
> diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
> index fd237ab..28f2968 100644
> --- a/drivers/media/rc/lirc_dev.c
> +++ b/drivers/media/rc/lirc_dev.c
> @@ -780,11 +780,11 @@ static int __init lirc_dev_init(void)
>  		goto error;
>  	}
>  
> -	retval = alloc_chrdev_region(&lirc_base_dev, 0, MAX_IRCTL_DEVICES,
> +	retval = register_chrdev_ids(&lirc_base_dev, MAX_IRCTL_DEVICES,
>  				     IRCTL_DEV_NAME);
>  	if (retval) {
>  		class_destroy(lirc_class);
> -		printk(KERN_ERR "lirc_dev: alloc_chrdev_region failed\n");
> +		printk(KERN_ERR "lirc_dev: register_chrdev_ids() failed\n");
>  		goto error;
>  	}
>  
> diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
> index 6dc7196..9ae24e2 100644
> --- a/drivers/media/video/v4l2-dev.c
> +++ b/drivers/media/video/v4l2-dev.c
> @@ -761,7 +761,7 @@ static int __init videodev_init(void)
>  	int ret;
>  
>  	printk(KERN_INFO "Linux video capture interface: v2.00\n");
> -	ret = register_chrdev_region(dev, VIDEO_NUM_DEVICES, VIDEO_NAME);
> +	ret = register_chrdev_ids(&dev, VIDEO_NUM_DEVICES, VIDEO_NAME);
>  	if (ret < 0) {
>  		printk(KERN_WARNING "videodev: unable to get major %d\n",
>  				VIDEO_MAJOR);


      reply	other threads:[~2011-05-21 12:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1305840792-25877-1-git-send-email-jim.cromie@gmail.com>
2011-05-19 21:33 ` [PATCH 06/23] use register_chrdev_ids in drivers/media/ Jim Cromie
2011-05-21 12:48   ` Mauro Carvalho Chehab [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=4DD7B48B.3080507@infradead.org \
    --to=mchehab@infradead.org \
    --cc=gregkh@suse.de \
    --cc=jim.cromie@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@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