linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Greg K-H <greg@kroah.com>, V4L <video4linux-list@redhat.com>
Subject: [CFT 3/3] Add bttv sub bus_type probe and remove methods
Date: Fri, 06 Jan 2006 11:42:03 +0000	[thread overview]
Message-ID: <20060106114059.13.32@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20060105142951.13.01@flint.arm.linux.org.uk>

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

(This is an additional patch - on lkml, see
 "[CFT 1/29] Add bus_type probe, remove, shutdown methods.")

---
 drivers/media/dvb/bt8xx/dvb-bt8xx.c |   23 +++++++++++------------
 drivers/media/video/bttv-gpio.c     |   24 ++++++++++++++++++++++--
 drivers/media/video/bttv.h          |    2 ++
 drivers/media/video/ir-kbd-gpio.c   |   17 ++++++++---------
 4 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -787,9 +787,8 @@ static int __init dvb_bt8xx_load_card(st
 	return 0;
 }
 
-static int dvb_bt8xx_probe(struct device *dev)
+static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
 {
-	struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
 	struct dvb_bt8xx_card *card;
 	struct pci_dev* bttv_pci_dev;
 	int ret;
@@ -907,13 +906,13 @@ static int dvb_bt8xx_probe(struct device
 		return ret;
 	}
 
-	dev_set_drvdata(dev, card);
+	dev_set_drvdata(&sub->dev, card);
 	return 0;
 }
 
-static int dvb_bt8xx_remove(struct device *dev)
+static int dvb_bt8xx_remove(struct bttv_sub_device *sub)
 {
-	struct dvb_bt8xx_card *card = dev_get_drvdata(dev);
+	struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev);
 
 	dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr);
 
@@ -936,14 +935,14 @@ static int dvb_bt8xx_remove(struct devic
 static struct bttv_sub_driver driver = {
 	.drv = {
 		.name		= "dvb-bt8xx",
-		.probe		= dvb_bt8xx_probe,
-		.remove		= dvb_bt8xx_remove,
-		/* FIXME:
-		 * .shutdown	= dvb_bt8xx_shutdown,
-		 * .suspend	= dvb_bt8xx_suspend,
-		 * .resume	= dvb_bt8xx_resume,
-		 */
 	},
+	.probe		= dvb_bt8xx_probe,
+	.remove		= dvb_bt8xx_remove,
+	/* FIXME:
+	 * .shutdown	= dvb_bt8xx_shutdown,
+	 * .suspend	= dvb_bt8xx_suspend,
+	 * .resume	= dvb_bt8xx_resume,
+	 */
 };
 
 static int __init dvb_bt8xx_init(void)
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c
--- a/drivers/media/video/bttv-gpio.c
+++ b/drivers/media/video/bttv-gpio.c
@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct dev
 	return 0;
 }
 
+static int bttv_sub_probe(struct device *dev)
+{
+	struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+	struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+	return sub->probe ? sub->probe(sdev) : -ENODEV;
+}
+
+static int bttv_sub_remove(struct device *dev)
+{
+	struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+	struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+	if (sub->remove)
+		sub->remove(sdev);
+	return 0;
+}
+
 struct bus_type bttv_sub_bus_type = {
-	.name  = "bttv-sub",
-	.match = &bttv_sub_bus_match,
+	.name   = "bttv-sub",
+	.match  = &bttv_sub_bus_match,
+	.probe  = bttv_sub_probe,
+	.remove = bttv_sub_remove,
 };
 EXPORT_SYMBOL(bttv_sub_bus_type);
 
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h
--- a/drivers/media/video/bttv.h
+++ b/drivers/media/video/bttv.h
@@ -334,6 +334,8 @@ struct bttv_sub_device {
 struct bttv_sub_driver {
 	struct device_driver   drv;
 	char                   wanted[BUS_ID_SIZE];
+	int                    (*probe)(struct bttv_sub_device *sub);
+	void                   (*remove)(struct bttv_sub_device *sub);
 	void                   (*gpio_irq)(struct bttv_sub_device *sub);
 	int                    (*any_irq)(struct bttv_sub_device *sub);
 };
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c
--- a/drivers/media/video/ir-kbd-gpio.c
+++ b/drivers/media/video/ir-kbd-gpio.c
@@ -319,15 +319,15 @@ module_param(repeat_period, int, 0644);
 	printk(KERN_DEBUG DEVNAME ": " fmt , ## arg)
 
 static void ir_irq(struct bttv_sub_device *sub);
-static int ir_probe(struct device *dev);
-static int ir_remove(struct device *dev);
+static int ir_probe(struct bttv_sub_device *sub);
+static int ir_remove(struct bttv_sub_device *sub);
 
 static struct bttv_sub_driver driver = {
 	.drv = {
 		.name	= DEVNAME,
-		.probe	= ir_probe,
-		.remove	= ir_remove,
 	},
+	.probe		= ir_probe,
+	.remove		= ir_remove,
 	.gpio_irq 	= ir_irq,
 };
 
@@ -570,9 +570,8 @@ static void ir_rc5_timer_keyup(unsigned 
 
 /* ---------------------------------------------------------------------- */
 
-static int ir_probe(struct device *dev)
+static int ir_probe(struct bttv_sub_device *sub)
 {
-	struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
 	struct IR *ir;
 	struct input_dev *input_dev;
 	IR_KEYTAB_TYPE *ir_codes = NULL;
@@ -707,7 +706,7 @@ static int ir_probe(struct device *dev)
 	}
 
 	/* all done */
-	dev_set_drvdata(dev, ir);
+	dev_set_drvdata(&sub->dev, ir);
 	input_register_device(ir->input);
 
 	/* the remote isn't as bouncy as a keyboard */
@@ -717,9 +716,9 @@ static int ir_probe(struct device *dev)
 	return 0;
 }
 
-static int ir_remove(struct device *dev)
+static int ir_remove(struct bttv_sub_device *sub)
 {
-	struct IR *ir = dev_get_drvdata(dev);
+	struct IR *ir = dev_get_drvdata(&sub->dev);
 
 	if (ir->polling) {
 		del_timer(&ir->timer);

  parent reply	other threads:[~2006-01-06 11:42 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-05 14:29 [CFT 1/29] Add bus_type probe, remove, shutdown methods Russell King
2006-01-05 14:30 ` [CFT 2/29] Add pci_bus_type probe and remove methods Russell King
2006-01-05 14:30 ` [CFT 3/29] Add ecard_bus_type probe/remove/shutdown methods Russell King
2006-01-05 14:31 ` [CFT 4/29] " Russell King
2006-01-05 14:32 ` [CFT 5/29] Add AMBA bus_type " Russell King
2006-01-05 14:32 ` [CFT 6/29] Add SA1111 bus_type probe/remove methods Russell King
2006-01-05 14:33 ` [CFT 7/29] Add locomo " Russell King
2006-01-05 15:35   ` Richard Purdie
2006-01-05 14:33 ` [CFT 8/29] Add logic module " Russell King
2006-01-05 14:34 ` [CFT 9/29] Add tiocx " Russell King
2006-01-12  9:45   ` Paul Jackson
2006-01-12 10:31     ` Paul Jackson
2006-01-05 14:34 ` [CFT 10/29] Add parisc_bus_type probe and remove methods Russell King
2006-01-05 18:46   ` [parisc-linux] " Matthew Wilcox
2006-01-05 14:35 ` [CFT 11/29] Add ocp_bus_type " Russell King
2006-01-05 14:35 ` [CFT 12/29] Add sh_bus_type " Russell King
2006-01-05 14:36 ` [CFT 13/29] Add of_platform_bus_type " Russell King
2006-01-05 14:36 ` [CFT 14/29] Add vio_bus_type " Russell King
2006-01-05 14:37 ` [CFT 15/29] Add dio_bus_type " Russell King
2006-01-05 14:37 ` [CFT 16/29] Add i2c_bus_type " Russell King
2006-01-05 14:38 ` [CFT 17/29] Add gameport bus_type " Russell King
2006-01-05 14:38 ` [CFT 18/29] Add serio " Russell King
2006-01-05 14:39 ` [CFT 19/29] Add macio_bus_type " Russell King
2006-01-05 14:39 ` [CFT 20/29] Add MCP bus_type " Russell King
2006-01-05 14:40 ` [CFT 21/29] Add mmc_bus_type " Russell King
2006-01-05 14:40 ` [CFT 22/29] Add pcmcia_bus_type " Russell King
2006-01-05 14:41 ` [CFT 23/29] Add pnp_bus_type " Russell King
2006-01-05 14:42 ` [CFT 24/29] Add ccwgroup_bus_type " Russell King
2006-01-05 14:42 ` [CFT 25/29] Add superhyway_bus_type " Russell King
2006-01-05 14:43 ` [CFT 26/29] Add usb_serial_bus_type " Russell King
2006-01-05 14:43 ` [CFT 27/29] Add zorro_bus_type " Russell King
2006-01-05 14:44 ` [CFT 28/29] Add rio_bus_type " Russell King
2006-01-05 14:44 ` [CFT 29/29] Add Pseudo LLD bus_type " Russell King
2006-01-05 23:07 ` [CFT 1/29] Add bus_type probe, remove, shutdown methods Greg KH
2006-01-05 23:24   ` Russell King
2006-01-06  0:44     ` Greg KH
2006-01-06 11:41 ` [CFT 1/3] Add ide_bus_type probe and remove methods Russell King
2006-01-11 15:01   ` Bartlomiej Zolnierkiewicz
2006-01-06 11:41 ` [CFT 2/3] Remove usb gadget generic driver methods Russell King
2006-01-06 11:42 ` Russell King [this message]
2006-01-10 15:05   ` [CFT 3/3] Add bttv sub bus_type probe and remove methods Michael Krufky
2006-01-06 11:48 ` [CFT 1/29] Add bus_type probe, remove, shutdown methods Russell King
2006-01-06 13:38   ` Cornelia Huck
2006-01-11  9:56     ` [PATCH] Add {css,ccw}_bus_type " Cornelia Huck
2006-01-06 16:34   ` [CFT 1/29] Add bus_type " James Bottomley
2006-01-06 16:57     ` Russell King

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=20060106114059.13.32@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).