diff mbox

[2/6,v2] ARM: integrator: check PL010 device name rather than base address

Message ID 1346471760-23993-2-git-send-email-linus.walleij@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Linus Walleij Sept. 1, 2012, 3:55 a.m. UTC
In the PL010 UART callback a comparison against the base address is
done to figure out which UART is doing the callback. This does not
play well with device tree, so let's check the dev_name() of the
device instead.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-integrator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnd Bergmann Sept. 1, 2012, 6:32 p.m. UTC | #1
On Saturday 01 September 2012, Linus Walleij wrote:
> In the PL010 UART callback a comparison against the base address is
> done to figure out which UART is doing the callback. This does not
> play well with device tree, so let's check the dev_name() of the
> device instead.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Hmm, I think the dev_name would also not be that nice, because it changes
after the conversion to DT is complete.

>  arch/arm/mach-integrator/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
> index 5ba4bc8..67ea181 100644
> --- a/arch/arm/mach-integrator/core.c
> +++ b/arch/arm/mach-integrator/core.c
> @@ -100,7 +100,7 @@ static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *bas
>  {
>         unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
>  
> -       if (dev == &uart0_device) {
> +       if (!strcmp(dev_name(&dev->dev), "uart0")) {
>                 rts_mask = 1 << 4;
>                 dtr_mask = 1 << 5;
>         } else {

Maybe it's possible to compare the base pointer against INTEGRATOR_UART0_BASE instead?

	Arnd
Linus Walleij Sept. 3, 2012, 7:40 p.m. UTC | #2
On Sat, Sep 1, 2012 at 8:32 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 01 September 2012, Linus Walleij wrote:
>> In the PL010 UART callback a comparison against the base address is
>> done to figure out which UART is doing the callback. This does not
>> play well with device tree, so let's check the dev_name() of the
>> device instead.
>>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> Hmm, I think the dev_name would also not be that nice, because it changes
> after the conversion to DT is complete.

Hmmmm yeah. I do tie down the name to "uart0" using auxdata.

(...)
>> +++ b/arch/arm/mach-integrator/core.c
>> @@ -100,7 +100,7 @@ static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *bas
>>  {
>>         unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
>>
>> -       if (dev == &uart0_device) {
>> +       if (!strcmp(dev_name(&dev->dev), "uart0")) {
>>                 rts_mask = 1 << 4;
>>                 dtr_mask = 1 << 5;
>>         } else {
>
> Maybe it's possible to compare the base pointer against INTEGRATOR_UART0_BASE instead?

Nope, that is an ioremapped() base, I have no clue what it may be.

Yours,
Linus Walleij
Linus Walleij Sept. 3, 2012, 7:51 p.m. UTC | #3
On Mon, Sep 3, 2012 at 9:40 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sat, Sep 1, 2012 at 8:32 PM, Arnd Bergmann <arnd@arndb.de> wrote:

>> On Saturday 01 September 2012, Linus Walleij wrote:
>>> -       if (dev == &uart0_device) {
>>> +       if (!strcmp(dev_name(&dev->dev), "uart0")) {
>>>                 rts_mask = 1 << 4;
>>>                 dtr_mask = 1 << 5;
>>>         } else {
>>
>> Maybe it's possible to compare the base pointer against INTEGRATOR_UART0_BASE instead?
>
> Nope, that is an ioremapped() base, I have no clue what it may be.

But hey I have the struct amba_device there, so the mem resource is there
indeed :-) I'll fix!

Yours,
Linus Walleij
diff mbox

Patch

diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 5ba4bc8..67ea181 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -100,7 +100,7 @@  static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *bas
 {
 	unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
 
-	if (dev == &uart0_device) {
+	if (!strcmp(dev_name(&dev->dev), "uart0")) {
 		rts_mask = 1 << 4;
 		dtr_mask = 1 << 5;
 	} else {