linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Efremov <efremov@linux.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <jhogan@kernel.org>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: Add KSEG*ADDR definitions to CONFIG_64BIT
Date: Wed, 11 Dec 2019 13:27:37 +0300	[thread overview]
Message-ID: <132b4840-f499-01c2-dbb4-6bc9665c9335@linux.com> (raw)
In-Reply-To: <d709de95-c736-464d-9a92-e7b4df5df697@gmail.com>

On 12/11/19 2:04 AM, Florian Fainelli wrote:
> On 12/10/19 12:14 PM, Denis Efremov wrote:
>> Hi,
>>
>> On 10.12.2019 21:57, Paul Burton wrote:
>>> Hi Denis,
>>>
>>> On Tue, Dec 10, 2019 at 08:27:39PM +0300, Denis Efremov wrote:
>>>> The patch adds KSEG0ADDR, KSEG1ADDR, KSEG2ADDR, KSEG3ADDR
>>>> definitions to CONFIG_64BIT ifdef. This fixes broken compilation:
>>>>   CC      drivers/watchdog/mtx-1_wdt.o
>>>> In file included from drivers/watchdog/mtx-1_wdt.c:44:
>>>> ./arch/mips/include/asm/mach-au1x00/au1000.h: In function ‘alchemy_rdsys’:
>>>> ./arch/mips/include/asm/mach-au1x00/au1000.h:603:36: error: implicit
>>>>   declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’?
>>>>   [-Werror=implicit-function-declaration]
>>>
>>> Since this driver is meant to run on a system that only supports 32 bit
>>> kernels, I think it would be better to correct its dependencies in
>>> Kconfig like so:
>>>
>>> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
>>> index 58e7c100b6ad..509cbb6d2cea 100644
>>> --- a/drivers/watchdog/Kconfig
>>> +++ b/drivers/watchdog/Kconfig
>>> @@ -1648,7 +1648,7 @@ config JZ4740_WDT
>>>
>>>  config WDT_MTX1
>>>         tristate "MTX-1 Hardware Watchdog"
>>> -       depends on MIPS_MTX1 || (MIPS && COMPILE_TEST)
>>> +       depends on MIPS_MTX1 || (MIPS && 32BIT && COMPILE_TEST)
>>>         help
>>>           Hardware driver for the MTX-1 boards. This is a watchdog timer that
>>>           will reboot the machine after a 100 seconds timer expired.
>>>
>>> And mark this with the appropriate fixes tag:
>>>
>>>   Fixes: da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")
>>>
>>> What do you think?
>>>
>>> Alternatively the driver could just use the existing & equivalent
>>> CKSEG1ADDR() macro as the compiler suggested, but in that case it'd be
>>> good to check that's the only change needed to build cleanly with
>>> CONFIG_64BIT=y.
>>>
>>
>> Thank you for the suggestion. I will prepare V2 and fix the same way other
>> drivers that break the compilation with CONFIG_64BIT and missing KSEG1ADDR.
> 
> There is a much simpler solution actually:

Well, I think you know better how to fix this. I think it will be better if you
prepare the patch. Your solution seems more elegant, at least to me.

> 
> diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
> index 8aa1cb4a295f..ea1bbf5ee528 100644
> --- a/drivers/watchdog/mtx-1_wdt.c
> +++ b/drivers/watchdog/mtx-1_wdt.c
> @@ -41,8 +41,6 @@
>  #include <linux/uaccess.h>
>  #include <linux/gpio/consumer.h>
> 
> -#include <asm/mach-au1x00/au1000.h>
> -
>  #define MTX1_WDT_INTERVAL      (5 * HZ)
> 
>  static int ticks = 100 * HZ;
> 
> and then you can even push this further with:
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 1679e0dc869b..982897ff074e 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -1651,7 +1651,7 @@ config JZ4740_WDT
> 
>  config WDT_MTX1
>         tristate "MTX-1 Hardware Watchdog"
> -       depends on MIPS_MTX1 || (MIPS && COMPILE_TEST)
> +       depends on MIPS_MTX1 || COMPILE_TEST
>         help
>           Hardware driver for the MTX-1 boards. This is a watchdog timer
> that
>           will reboot the machine after a 100 seconds timer expired.
> 
> I checked both an alchemy, non-alchemy MIPS build as well as a x86_64
> build with the two patches applied.
> 
> In fact, this entire driver is just an older version of
> drivers/watchdog/gpio_wdt.c and should be converted to it, if only I had
> that box available.


Thanks,
Denis

      reply	other threads:[~2019-12-11 10:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 17:27 [PATCH] MIPS: Add KSEG*ADDR definitions to CONFIG_64BIT Denis Efremov
2019-12-10 18:57 ` Paul Burton
2019-12-10 20:14   ` Denis Efremov
2019-12-10 23:04     ` Florian Fainelli
2019-12-11 10:27       ` Denis Efremov [this message]

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=132b4840-f499-01c2-dbb4-6bc9665c9335@linux.com \
    --to=efremov@linux.com \
    --cc=f.fainelli@gmail.com \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.org \
    --cc=ralf@linux-mips.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).