linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: "David Härdeman" <david@hardeman.nu>
Cc: Sean Young <sean@mess.org>, Jarod Wilson <jarod@wilsonet.com>,
	Alan Cox <alan@linux.intel.com>,
	linux-media@vger.kernel.org, linux-serial@vger.kernel.org,
	lirc-list@lists.sourceforge.net
Subject: Re: [PATCH] [media] winbond-cir: Fix initialization
Date: Sat, 11 Aug 2012 17:20:08 -0300	[thread overview]
Message-ID: <5026BE78.80902@redhat.com> (raw)
In-Reply-To: <1343731023-9822-1-git-send-email-sean@mess.org>

Hi David,

Em 31-07-2012 07:37, Sean Young escreveu:
> The serial driver will detect the winbond cir device as a serial port,
> since it looks exactly like a serial port unless you know what it is
> from the PNP ID.
> 
> Winbond CIR 00:04: Region 0x2f8-0x2ff already in use!
> Winbond CIR 00:04: disabled
> Winbond CIR: probe of 00:04 failed with error -16

Please review this patch.

> 
> Signed-off-by: Sean Young <sean@mess.org>
> ---
>  drivers/media/rc/winbond-cir.c | 21 ++++++++++++++++++++-
>  drivers/tty/serial/8250/8250.c |  1 +
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
> index 54ee348..20a0bbb 100644
> --- a/drivers/media/rc/winbond-cir.c
> +++ b/drivers/media/rc/winbond-cir.c
> @@ -55,6 +55,7 @@
>  #include <linux/slab.h>
>  #include <linux/wait.h>
>  #include <linux/sched.h>
> +#include <linux/serial_8250.h>
>  #include <media/rc-core.h>
>  
>  #define DRVNAME "winbond-cir"
> @@ -957,6 +958,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
>  	struct device *dev = &device->dev;
>  	struct wbcir_data *data;
>  	int err;
> +	struct resource *io;
>  
>  	if (!(pnp_port_len(device, 0) == EHFUNC_IOMEM_LEN &&
>  	      pnp_port_len(device, 1) == WAKEUP_IOMEM_LEN &&
> @@ -1049,7 +1051,24 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
>  		goto exit_release_wbase;
>  	}
>  
> -	if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
> +	io = request_region(data->sbase, SP_IOMEM_LEN, DRVNAME);
> +
> +	/*
> +	 * The winbond cir device looks exactly like an NS16550A serial port
> +	 * unless you know what it is. We've got here via the PNP ID.
> +	 */
> +#ifdef CONFIG_SERIAL_8250
> +	if (!io) {
> +		struct uart_port port = { .iobase = data->sbase };
> +		int line = serial8250_find_port(&port);
> +		if (line >= 0) {
> +			serial8250_unregister_port(line);

Hmm... Not sure if it makes sense, but perhaps the unregistering code
should be reverting serial8250_unregister_port(line).

> +
> +			io = request_region(data->sbase, SP_IOMEM_LEN, DRVNAME);
> +		}
> +	}
> +#endif
> +	if (!io) {
>  		dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
>  			data->sbase, data->sbase + SP_IOMEM_LEN - 1);
>  		err = -EBUSY;
> diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
> index 5c27f7e..d38615f 100644
> --- a/drivers/tty/serial/8250/8250.c
> +++ b/drivers/tty/serial/8250/8250.c
> @@ -2914,6 +2914,7 @@ int serial8250_find_port(struct uart_port *p)
>  	}
>  	return -ENODEV;
>  }
> +EXPORT_SYMBOL(serial8250_find_port);
>  
>  #define SERIAL8250_CONSOLE	&serial8250_console
>  #else
> 

  reply	other threads:[~2012-08-11 20:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 10:37 [PATCH] [media] winbond-cir: Fix initialization Sean Young
2012-08-11 20:20 ` Mauro Carvalho Chehab [this message]
2012-08-19 16:00   ` Alan Cox
2012-08-16 16:19 ` Greg KH
2012-08-16 21:16   ` Sean Young
2012-08-18 22:46 ` David Härdeman

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=5026BE78.80902@redhat.com \
    --to=mchehab@redhat.com \
    --cc=alan@linux.intel.com \
    --cc=david@hardeman.nu \
    --cc=jarod@wilsonet.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lirc-list@lists.sourceforge.net \
    --cc=sean@mess.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;
as well as URLs for NNTP newsgroup(s).