linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] serial: 8250_pci: add .probe member to struct pci_serial_quirk
@ 2011-05-29 19:08 Frédéric Brière
  2011-05-29 19:08 ` [PATCH 2/2] parport/serial: add support for Timedia/SUNIX cards to parport_serial Frédéric Brière
  0 siblings, 1 reply; 4+ messages in thread
From: Frédéric Brière @ 2011-05-29 19:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, linux-parport, linux-serial, Alan Cox

This function, if present, is called early on by the 8250_pci probe; it
can be used to reject devices meant for parport_serial.  (The .init
function cannot be used for this purpose, as it is also called by
parport_serial.)

Signed-off-by: Frédéric Brière <fbriere@fbriere.net>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-parport@lists.infradead.org
---
 drivers/tty/serial/8250_pci.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index 4b4968a..e6fb67b 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -39,6 +39,7 @@ struct pci_serial_quirk {
 	u32	device;
 	u32	subvendor;
 	u32	subdevice;
+	int	(*probe)(struct pci_dev *dev);
 	int	(*init)(struct pci_dev *dev);
 	int	(*setup)(struct serial_private *,
 			 const struct pciserial_board *,
@@ -2581,11 +2582,19 @@ EXPORT_SYMBOL_GPL(pciserial_resume_ports);
 static int __devinit
 pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
 {
+	struct pci_serial_quirk *quirk;
 	struct serial_private *priv;
 	const struct pciserial_board *board;
 	struct pciserial_board tmp;
 	int rc;
 
+	quirk = find_quirk(dev);
+	if (quirk->probe) {
+		rc = quirk->probe(dev);
+		if (rc)
+			return rc;
+	}
+
 	if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
 		printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n",
 			ent->driver_data);
-- 
1.7.5.1


_______________________________________________
Linux-parport mailing list
Linux-parport@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-parport

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [PATCH] parport/serial: add support for Timedia/SUNIX cards to parport_serial
@ 2010-07-12 15:44 Frédéric Brière
  2010-07-12 15:49 ` [PATCH 2/2] " Frédéric Brière
  0 siblings, 1 reply; 4+ messages in thread
From: Frédéric Brière @ 2010-07-12 15:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-serial, linux-parport

On Thu, Jul 08, 2010 at 12:11:22PM +0100, Alan Cox wrote:
> If you did that check in the serial driver and returned -ENODEV to the
> probe the id will be handed on to the next driver that matches (ie
> parport_serial)

Thanks for the suggestion; it does look much cleaner that way.

Instead of sticking a big-ass if() in the function, I took the liberty
of adding a .probe alongside the .init/.setup quirks, in case this could
be useful for other devices.

Note that I did not bother to cache the result of find_quirk(), so it
will be called twice.  I did not find it worth to add extra complexity
just for that; let me know if you disagree.


-- 
On the Internet, no one knows you're using Windows NT
		-- Submitted by Ramiro Estrugo, restrugo@fateware.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-01 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-29 19:08 [PATCH 1/2] serial: 8250_pci: add .probe member to struct pci_serial_quirk Frédéric Brière
2011-05-29 19:08 ` [PATCH 2/2] parport/serial: add support for Timedia/SUNIX cards to parport_serial Frédéric Brière
2011-06-01 12:41   ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2010-07-12 15:44 [PATCH] " Frédéric Brière
2010-07-12 15:49 ` [PATCH 2/2] " Frédéric Brière

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).