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]
Message-ID: <CAL_JsqLTArm1v8ka39_KLq2jMKkK2ZXQ6-an=JSWVgTK1LWmOg@mail.gmail.com>
Date:	Mon, 19 Jan 2015 08:11:20 -0600
From:	Rob Herring <robherring2@...il.com>
To:	Lyra Zhang <zhang.lyra@...il.com>
Cc:	Chunyan Zhang <chunyan.zhang@...eadtrum.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Mark Rutland <mark.rutland@....com>,
	Arnd Bergmann <arnd@...db.de>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
	Mark Brown <broonie@...nel.org>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Will Deacon <will.deacon@....com>,
	Catalin Marinas <catalin.marinas@....com>,
	Jiri Slaby <jslaby@...e.cz>,
	Jason Cooper <jason@...edaemon.net>,
	Heiko Stübner <heiko@...ech.de>,
	Florian Vaussard <florian.vaussard@...l.ch>,
	Andrew Lunn <andrew@...n.ch>,
	Robert Richter <rrichter@...ium.com>,
	Hayato Suzuki <hytszk@...il.com>,
	Grant Likely <grant.likely@...aro.org>,
	Antony Pavlov <antonynpavlov@...il.com>,
	Joel Schopp <Joel.Schopp@....com>,
	Suravee Suthikulanit <Suravee.Suthikulpanit@....com>,
	Shawn Guo <shawn.guo@...aro.org>, lea.yan@...aro.org,
	Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@...aro.org>,
	Lee Jones <lee.jones@...aro.org>,
	Orson Zhai <orsonzhai@...il.com>,
	"geng.ren@...eadtrum.com" <geng.ren@...eadtrum.com>,
	"zhizhou.zhang" <zhizhou.zhang@...eadtrum.com>,
	"lanqing.liu@...eadtrum.com" <lanqing.liu@...eadtrum.com>,
	Wei Qiao (乔伟) <wei.qiao@...eadtrum.com>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>
Subject: Re: [PATCH v5 5/5] tty/serial: Add Spreadtrum sc9836-uart driver support

On Mon, Jan 19, 2015 at 3:55 AM, Lyra Zhang <zhang.lyra@...il.com> wrote:
> On Sat, Jan 17, 2015 at 12:41 AM, Rob Herring <robherring2@...il.com> wrote:
>> On Fri, Jan 16, 2015 at 4:00 AM, Chunyan Zhang
>> <chunyan.zhang@...eadtrum.com> wrote:
>>> Add a full sc9836-uart driver for SC9836 SoC which is based on the
>>> spreadtrum sharkl64 platform.
>>> This driver also support earlycon.
>>> This patch also replaced the spaces between the macros and their
>>> values with the tabs in serial_core.h

[...]

>>> +static int __init sprd_serial_init(void)
>>> +{
>>> +       int ret = 0;
>>> +
>>> +       ret = uart_register_driver(&sprd_uart_driver);
>>
>> This can be done in probe now. Then you can use module_platform_driver().
>>
>
> Question:
> 1. there are 4 uart ports configured in dt for sprd_serial, so probe
> will be called 4 times, but uart_register_driver only needs to be
> called one time, so can we use uart_driver.state to check if
> uart_register_driver has already been called ?

Yes.

> 2. if I use module_platform_driver() instead of
> module_init(sprd_serial_init)  and  module_exit(sprd_serial_exit) , I
> must move uart_unregister_driver() which is now processed in
> sprd_serial_exit() to sprd_remove(), there is a similar problem with
> probe(), sprd_remove() will also be called 4 times, and actually it
> should be called only one time. How can we deal with this case?

Look at pl01x or Samsung UART drivers which have done this conversion.

> 3. for the second question, we can check the platform_device->id, if
> it is equal to the index of last port (e.g. 4 for this case), then
> uart_unregister_driver() can be called. Does it work correctly? since
> for this case, we must keep the order of releasing ports.

The id will not be the line index in the DT case. I don't think you
can guarantee the order either.

It would be better to make uart_{un}register_driver deal with being
called multiple times so drivers don't have to deal with getting this
correct. I'm not sure if that is feasible though.

Rob
--
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