Give read access to module parameters to all and write access to root.
This change also improves driver error path testing.
Signed-off-by: Michal Simek <[email protected]>
---
Please let me know what you think - I can use macros from stat.h if
required
---
drivers/watchdog/cadence_wdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
index 05c000081e9d..dadd3b0c2d49 100644
--- a/drivers/watchdog/cadence_wdt.c
+++ b/drivers/watchdog/cadence_wdt.c
@@ -52,12 +52,12 @@
static int wdt_timeout;
static int nowayout = WATCHDOG_NOWAYOUT;
-module_param(wdt_timeout, int, 0);
+module_param(wdt_timeout, int, 0644);
MODULE_PARM_DESC(wdt_timeout,
"Watchdog time in seconds. (default="
__MODULE_STRING(CDNS_WDT_DEFAULT_TIMEOUT) ")");
-module_param(nowayout, int, 0);
+module_param(nowayout, int, 0644);
MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
--
1.9.1
Showing message that driver is loaded is common across drivers.
This change also fixes checkpatch (--strict) warning
"Alignment should match open parenthesis".
Signed-off-by: Michal Simek <[email protected]>
---
drivers/watchdog/cadence_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
index dadd3b0c2d49..064cf7b6c1c5 100644
--- a/drivers/watchdog/cadence_wdt.c
+++ b/drivers/watchdog/cadence_wdt.c
@@ -368,7 +368,7 @@ static int cdns_wdt_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, wdt);
- dev_dbg(&pdev->dev, "Xilinx Watchdog Timer at %p with timeout %ds%s\n",
+ dev_info(&pdev->dev, "Xilinx Watchdog Timer at %p with timeout %ds%s\n",
wdt->regs, cdns_wdt_device->timeout,
nowayout ? ", nowayout" : "");
--
1.9.1
On 08/04/2017 12:39 AM, Michal Simek wrote:
> Give read access to module parameters to all and write access to root.
> This change also improves driver error path testing.
>
> Signed-off-by: Michal Simek <[email protected]>
> ---
>
> Please let me know what you think - I can use macros from stat.h if
> required
>
Seems to be quite pointless and misleading, since the values are only read
at probe time. Am I missing something ?
Guenter
> ---
> drivers/watchdog/cadence_wdt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
> index 05c000081e9d..dadd3b0c2d49 100644
> --- a/drivers/watchdog/cadence_wdt.c
> +++ b/drivers/watchdog/cadence_wdt.c
> @@ -52,12 +52,12 @@
> static int wdt_timeout;
> static int nowayout = WATCHDOG_NOWAYOUT;
>
> -module_param(wdt_timeout, int, 0);
> +module_param(wdt_timeout, int, 0644);
> MODULE_PARM_DESC(wdt_timeout,
> "Watchdog time in seconds. (default="
> __MODULE_STRING(CDNS_WDT_DEFAULT_TIMEOUT) ")");
>
> -module_param(nowayout, int, 0);
> +module_param(nowayout, int, 0644);
> MODULE_PARM_DESC(nowayout,
> "Watchdog cannot be stopped once started (default="
> __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>
On 08/04/2017 12:39 AM, Michal Simek wrote:
> Showing message that driver is loaded is common across drivers.
Across watchdog drivers, which I am always half-annoyed about.
Is this really valuable ?
Guenter
> This change also fixes checkpatch (--strict) warning
> "Alignment should match open parenthesis".
> > Signed-off-by: Michal Simek <[email protected]>
> ---
>
> drivers/watchdog/cadence_wdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
> index dadd3b0c2d49..064cf7b6c1c5 100644
> --- a/drivers/watchdog/cadence_wdt.c
> +++ b/drivers/watchdog/cadence_wdt.c
> @@ -368,7 +368,7 @@ static int cdns_wdt_probe(struct platform_device *pdev)
> }
> platform_set_drvdata(pdev, wdt);
>
> - dev_dbg(&pdev->dev, "Xilinx Watchdog Timer at %p with timeout %ds%s\n",
> + dev_info(&pdev->dev, "Xilinx Watchdog Timer at %p with timeout %ds%s\n",
> wdt->regs, cdns_wdt_device->timeout,
> nowayout ? ", nowayout" : "");
>
>
On 4.8.2017 15:45, Guenter Roeck wrote:
> On 08/04/2017 12:39 AM, Michal Simek wrote:
>> Give read access to module parameters to all and write access to root.
>> This change also improves driver error path testing.
>>
>> Signed-off-by: Michal Simek <[email protected]>
>> ---
>>
>> Please let me know what you think - I can use macros from stat.h if
>> required
>>
>
> Seems to be quite pointless and misleading, since the values are only read
> at probe time. Am I missing something ?
You can unbind device and bind that device again. If you want to use it
or test with different parameters you need to have an access to these
module parameters.
For testing purpose if you setup for example timeout to 1000s which is
more than CDNS_WDT_MAX_TIMEOUT probe will fail and you have better
driver coverage.
I see that a lot of watchdog drivers are using 0 there - means no sysfs
access to these modules parameters. Some of them are using 0644 or 0444
that's why I want to know if there is any for example security reason to
disable access to these parameters.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: http://www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs
On 4.8.2017 15:47, Guenter Roeck wrote:
> On 08/04/2017 12:39 AM, Michal Simek wrote:
>> Showing message that driver is loaded is common across drivers.
>
> Across watchdog drivers, which I am always half-annoyed about.
> Is this really valuable ?
I don't think that this is debug message. We don't have hundreds of
drivers that log explodes and for systems, which I don't know, I do
normally check dmesg logs and I would expect this message to be there to
know that watchdog is enabled.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: http://www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs
On Fri, Aug 04, 2017 at 09:39:16AM +0200, Michal Simek wrote:
> Give read access to module parameters to all and write access to root.
> This change also improves driver error path testing.
>
> Signed-off-by: Michal Simek <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
> ---
>
> Please let me know what you think - I can use macros from stat.h if
> required
>
You mean instead of 0644 ? That is discouraged nowadays.
Guenter
> ---
> drivers/watchdog/cadence_wdt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
> index 05c000081e9d..dadd3b0c2d49 100644
> --- a/drivers/watchdog/cadence_wdt.c
> +++ b/drivers/watchdog/cadence_wdt.c
> @@ -52,12 +52,12 @@
> static int wdt_timeout;
> static int nowayout = WATCHDOG_NOWAYOUT;
>
> -module_param(wdt_timeout, int, 0);
> +module_param(wdt_timeout, int, 0644);
> MODULE_PARM_DESC(wdt_timeout,
> "Watchdog time in seconds. (default="
> __MODULE_STRING(CDNS_WDT_DEFAULT_TIMEOUT) ")");
>
> -module_param(nowayout, int, 0);
> +module_param(nowayout, int, 0644);
> MODULE_PARM_DESC(nowayout,
> "Watchdog cannot be stopped once started (default="
> __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
> --
> 1.9.1
>
On Fri, Aug 04, 2017 at 09:39:17AM +0200, Michal Simek wrote:
> Showing message that driver is loaded is common across drivers.
> This change also fixes checkpatch (--strict) warning
> "Alignment should match open parenthesis".
>
> Signed-off-by: Michal Simek <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
> ---
>
> drivers/watchdog/cadence_wdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
> index dadd3b0c2d49..064cf7b6c1c5 100644
> --- a/drivers/watchdog/cadence_wdt.c
> +++ b/drivers/watchdog/cadence_wdt.c
> @@ -368,7 +368,7 @@ static int cdns_wdt_probe(struct platform_device *pdev)
> }
> platform_set_drvdata(pdev, wdt);
>
> - dev_dbg(&pdev->dev, "Xilinx Watchdog Timer at %p with timeout %ds%s\n",
> + dev_info(&pdev->dev, "Xilinx Watchdog Timer at %p with timeout %ds%s\n",
> wdt->regs, cdns_wdt_device->timeout,
> nowayout ? ", nowayout" : "");
>
> --
> 1.9.1
>
On 14.8.2017 16:47, Guenter Roeck wrote:
> On Fri, Aug 04, 2017 at 09:39:16AM +0200, Michal Simek wrote:
>> Give read access to module parameters to all and write access to root.
>> This change also improves driver error path testing.
>>
>> Signed-off-by: Michal Simek <[email protected]>
>
> Reviewed-by: Guenter Roeck <[email protected]>
>
>> ---
>>
>> Please let me know what you think - I can use macros from stat.h if
>> required
>>
> You mean instead of 0644 ? That is discouraged nowadays.
yep and good.
Thanks,
Michal