public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Domenico Andreoli <cavokz@gmail.com>
To: Michael Buesch <mb@bu3sch.de>
Cc: David Brownell <david-b@pacbell.net>,
	video4linux-list@redhat.com,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH v3] Add bt8xxgpio driver
Date: Sun, 13 Jul 2008 18:39:52 +0200	[thread overview]
Message-ID: <20080713163952.GA32494@ska.dandreoli.com> (raw)
In-Reply-To: <200807131808.35599.mb@bu3sch.de>

On Sun, Jul 13, 2008 at 06:08:35PM +0200, Michael Buesch wrote:
> On Sunday 13 July 2008 17:43:33 Domenico Andreoli wrote:
> > 
> > Index: v4l-dvb.git/drivers/media/video/bt8xx/Makefile
> > ===================================================================
> > --- v4l-dvb.git.orig/drivers/media/video/bt8xx/Makefile	2008-07-13 15:52:08.000000000 +0200
> > +++ v4l-dvb.git/drivers/media/video/bt8xx/Makefile	2008-07-13 17:11:27.000000000 +0200
> > @@ -6,7 +6,11 @@
> >  		       bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \
> >  		       bttv-input.o bttv-audio-hook.o

[...]

> > +
> > +static void __devexit bttv_gpiolib_remove(struct bttv_sub_device *sub)
> > +{
> > +	int ret;
> > +	struct bttv_gpiolib_device *device = dev_get_drvdata(&sub->dev);
> > +
> > +	while((ret = gpiochip_remove(&device->chip)) != 0) {
> > +		printk(KERN_INFO "error unregistering chip %s: %d\n", device->chip.label, ret);
> > +		schedule();
> > +	}
> 
> This loop is dangerous.
> Simply try to unregister it and exit with an error message if it failed.
> Looping is of no use.
> In fact, I think gpiochip_remove should return void. Drivers cannot
> do anything if it failed, anyway.

Here the module is going to free device structure. Ignoring the error
looks even more dangerous to me. I need to see if scheduling while
unloading a module is allowed.

[...]

> >
> > Index: v4l-dvb.git/drivers/media/video/bt8xx/bttv.h
> > ===================================================================
> > --- v4l-dvb.git.orig/drivers/media/video/bt8xx/bttv.h	2008-07-13 15:52:08.000000000 +0200
> > +++ v4l-dvb.git/drivers/media/video/bt8xx/bttv.h	2008-07-13 16:53:42.000000000 +0200
> > @@ -249,6 +249,8 @@
> >  	void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set);
> >  
> >  	void (*muxsel_hook)(struct bttv *btv, unsigned int input);
> > +
> > +	unsigned int has_gpiolib:1;
> 
> :1 style bitfields generate ugly code and they make no sense most of
> the time. better use "bool".

This is copied stuff from bt8xxgpio and dvb-bt8xx ;)

Thanks,
Domenico

-----[ Domenico Andreoli, aka cavok
 --[ http://www.dandreoli.com/gpgkey.asc
   ---[ 3A0F 2F80 F79C 678A 8936  4FEE 0677 9033 A20E BC50

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  parent reply	other threads:[~2008-07-13 16:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200807101914.10174.mb@bu3sch.de>
     [not found] ` <20080710160258.4ddb5c61@gaivota>
2008-07-13  0:42   ` [PATCH v3] Add bt8xxgpio driver Domenico Andreoli
     [not found]     ` <200807131215.12082.mb@bu3sch.de>
2008-07-13 15:43       ` Domenico Andreoli
     [not found]         ` <200807131808.35599.mb@bu3sch.de>
2008-07-13 16:39           ` Domenico Andreoli [this message]
2008-07-15  8:46             ` Trent Piepho
     [not found]         ` <200807131300.35126.david-b@pacbell.net>
2008-07-14  5:25           ` Domenico Andreoli
     [not found]             ` <200807132259.54360.david-b@pacbell.net>
2008-07-14  7:27               ` Domenico Andreoli
     [not found]                 ` <200807141558.29582.mb@bu3sch.de>
2008-07-14 15:25                   ` Domenico Andreoli
     [not found]                     ` <200807140926.28592.david-b@pacbell.net>
2008-07-14 17:08                       ` Domenico Andreoli
     [not found]                     ` <200807141951.39810.mb@bu3sch.de>
2008-07-14 19:21                       ` Domenico Andreoli

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=20080713163952.GA32494@ska.dandreoli.com \
    --to=cavokz@gmail.com \
    --cc=david-b@pacbell.net \
    --cc=mb@bu3sch.de \
    --cc=mchehab@infradead.org \
    --cc=video4linux-list@redhat.com \
    /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