lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 2 Dec 2013 15:53:33 +0200
From:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:	Sergei Ianovich <ynvich@...il.com>
Cc:	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	Russell King <linux@....linux.org.uk>,
	Eric Miao <eric.y.miao@...il.com>,
	Haojian Zhuang <haojian.zhuang@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.cz>, Arnd Bergmann <arnd@...db.de>,
	"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>
Subject: Re: [PATCH 05/11] serial: support for 16550 serial ports on LP-8x4x

Hi,

On Mon, Dec 02, 2013 at 03:46:22PM +0400, Sergei Ianovich wrote:
> On Mon, 2013-12-02 at 10:48 +0200, Heikki Krogerus wrote:
> > On Sun, Dec 01, 2013 at 10:26:18AM +0400, Sergei Ianovich wrote:
> > > +static int request_and_remap(int i)
> > > +{
> > > +	if (!request_mem_region(extra_mem[i], 1, "serial"))
> > > +		return -EBUSY;
> > > +
> > > +	lp8x4x_data[i].private_data = ioremap(extra_mem[i], 1);
> > > +	if (lp8x4x_data[i].private_data)
> > > +		return 0;
> > > +
> > > +	release_mem_region(extra_mem[i], 1);
> > > +	return -ENODEV;
> 
> > Instead of registering a platform device for serial8250 here, you need
> > to simply register a platform driver for something like lp8x4x_serial.
> > The platform code will to registers the platform devices for it. You
> > will use serial8250_register_8250_port() in your probe to register a
> > new port. Use 8250_em.c and 8250_dw.c under drivers/tty/serial/8250/
> > as an example.
> > 
> > You don't need to introduce plat_serial8250_port so you won't need
> > the QUIRK_PORT stuff. You deliver the iomem and the irq as normal
> > resources that the driver uses when you create the platform device.
> > That of course also means the driver does not need to care about the
> > instances. The platform code will generate a platform device for as
> > many ports you have and set to resources accordingly.
> 
> 8250_core.c doesn't use platform infrastructure to request and map IO
> memory. There will be a conflict (and an error in
> serial8250_request_std_resource()), if main IO memory is requested by
> the platform device, won't it?

You don't need to request the mem region in your probe driver.

You can still map it. You have the flag UPF_IOREMAP that you can use
to tell 8250_code.c to map the region. If you don't set the flag,
8250_core.c will in practice expect that port->membase is already set
by the probe driver.

Check 8250_dw.c. It does the mapping on it's own and simply doesn't
set the flag.

Br,

-- 
heikki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ