* [PATCH net-next 6/8] net: dsa: Add support for platform data
From: Florian Fainelli @ 2017-01-10 22:15 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20170110212117.GO22820@lunn.ch>
On 01/10/2017 01:21 PM, Andrew Lunn wrote:
>> Last time we discussed this, I had a super complex dsa2_platform_data
>> that allowed you to do exactly the same thing we currently do with
>> Device Tree, except that this was with platform_data. It took a lot of
>> effort to get there, but I essentially had the ZII vf160 board example
>> re-implemented and verified with a mockup driver (still have it in a
>> branch that's not too far from net-next/master).
>
> One thing different this time is you have associated the platform data
> to an MDIO device. So the platform data represents one switch, not the
> whole complex. This is going to make the platform data much simpler,
> and allow the core to do the work of assembling the multiple platform
> datas into one switch complex. So basically, the platform data is
> dsa_chip_data.
>
> To handle multi-CPUs, we need to move the master ethernet device and
> put it next to the cpu port. So add a
>
> struct device *netdev[DSA_MAX_PORTS];
>
> to dsa_chip_data. It then becomes easy to represent multiple CPU
> ports.
Alright, let me get that prepared then, thanks!
>
>> I would very much like to see the patches and then make a decision based
>> on the submission rather than project a decision on code that has not
>> been submitted yet.
>
> The first version was posted a week ago. I requested a lot of
> changes. So lets see what John says about when the next version will
> be ready.
Oh that series, okay, somehow I thought you were referring to something
else.
--
Florian
^ permalink raw reply
* [PATCH v2 2/2] media: rc: add driver for IR remote receiver on MT7623 SoC
From: Andi Shyti @ 2017-01-10 22:45 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201701102015.fSM15CvI%fengguang.wu@intel.com>
Hi Sean,
> include/linux/compiler.h:253:8: sparse: attribute 'no_sanitize_address': unknown attribute
> >> drivers/media/rc/mtk-cir.c:215:41: sparse: too many arguments for function devm_rc_allocate_device
> drivers/media/rc/mtk-cir.c: In function 'mtk_ir_probe':
> drivers/media/rc/mtk-cir.c:215:11: error: too many arguments to function 'devm_rc_allocate_device'
> ir->rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
> ^~~~~~~~~~~~~~~~~~~~~~~
> In file included from drivers/media/rc/mtk-cir.c:22:0:
> include/media/rc-core.h:213:16: note: declared here
> struct rc_dev *devm_rc_allocate_device(struct device *dev);
> ^~~~~~~~~~~~~~~~~~~~~~~
>
> vim +/devm_rc_allocate_device +215 drivers/media/rc/mtk-cir.c
>
> 209 ir->base = devm_ioremap_resource(dev, res);
> 210 if (IS_ERR(ir->base)) {
> 211 dev_err(dev, "failed to map registers\n");
> 212 return PTR_ERR(ir->base);
> 213 }
> 214
> > 215 ir->rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
this error comes because the patches I pointed out have not been
applied yet. I guess you can ignore them as long as you tested
yours on top those patches.
Andi
^ permalink raw reply
* [PATCH] gpio: mvebu: fix warning when building on 64-bit
From: Russell King @ 2017-01-10 22:53 UTC (permalink / raw)
To: linux-arm-kernel
Casting a pointer to an int is not portable, and provokes a compiler
warning. Cast to unsigned long instead to avoid the warning.
drivers/gpio/gpio-mvebu.c: In function 'mvebu_gpio_probe':
drivers/gpio/gpio-mvebu.c:662:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
soc_variant = (int) match->data;
^
This will be needed when building gpio-mvebu for Armada 7k/8k ARM64
SoCs.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
Linus,
I don't think this is necessary to push into -rc, as its not yet used
on ARM64 - GPIO support is not yet present in the DTS files, and the
Kconfig doesn't allow the driver to be built on ARM64. Hence, please
queue for the next merge window as a low priority fix.
Thanks.
drivers/gpio/gpio-mvebu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 1ed6132b993c..a649556ac3ca 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -659,7 +659,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
match = of_match_device(mvebu_gpio_of_match, &pdev->dev);
if (match)
- soc_variant = (int) match->data;
+ soc_variant = (unsigned long) match->data;
else
soc_variant = MVEBU_GPIO_SOC_VARIANT_ORION;
--
2.7.4
^ permalink raw reply related
* [PATCH] usb: dwc3-exynos fix axius clock error path to do cleanup
From: Shuah Khan @ 2017-01-10 23:05 UTC (permalink / raw)
To: linux-arm-kernel
Axius clock error path returns without disabling clock and suspend clock.
Fix it to disable them before returning error.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
drivers/usb/dwc3/dwc3-exynos.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index 3e8407a..f7421c2 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -136,7 +136,8 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk");
if (IS_ERR(exynos->axius_clk)) {
dev_err(dev, "no AXI UpScaler clk specified\n");
- return -ENODEV;
+ ret = -ENODEV;
+ goto axius_clk_err;
}
clk_prepare_enable(exynos->axius_clk);
} else {
@@ -194,6 +195,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
regulator_disable(exynos->vdd33);
err2:
clk_disable_unprepare(exynos->axius_clk);
+axius_clk_err:
clk_disable_unprepare(exynos->susp_clk);
clk_disable_unprepare(exynos->clk);
return ret;
--
2.7.4
^ permalink raw reply related
* [PATCH] net: phy: marvell: fix Marvell 88E1512 used in SGMII mode
From: Russell King @ 2017-01-10 23:13 UTC (permalink / raw)
To: linux-arm-kernel
When an Marvell 88E1512 PHY is connected to a nic in SGMII mode, the
fiber page is used for the SGMII host-side connection. The PHY driver
notices that SUPPORTED_FIBRE is set, so it tries reading the fiber page
for the link status, and ends up reading the MAC-side status instead of
the outgoing (copper) link. This leads to incorrect results reported
via ethtool.
If the PHY is connected via SGMII to the host, ignore the fiber page.
However, continue to allow the existing power management code to
suspend and resume the fiber page.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/marvell.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 6ad76829c7cd..04e439ad5cff 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1190,7 +1190,8 @@ static int marvell_read_status(struct phy_device *phydev)
int err;
/* Check the fiber mode first */
- if (phydev->supported & SUPPORTED_FIBRE) {
+ if (phydev->supported & SUPPORTED_FIBRE &&
+ phydev->interface != PHY_INTERFACE_MODE_SGMII) {
err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_M1111_FIBER);
if (err < 0)
goto error;
--
2.7.4
^ permalink raw reply related
* [PATCH] net: phy: marvell: fix Marvell 88E1512 used in SGMII mode
From: Florian Fainelli @ 2017-01-10 23:24 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <E1cR5bt-0000O8-1T@rmk-PC.armlinux.org.uk>
On 01/10/2017 03:13 PM, Russell King wrote:
> When an Marvell 88E1512 PHY is connected to a nic in SGMII mode, the
> fiber page is used for the SGMII host-side connection. The PHY driver
> notices that SUPPORTED_FIBRE is set, so it tries reading the fiber page
> for the link status, and ends up reading the MAC-side status instead of
> the outgoing (copper) link. This leads to incorrect results reported
> via ethtool.
>
> If the PHY is connected via SGMII to the host, ignore the fiber page.
> However, continue to allow the existing power management code to
> suspend and resume the fiber page.
>
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Fixes: 6cfb3bcc0641 ("Marvell phy: check link status in case of fiber
link.")
--
Florian
^ permalink raw reply
* [PATCH v2 1/2] virtio_mmio: Set DMA masks appropriately
From: Michael S. Tsirkin @ 2017-01-10 23:30 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <85015f1653eb7e36f992708362b75d1f4391b783.1484070340.git.robin.murphy@arm.com>
On Tue, Jan 10, 2017 at 05:51:17PM +0000, Robin Murphy wrote:
> Once DMA API usage is enabled, it becomes apparent that virtio-mmio is
> inadvertently relying on the default 32-bit DMA mask, which leads to
> problems like rapidly exhausting SWIOTLB bounce buffers.
>
> Ensure that we set the appropriate 64-bit DMA mask whenever possible,
> with the coherent mask suitably limited for the legacy vring as per
> a0be1db4304f ("virtio_pci: Limit DMA mask to 44 bits for legacy virtio
> devices").
>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Reported-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> Fixes: b42111382f0e ("virtio_mmio: Use the DMA API if enabled")
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
I'mm merge this soon.
> ---
> drivers/virtio/virtio_mmio.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index d47a2fcef818..c71fde5fe835 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -59,6 +59,7 @@
> #define pr_fmt(fmt) "virtio-mmio: " fmt
>
> #include <linux/acpi.h>
> +#include <linux/dma-mapping.h>
> #include <linux/highmem.h>
> #include <linux/interrupt.h>
> #include <linux/io.h>
> @@ -498,6 +499,7 @@ static int virtio_mmio_probe(struct platform_device *pdev)
> struct virtio_mmio_device *vm_dev;
> struct resource *mem;
> unsigned long magic;
> + int rc;
>
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!mem)
> @@ -547,9 +549,25 @@ static int virtio_mmio_probe(struct platform_device *pdev)
> }
> vm_dev->vdev.id.vendor = readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID);
>
> - if (vm_dev->version == 1)
> + if (vm_dev->version == 1) {
> writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
>
> + rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
> + /*
> + * In the legacy case, ensure our coherently-allocated virtio
> + * ring will be at an address expressable as a 32-bit PFN.
> + */
> + if (!rc)
> + dma_set_coherent_mask(&pdev->dev,
> + DMA_BIT_MASK(32 + PAGE_SHIFT));
> + } else {
> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> + }
> + if (rc)
> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> + if (rc)
> + dev_warn(&pdev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n");
> +
> platform_set_drvdata(pdev, vm_dev);
>
> return register_virtio_device(&vm_dev->vdev);
> --
> 2.10.2.dirty
^ permalink raw reply
* [PATCH v2 2/2] vring: Force use of DMA API for ARM-based systems
From: Michael S. Tsirkin @ 2017-01-10 23:33 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <4833e705fb6841fbfdbee3b1a21a7bc917292410.1484070340.git.robin.murphy@arm.com>
On Tue, Jan 10, 2017 at 05:51:18PM +0000, Robin Murphy wrote:
> From: Will Deacon <will.deacon@arm.com>
>
> Booting Linux on an ARM fastmodel containing an SMMU emulation results
> in an unexpected I/O page fault from the legacy virtio-blk PCI device:
>
> [ 1.211721] arm-smmu-v3 2b400000.smmu: event 0x10 received:
> [ 1.211800] arm-smmu-v3 2b400000.smmu: 0x00000000fffff010
> [ 1.211880] arm-smmu-v3 2b400000.smmu: 0x0000020800000000
> [ 1.211959] arm-smmu-v3 2b400000.smmu: 0x00000008fa081002
> [ 1.212075] arm-smmu-v3 2b400000.smmu: 0x0000000000000000
> [ 1.212155] arm-smmu-v3 2b400000.smmu: event 0x10 received:
> [ 1.212234] arm-smmu-v3 2b400000.smmu: 0x00000000fffff010
> [ 1.212314] arm-smmu-v3 2b400000.smmu: 0x0000020800000000
> [ 1.212394] arm-smmu-v3 2b400000.smmu: 0x00000008fa081000
> [ 1.212471] arm-smmu-v3 2b400000.smmu: 0x0000000000000000
>
> <system hangs failing to read partition table>
>
> This is because the virtio-blk is behind an SMMU, so we have consequently
> swizzled its DMA ops and configured the SMMU to translate accesses. This
> then requires the vring code to use the DMA API to establish translations,
> otherwise all transactions will result in fatal faults and termination.
>
> Given that ARM-based systems only see an SMMU if one is really present
> (the topology is all described by firmware tables such as device-tree or
> IORT), then we can safely use the DMA API for all virtio devices.
>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
I'd like to better understand then need for this one.
Can't the device in question just set VIRTIO_F_IOMMU_PLATFORM ?
I'd rather we avoided need for more hacks and just
have everyone switch to that.
> ---
> drivers/virtio/virtio_ring.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 409aeaa49246..447245f2c813 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -159,6 +159,10 @@ static bool vring_use_dma_api(struct virtio_device *vdev)
> if (xen_domain())
> return true;
>
> + /* On ARM-based machines, the DMA ops will do the right thing */
> + if (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64))
> + return true;
> +
> return false;
> }
>
> --
> 2.10.2.dirty
^ permalink raw reply
* [PATCH 05/62] watchdog: bcm2835_wdt: Convert to use device managed functions and other improvements
From: Guenter Roeck @ 2017-01-10 23:34 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484091325-9199-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
Other improvements as listed below.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Drop assignments to otherwise unused variables
- Replace of_iomap() with platform_get_resource() followed by
devm_ioremap_resource()
- Replace &pdev->dev with dev if 'struct device *dev' is a declared
variable
- Use devm_watchdog_register_driver() to register watchdog device
- Replace shutdown function with call to watchdog_stop_on_reboot()
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list at broadcom.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/bcm2835_wdt.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
index 4e0adb6c88f0..496f6c106bb1 100644
--- a/drivers/watchdog/bcm2835_wdt.c
+++ b/drivers/watchdog/bcm2835_wdt.c
@@ -172,8 +172,8 @@ static void bcm2835_power_off(void)
static int bcm2835_wdt_probe(struct platform_device *pdev)
{
+ struct resource *res;
struct device *dev = &pdev->dev;
- struct device_node *np = dev->of_node;
struct bcm2835_wdt *wdt;
int err;
@@ -184,16 +184,15 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
spin_lock_init(&wdt->lock);
- wdt->base = of_iomap(np, 0);
- if (!wdt->base) {
- dev_err(dev, "Failed to remap watchdog regs");
- return -ENODEV;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ wdt->base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(wdt->base))
+ return PTR_ERR(wdt->base);
watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt);
watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
- bcm2835_wdt_wdd.parent = &pdev->dev;
+ bcm2835_wdt_wdd.parent = dev;
if (bcm2835_wdt_is_running(wdt)) {
/*
* The currently active timeout value (set by the
@@ -208,10 +207,10 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
watchdog_set_restart_priority(&bcm2835_wdt_wdd, 128);
- err = watchdog_register_device(&bcm2835_wdt_wdd);
+ watchdog_stop_on_reboot(&bcm2835_wdt_wdd);
+ err = devm_watchdog_register_device(dev, &bcm2835_wdt_wdd);
if (err) {
dev_err(dev, "Failed to register watchdog device");
- iounmap(wdt->base);
return err;
}
@@ -224,21 +223,12 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
static int bcm2835_wdt_remove(struct platform_device *pdev)
{
- struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
-
if (pm_power_off == bcm2835_power_off)
pm_power_off = NULL;
- watchdog_unregister_device(&bcm2835_wdt_wdd);
- iounmap(wdt->base);
return 0;
}
-static void bcm2835_wdt_shutdown(struct platform_device *pdev)
-{
- bcm2835_wdt_stop(&bcm2835_wdt_wdd);
-}
-
static const struct of_device_id bcm2835_wdt_of_match[] = {
{ .compatible = "brcm,bcm2835-pm-wdt", },
{},
@@ -248,7 +238,6 @@ MODULE_DEVICE_TABLE(of, bcm2835_wdt_of_match);
static struct platform_driver bcm2835_wdt_driver = {
.probe = bcm2835_wdt_probe,
.remove = bcm2835_wdt_remove,
- .shutdown = bcm2835_wdt_shutdown,
.driver = {
.name = "bcm2835-wdt",
.of_match_table = bcm2835_wdt_of_match,
--
2.7.4
^ permalink raw reply related
* [PATCH 10/62] watchdog: coh901327_wdt: Convert to use device managed functions
From: Guenter Roeck @ 2017-01-10 23:34 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484091325-9199-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Use devm_add_action_or_reset() for calls to clk_disable_unprepare
- Use devm_clk_get() if the device parameter is not NULL
- Replace 'goto l; ... l: return e;' with 'return e;'
- Replace 'val = e; return val;' with 'return e;'
- Replace 'if (e) { return expr; }' with 'if (e) return expr;'
- Replace request_irq, request_threaded_irq, and request_any_context_irq
with their device managed equivalent
- Replace &pdev->dev with dev if 'struct device *dev' is a declared
variable
- Use devm_watchdog_register_driver() to register watchdog device
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/coh901327_wdt.c | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c
index 38dd60f0cfcc..8b6f7f35c479 100644
--- a/drivers/watchdog/coh901327_wdt.c
+++ b/drivers/watchdog/coh901327_wdt.c
@@ -241,11 +241,7 @@ static struct watchdog_device coh901327_wdt = {
static int __exit coh901327_remove(struct platform_device *pdev)
{
- watchdog_unregister_device(&coh901327_wdt);
coh901327_disable();
- free_irq(irq, pdev);
- clk_disable_unprepare(clk);
- clk_put(clk);
return 0;
}
@@ -263,7 +259,7 @@ static int __init coh901327_probe(struct platform_device *pdev)
if (IS_ERR(virtbase))
return PTR_ERR(virtbase);
- clk = clk_get(dev, NULL);
+ clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
dev_err(dev, "could not get clock\n");
@@ -272,8 +268,13 @@ static int __init coh901327_probe(struct platform_device *pdev)
ret = clk_prepare_enable(clk);
if (ret) {
dev_err(dev, "could not prepare and enable clock\n");
- goto out_no_clk_enable;
+ return ret;
}
+ ret = devm_add_action_or_reset(dev,
+ (void(*)(void *))clk_disable_unprepare,
+ clk);
+ if (ret)
+ return ret;
val = readw(virtbase + U300_WDOG_SR);
switch (val) {
@@ -309,31 +310,21 @@ static int __init coh901327_probe(struct platform_device *pdev)
writew(U300_WDOG_SR_RESET_STATUS_RESET, virtbase + U300_WDOG_SR);
irq = platform_get_irq(pdev, 0);
- if (request_irq(irq, coh901327_interrupt, 0,
- DRV_NAME " Bark", pdev)) {
- ret = -EIO;
- goto out_no_irq;
- }
+ if (devm_request_irq(dev, irq, coh901327_interrupt, 0,
+ DRV_NAME " Bark", pdev))
+ return -EIO;
ret = watchdog_init_timeout(&coh901327_wdt, margin, dev);
if (ret < 0)
coh901327_wdt.timeout = 60;
coh901327_wdt.parent = dev;
- ret = watchdog_register_device(&coh901327_wdt);
+ ret = devm_watchdog_register_device(dev, &coh901327_wdt);
if (ret)
- goto out_no_wdog;
+ return ret;
dev_info(dev, "initialized. timer margin=%d sec\n", margin);
return 0;
-
-out_no_wdog:
- free_irq(irq, pdev);
-out_no_irq:
- clk_disable_unprepare(clk);
-out_no_clk_enable:
- clk_put(clk);
- return ret;
}
#ifdef CONFIG_PM
--
2.7.4
^ permalink raw reply related
* [PATCH 16/62] watchdog: digicolor_wdt: Convert to use device managed functions and other improvements
From: Guenter Roeck @ 2017-01-10 23:34 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484091325-9199-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
Other improvements as listed below.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Replace 'goto l; ... l: return e;' with 'return e;'
- Replace 'val = e; return val;' with 'return e;'
- Drop assignments to otherwise unused variables
- Replace 'if (e) { return expr; }' with 'if (e) return expr;'
- Drop remove function
- Replace of_iomap() with platform_get_resource() followed by
devm_ioremap_resource()
- Drop platform_set_drvdata()
- Replace &pdev->dev with dev if 'struct device *dev' is a declared
variable
- Use devm_watchdog_register_driver() to register watchdog device
- Replace shutdown function with call to watchdog_stop_on_reboot()
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/digicolor_wdt.c | 48 ++++++++++------------------------------
1 file changed, 12 insertions(+), 36 deletions(-)
diff --git a/drivers/watchdog/digicolor_wdt.c b/drivers/watchdog/digicolor_wdt.c
index dfe72944822d..870694d9ebc7 100644
--- a/drivers/watchdog/digicolor_wdt.c
+++ b/drivers/watchdog/digicolor_wdt.c
@@ -119,62 +119,40 @@ static struct watchdog_device dc_wdt_wdd = {
static int dc_wdt_probe(struct platform_device *pdev)
{
+ struct resource *res;
struct device *dev = &pdev->dev;
- struct device_node *np = dev->of_node;
struct dc_wdt *wdt;
int ret;
wdt = devm_kzalloc(dev, sizeof(struct dc_wdt), GFP_KERNEL);
if (!wdt)
return -ENOMEM;
- platform_set_drvdata(pdev, wdt);
- wdt->base = of_iomap(np, 0);
- if (!wdt->base) {
- dev_err(dev, "Failed to remap watchdog regs");
- return -ENODEV;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ wdt->base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(wdt->base))
+ return PTR_ERR(wdt->base);
- wdt->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(wdt->clk)) {
- ret = PTR_ERR(wdt->clk);
- goto err_iounmap;
- }
+ wdt->clk = devm_clk_get(dev, NULL);
+ if (IS_ERR(wdt->clk))
+ return PTR_ERR(wdt->clk);
dc_wdt_wdd.max_timeout = U32_MAX / clk_get_rate(wdt->clk);
dc_wdt_wdd.timeout = dc_wdt_wdd.max_timeout;
- dc_wdt_wdd.parent = &pdev->dev;
+ dc_wdt_wdd.parent = dev;
spin_lock_init(&wdt->lock);
watchdog_set_drvdata(&dc_wdt_wdd, wdt);
watchdog_set_restart_priority(&dc_wdt_wdd, 128);
watchdog_init_timeout(&dc_wdt_wdd, timeout, dev);
- ret = watchdog_register_device(&dc_wdt_wdd);
+ watchdog_stop_on_reboot(&dc_wdt_wdd);
+ ret = devm_watchdog_register_device(dev, &dc_wdt_wdd);
if (ret) {
dev_err(dev, "Failed to register watchdog device");
- goto err_iounmap;
+ return ret;
}
return 0;
-
-err_iounmap:
- iounmap(wdt->base);
- return ret;
-}
-
-static int dc_wdt_remove(struct platform_device *pdev)
-{
- struct dc_wdt *wdt = platform_get_drvdata(pdev);
-
- watchdog_unregister_device(&dc_wdt_wdd);
- iounmap(wdt->base);
-
- return 0;
-}
-
-static void dc_wdt_shutdown(struct platform_device *pdev)
-{
- dc_wdt_stop(&dc_wdt_wdd);
}
static const struct of_device_id dc_wdt_of_match[] = {
@@ -185,8 +163,6 @@ MODULE_DEVICE_TABLE(of, dc_wdt_of_match);
static struct platform_driver dc_wdt_driver = {
.probe = dc_wdt_probe,
- .remove = dc_wdt_remove,
- .shutdown = dc_wdt_shutdown,
.driver = {
.name = "digicolor-wdt",
.of_match_table = dc_wdt_of_match,
--
2.7.4
^ permalink raw reply related
* [PATCH 27/62] watchdog: lpc18xx_wdt: Convert to use device managed functions and other improvements
From: Guenter Roeck @ 2017-01-10 23:34 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484091325-9199-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
Other improvements as listed below.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Use devm_add_action_or_reset() for calls to clk_disable_unprepare
- Replace 'goto l; ... l: return e;' with 'return e;'
- Replace 'val = e; return val;' with 'return e;'
- Replace 'if (e) return e; return 0;' with 'return e;'
- Drop assignments to otherwise unused variables
- Drop remove function
- Drop platform_set_drvdata()
- Replace &pdev->dev with dev if 'struct device *dev' is a declared
variable
- Call del_timer() using devm_add_action()
- Use devm_watchdog_register_driver() to register watchdog device
- Replace shutdown function with call to watchdog_stop_on_reboot()
Cc: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/lpc18xx_wdt.c | 58 ++++++++++++++----------------------------
1 file changed, 19 insertions(+), 39 deletions(-)
diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c
index 3b8bb59adf02..554030628caa 100644
--- a/drivers/watchdog/lpc18xx_wdt.c
+++ b/drivers/watchdog/lpc18xx_wdt.c
@@ -231,19 +231,28 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
dev_err(dev, "could not prepare or enable sys clock\n");
return ret;
}
+ ret = devm_add_action_or_reset(dev,
+ (void(*)(void *))clk_disable_unprepare,
+ lpc18xx_wdt->reg_clk);
+ if (ret)
+ return ret;
ret = clk_prepare_enable(lpc18xx_wdt->wdt_clk);
if (ret) {
dev_err(dev, "could not prepare or enable wdt clock\n");
- goto disable_reg_clk;
+ return ret;
}
+ ret = devm_add_action_or_reset(dev,
+ (void(*)(void *))clk_disable_unprepare,
+ lpc18xx_wdt->wdt_clk);
+ if (ret)
+ return ret;
/* We use the clock rate to calculate timeouts */
lpc18xx_wdt->clk_rate = clk_get_rate(lpc18xx_wdt->wdt_clk);
if (lpc18xx_wdt->clk_rate == 0) {
dev_err(dev, "failed to get clock rate\n");
- ret = -EINVAL;
- goto disable_wdt_clk;
+ return -EINVAL;
}
lpc18xx_wdt->wdt_dev.info = &lpc18xx_wdt_info;
@@ -269,44 +278,17 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
setup_timer(&lpc18xx_wdt->timer, lpc18xx_wdt_timer_feed,
(unsigned long)&lpc18xx_wdt->wdt_dev);
+ ret = devm_add_action(dev, (void(*)(void *))del_timer,
+ &lpc18xx_wdt->timer);
+ if (ret)
+ return ret;
watchdog_set_nowayout(&lpc18xx_wdt->wdt_dev, nowayout);
watchdog_set_restart_priority(&lpc18xx_wdt->wdt_dev, 128);
- platform_set_drvdata(pdev, lpc18xx_wdt);
-
- ret = watchdog_register_device(&lpc18xx_wdt->wdt_dev);
- if (ret)
- goto disable_wdt_clk;
-
- return 0;
-
-disable_wdt_clk:
- clk_disable_unprepare(lpc18xx_wdt->wdt_clk);
-disable_reg_clk:
- clk_disable_unprepare(lpc18xx_wdt->reg_clk);
- return ret;
-}
-
-static void lpc18xx_wdt_shutdown(struct platform_device *pdev)
-{
- struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev);
-
- lpc18xx_wdt_stop(&lpc18xx_wdt->wdt_dev);
-}
-
-static int lpc18xx_wdt_remove(struct platform_device *pdev)
-{
- struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev);
-
- dev_warn(&pdev->dev, "I quit now, hardware will probably reboot!\n");
- del_timer(&lpc18xx_wdt->timer);
-
- watchdog_unregister_device(&lpc18xx_wdt->wdt_dev);
- clk_disable_unprepare(lpc18xx_wdt->wdt_clk);
- clk_disable_unprepare(lpc18xx_wdt->reg_clk);
-
- return 0;
+ watchdog_stop_on_reboot(&lpc18xx_wdt->wdt_dev);
+ return devm_watchdog_register_device(dev,
+ &lpc18xx_wdt->wdt_dev);
}
static const struct of_device_id lpc18xx_wdt_match[] = {
@@ -321,8 +303,6 @@ static struct platform_driver lpc18xx_wdt_driver = {
.of_match_table = lpc18xx_wdt_match,
},
.probe = lpc18xx_wdt_probe,
- .remove = lpc18xx_wdt_remove,
- .shutdown = lpc18xx_wdt_shutdown,
};
module_platform_driver(lpc18xx_wdt_driver);
--
2.7.4
^ permalink raw reply related
* [PATCHv3 3/8] rtc: add STM32 RTC driver
From: Alexandre Belloni @ 2017-01-11 0:08 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1483623809-29937-4-git-send-email-amelie.delaunay@st.com>
Looks good to me, however...
On 05/01/2017 at 14:43:24 +0100, Amelie Delaunay wrote :
> +struct stm32_rtc {
> + struct rtc_device *rtc_dev;
> + void __iomem *base;
> + struct clk *ck_rtc;
> + spinlock_t lock; /* Protects registers accesses */
This spinlock seems to be useless, the rtc ops_lock is already
protecting everywhere it is taken.
> + int irq_alarm;
> +};
> +
[...]
> +static int stm32_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
> +{
> + struct stm32_rtc *rtc = dev_get_drvdata(dev);
> + struct rtc_time *tm = &alrm->time;
> + unsigned long irqflags;
> + unsigned int cr, isr, alrmar;
> + int ret = 0;
> +
> + if (rtc_valid_tm(tm)) {
> + dev_err(dev, "Alarm time not valid.\n");
> + return -EINVAL;
This will never happen, tm is already checked multiple times (up to
three) in the core before this function can be called.
> + }
> +
You don't need to resend the whole series, just this patch. I'll take
2/8 and 3/8, the other ones can go through the stm32 tree.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply
* [PATCH] usb: dwc3-exynos remove suspend clock unspecified debug message
From: Javier Martinez Canillas @ 2017-01-11 0:18 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20170110212059.21995-1-shuahkh@osg.samsung.com>
Hello Shuah,
On 01/10/2017 06:20 PM, Shuah Khan wrote:
> dwc3-exynos prints debug message when suspend clock is not specified.
> The suspend clock is optional and driver can work without it.
>
> This debug message doesn't add any value and leads to confusion and
> concern. Remove it.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
> This patch is a result of the disussion on the following patch.
> https://lkml.org/lkml/2017/1/9/891
>
> drivers/usb/dwc3/dwc3-exynos.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
> index e27899b..3e8407a 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -128,10 +128,8 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
> clk_prepare_enable(exynos->clk);
>
> exynos->susp_clk = devm_clk_get(dev, "usbdrd30_susp_clk");
> - if (IS_ERR(exynos->susp_clk)) {
> - dev_info(dev, "no suspend clk specified\n");
Sorry for being late in the discussion, but what about making it a
dev_dbg() instead? That way the message may not confuse others but
still keep information that could be useful for debugging purposes.
I know the current message isn't great but keeping it as debug allows
to improve it later.
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
^ permalink raw reply
* [PATCH] usb: dwc3-exynos remove suspend clock unspecified debug message
From: Shuah Khan @ 2017-01-11 0:24 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <74dfb6fb-6ab0-135b-5d0a-60b69f35ff5a@osg.samsung.com>
On 01/10/2017 05:18 PM, Javier Martinez Canillas wrote:
> Hello Shuah,
>
> On 01/10/2017 06:20 PM, Shuah Khan wrote:
>> dwc3-exynos prints debug message when suspend clock is not specified.
>> The suspend clock is optional and driver can work without it.
>>
>> This debug message doesn't add any value and leads to confusion and
>> concern. Remove it.
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>> This patch is a result of the disussion on the following patch.
>> https://lkml.org/lkml/2017/1/9/891
>>
>> drivers/usb/dwc3/dwc3-exynos.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
>> index e27899b..3e8407a 100644
>> --- a/drivers/usb/dwc3/dwc3-exynos.c
>> +++ b/drivers/usb/dwc3/dwc3-exynos.c
>> @@ -128,10 +128,8 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
>> clk_prepare_enable(exynos->clk);
>>
>> exynos->susp_clk = devm_clk_get(dev, "usbdrd30_susp_clk");
>> - if (IS_ERR(exynos->susp_clk)) {
>> - dev_info(dev, "no suspend clk specified\n");
>
> Sorry for being late in the discussion, but what about making it a
> dev_dbg() instead? That way the message may not confuse others but
> still keep information that could be useful for debugging purposes.
>
> I know the current message isn't great but keeping it as debug allows
> to improve it later.
>
> Best regards,
>
I proposed dev debug and the recommendation from Krzysztof was to
just remove it. Please see response from Krzysztof's response.
thanks,
-- Shuah
^ permalink raw reply
* [PATCH] usb: dwc3-exynos fix axius clock error path to do cleanup
From: Javier Martinez Canillas @ 2017-01-11 0:27 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20170110230528.7612-1-shuahkh@osg.samsung.com>
Hello Shuah,
Patch looks good to me, I've just one comment.
On 01/10/2017 08:05 PM, Shuah Khan wrote:
> Axius clock error path returns without disabling clock and suspend clock.
> Fix it to disable them before returning error.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
> drivers/usb/dwc3/dwc3-exynos.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
> index 3e8407a..f7421c2 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -136,7 +136,8 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
> exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk");
> if (IS_ERR(exynos->axius_clk)) {
> dev_err(dev, "no AXI UpScaler clk specified\n");
> - return -ENODEV;
> + ret = -ENODEV;
> + goto axius_clk_err;
> }
> clk_prepare_enable(exynos->axius_clk);
> } else {
> @@ -194,6 +195,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
> regulator_disable(exynos->vdd33);
> err2:
> clk_disable_unprepare(exynos->axius_clk);
> +axius_clk_err:
This label isn't consistent with the others, I know the errN aren't great
so what about changing those to meaningful names in a preparatory patch?
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
^ permalink raw reply
* [PATCH] usb: dwc3-exynos fix axius clock error path to do cleanup
From: Shuah Khan @ 2017-01-11 0:30 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <e4f0b77a-d827-08fa-c4f6-950197c54358@osg.samsung.com>
On 01/10/2017 05:27 PM, Javier Martinez Canillas wrote:
> Hello Shuah,
>
> Patch looks good to me, I've just one comment.
>
> On 01/10/2017 08:05 PM, Shuah Khan wrote:
>> Axius clock error path returns without disabling clock and suspend clock.
>> Fix it to disable them before returning error.
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>> drivers/usb/dwc3/dwc3-exynos.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
>> index 3e8407a..f7421c2 100644
>> --- a/drivers/usb/dwc3/dwc3-exynos.c
>> +++ b/drivers/usb/dwc3/dwc3-exynos.c
>> @@ -136,7 +136,8 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
>> exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk");
>> if (IS_ERR(exynos->axius_clk)) {
>> dev_err(dev, "no AXI UpScaler clk specified\n");
>> - return -ENODEV;
>> + ret = -ENODEV;
>> + goto axius_clk_err;
>> }
>> clk_prepare_enable(exynos->axius_clk);
>> } else {
>> @@ -194,6 +195,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
>> regulator_disable(exynos->vdd33);
>> err2:
>> clk_disable_unprepare(exynos->axius_clk);
>> +axius_clk_err:
>
> This label isn't consistent with the others, I know the errN aren't great
> so what about changing those to meaningful names in a preparatory patch?
>
> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
>
> Best regards,
>
Javier,
Right they aren't consistent. Changing them all to a better naming scheme
will have be done in another cleanup patch in my opinion. I don't want to
include cleanup in this fix.
thanks,
-- Shuah
^ permalink raw reply
* [PATCH] usb: dwc3-exynos fix axius clock error path to do cleanup
From: Javier Martinez Canillas @ 2017-01-11 0:32 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <c1938cd9-9bcf-d28b-48fd-be6a22a1f3f7@osg.samsung.com>
Hello Shuah,
On 01/10/2017 09:30 PM, Shuah Khan wrote:
[snip]
>>> clk_disable_unprepare(exynos->axius_clk);
>>> +axius_clk_err:
>>
>> This label isn't consistent with the others, I know the errN aren't great
>> so what about changing those to meaningful names in a preparatory patch?
>>
>> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
>>
>> Best regards,
>>
>
> Javier,
>
> Right they aren't consistent. Changing them all to a better naming scheme
> will have be done in another cleanup patch in my opinion. I don't want to
> include cleanup in this fix.
>
I didn't mean to be done in the same patch, that's why I said in another
preparatory patch.
> thanks,
> -- Shuah
>
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
^ permalink raw reply
* imx: RS-485 problems during TX, maybe DMA related
From: Clemens Gruber @ 2017-01-11 0:33 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CAOMZO5AYha+SwS4761XxOnUtT1DYhHH69UpXmQzcmEdfC++JKQ@mail.gmail.com>
Hi Fabio,
On Sun, Jan 08, 2017 at 07:46:29PM -0200, Fabio Estevam wrote:
> > What's the revision of the i.MX6Q on your board? Mine is 1.5 (TO 1.3)
>
> Mine is a mx6solo rev1.1.
Could it be dependent upon SMP? Do you have an i.MX6Q board around to
try?
--
I made a few interesting discoveries in the meantime:
1) If I do not enable UCR4_TCEN, the data on TXD is fine. Of course the
TE pin does not toggle in that case, but it shows that the problem has
something to do with the actions taking place after the transmit
complete interrupt and not with the hardware or DMA internals.
2) I added a few custom printks when doing echo A > /dev/ttymxc4 in
RS-485 mode:
imx_start_tx
imx_dma_tx: tx_bytes=2, xmit->tail=0, xmit->head=2
imx_dma_tx: dma_tx_nents=1
imx-uart 21f4000.serial: TX: prepare to send 2 bytes by DMA
imx_transmit_buffer: xmit->tail set to 1, xmit->head=2
imx_transmit_buffer: xmit->tail set to 2, xmit->head=2
imx_stop_tx (returns immediately because dma_is_txing)
^ repeats multiple times
imx_stop_tx (goes through)
dma_tx_callback: xmit->tail=2 tx_bytes=2
dma_tx_callback: xmit->tail set to 4
imx-uart 21f4000.serial: we finish the TX DMA.
dma_tx_callback: xmit->tail=4 icount.tx=4
imx_dma_tx: tx_bytes=4094, xmit->tail=4, xmit->head=2 (!!)
imx_dma_tx: dma_tx_nents=2
..
That's why the data is garbled in that way: It wraps around the circular
buffer. xmit->tail jumps over xmit->head, which explains why I first see
the correct characters, then again followed by many zeros and at the end
again the correct characters.
Regards,
Clemens
^ permalink raw reply
* [PATCH] usb: dwc3-exynos fix axius clock error path to do cleanup
From: Shuah Khan @ 2017-01-11 0:38 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <006ab225-6e16-b1d7-567c-d1f236702589@osg.samsung.com>
On 01/10/2017 05:32 PM, Javier Martinez Canillas wrote:
> Hello Shuah,
>
> On 01/10/2017 09:30 PM, Shuah Khan wrote:
>
> [snip]
>
>>>> clk_disable_unprepare(exynos->axius_clk);
>>>> +axius_clk_err:
>>>
>>> This label isn't consistent with the others, I know the errN aren't great
>>> so what about changing those to meaningful names in a preparatory patch?
>>>
>>> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
>>>
>>> Best regards,
>>>
>>
>> Javier,
>>
>> Right they aren't consistent. Changing them all to a better naming scheme
>> will have be done in another cleanup patch in my opinion. I don't want to
>> include cleanup in this fix.
>>
>
> I didn't mean to be done in the same patch, that's why I said in another
> preparatory patch.
Yes. I can send the cleanup patch.
-- Shuah
^ permalink raw reply
* [PATCH 32/62] watchdog: meson_gxbb_wdt: Convert to use device managed functions and other improvements
From: Guenter Roeck @ 2017-01-11 0:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484095516-12720-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
Other improvements as listed below.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Use devm_add_action_or_reset() for calls to clk_disable_unprepare
- Check return value from clk_prepare_enable()
- Replace 'val = e; return val;' with 'return e;'
- Replace 'if (e) return e; return 0;' with 'return e;'
- Drop assignments to otherwise unused variables
- Replace 'if (e) { return expr; }' with 'if (e) return expr;'
- Drop remove function
- Use devm_watchdog_register_driver() to register watchdog device
- Replace shutdown function with call to watchdog_stop_on_reboot()
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/meson_gxbb_wdt.c | 38 ++++++++++----------------------------
1 file changed, 10 insertions(+), 28 deletions(-)
diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
index 45d47664a00a..913d8a644460 100644
--- a/drivers/watchdog/meson_gxbb_wdt.c
+++ b/drivers/watchdog/meson_gxbb_wdt.c
@@ -203,7 +203,14 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
if (IS_ERR(data->clk))
return PTR_ERR(data->clk);
- clk_prepare_enable(data->clk);
+ ret = clk_prepare_enable(data->clk);
+ if (ret)
+ return ret;
+ ret = devm_add_action_or_reset(&pdev->dev,
+ (void(*)(void *))clk_disable_unprepare,
+ data->clk);
+ if (ret)
+ return ret;
platform_set_drvdata(pdev, data);
@@ -224,37 +231,12 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
meson_gxbb_wdt_set_timeout(&data->wdt_dev, data->wdt_dev.timeout);
- ret = watchdog_register_device(&data->wdt_dev);
- if (ret) {
- clk_disable_unprepare(data->clk);
- return ret;
- }
-
- return 0;
-}
-
-static int meson_gxbb_wdt_remove(struct platform_device *pdev)
-{
- struct meson_gxbb_wdt *data = platform_get_drvdata(pdev);
-
- watchdog_unregister_device(&data->wdt_dev);
-
- clk_disable_unprepare(data->clk);
-
- return 0;
-}
-
-static void meson_gxbb_wdt_shutdown(struct platform_device *pdev)
-{
- struct meson_gxbb_wdt *data = platform_get_drvdata(pdev);
-
- meson_gxbb_wdt_stop(&data->wdt_dev);
+ watchdog_stop_on_reboot(&data->wdt_dev);
+ return devm_watchdog_register_device(&pdev->dev, &data->wdt_dev);
}
static struct platform_driver meson_gxbb_wdt_driver = {
.probe = meson_gxbb_wdt_probe,
- .remove = meson_gxbb_wdt_remove,
- .shutdown = meson_gxbb_wdt_shutdown,
.driver = {
.name = "meson-gxbb-wdt",
.pm = &meson_gxbb_wdt_pm_ops,
--
2.7.4
^ permalink raw reply related
* [PATCH 33/62] watchdog: meson_wdt: Convert to use device managed functions and other improvements
From: Guenter Roeck @ 2017-01-11 0:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484095516-12720-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
Other improvements as listed below.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Drop assignments to otherwise unused variables
- Drop remove function
- Drop platform_set_drvdata()
- Use devm_watchdog_register_driver() to register watchdog device
- Replace shutdown function with call to watchdog_stop_on_reboot()
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/meson_wdt.c | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/drivers/watchdog/meson_wdt.c b/drivers/watchdog/meson_wdt.c
index 56ea1caf71c3..491b9bf13d84 100644
--- a/drivers/watchdog/meson_wdt.c
+++ b/drivers/watchdog/meson_wdt.c
@@ -201,38 +201,19 @@ static int meson_wdt_probe(struct platform_device *pdev)
meson_wdt_stop(&meson_wdt->wdt_dev);
- err = watchdog_register_device(&meson_wdt->wdt_dev);
+ watchdog_stop_on_reboot(&meson_wdt->wdt_dev);
+ err = devm_watchdog_register_device(&pdev->dev, &meson_wdt->wdt_dev);
if (err)
return err;
- platform_set_drvdata(pdev, meson_wdt);
-
dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
meson_wdt->wdt_dev.timeout, nowayout);
return 0;
}
-static int meson_wdt_remove(struct platform_device *pdev)
-{
- struct meson_wdt_dev *meson_wdt = platform_get_drvdata(pdev);
-
- watchdog_unregister_device(&meson_wdt->wdt_dev);
-
- return 0;
-}
-
-static void meson_wdt_shutdown(struct platform_device *pdev)
-{
- struct meson_wdt_dev *meson_wdt = platform_get_drvdata(pdev);
-
- meson_wdt_stop(&meson_wdt->wdt_dev);
-}
-
static struct platform_driver meson_wdt_driver = {
.probe = meson_wdt_probe,
- .remove = meson_wdt_remove,
- .shutdown = meson_wdt_shutdown,
.driver = {
.name = DRV_NAME,
.of_match_table = meson_wdt_dt_ids,
--
2.7.4
^ permalink raw reply related
* [PATCH 37/62] watchdog: mtk_wdt: Convert to use device managed functions and other improvements
From: Guenter Roeck @ 2017-01-11 0:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484095516-12720-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
Other improvements as listed below.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Drop assignments to otherwise unused variables
- Drop remove function
- Use devm_watchdog_register_driver() to register watchdog device
- Replace shutdown function with call to watchdog_stop_on_reboot()
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/mtk_wdt.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 7ed417a765c7..db2e70ed368b 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -192,7 +192,8 @@ static int mtk_wdt_probe(struct platform_device *pdev)
mtk_wdt_stop(&mtk_wdt->wdt_dev);
- err = watchdog_register_device(&mtk_wdt->wdt_dev);
+ watchdog_stop_on_reboot(&mtk_wdt->wdt_dev);
+ err = devm_watchdog_register_device(&pdev->dev, &mtk_wdt->wdt_dev);
if (unlikely(err))
return err;
@@ -202,23 +203,6 @@ static int mtk_wdt_probe(struct platform_device *pdev)
return 0;
}
-static void mtk_wdt_shutdown(struct platform_device *pdev)
-{
- struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev);
-
- if (watchdog_active(&mtk_wdt->wdt_dev))
- mtk_wdt_stop(&mtk_wdt->wdt_dev);
-}
-
-static int mtk_wdt_remove(struct platform_device *pdev)
-{
- struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev);
-
- watchdog_unregister_device(&mtk_wdt->wdt_dev);
-
- return 0;
-}
-
#ifdef CONFIG_PM_SLEEP
static int mtk_wdt_suspend(struct device *dev)
{
@@ -256,8 +240,6 @@ static const struct dev_pm_ops mtk_wdt_pm_ops = {
static struct platform_driver mtk_wdt_driver = {
.probe = mtk_wdt_probe,
- .remove = mtk_wdt_remove,
- .shutdown = mtk_wdt_shutdown,
.driver = {
.name = DRV_NAME,
.pm = &mtk_wdt_pm_ops,
--
2.7.4
^ permalink raw reply related
* [PATCH 39/62] watchdog: of_xilinx_wdt: Convert to use device managed functions
From: Guenter Roeck @ 2017-01-11 0:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484095516-12720-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Use devm_add_action_or_reset() for calls to clk_disable_unprepare
- Replace 'goto l; ... l: return e;' with 'return e;'
- Drop assignments to otherwise unused variables
- Drop remove function
- Drop platform_set_drvdata()
- Use devm_watchdog_register_driver() to register watchdog device
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: "S?ren Brinkmann" <soren.brinkmann@xilinx.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/of_xilinx_wdt.c | 28 ++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)
diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index fae7fe929ea3..277de711c31f 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -210,38 +210,27 @@ static int xwdt_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "unable to enable clock\n");
return rc;
}
+ rc = devm_add_action_or_reset(&pdev->dev,
+ (void(*)(void *))clk_disable_unprepare,
+ xdev->clk);
+ if (rc)
+ return rc;
rc = xwdt_selftest(xdev);
if (rc == XWT_TIMER_FAILED) {
dev_err(&pdev->dev, "SelfTest routine error\n");
- goto err_clk_disable;
+ return rc;
}
- rc = watchdog_register_device(xilinx_wdt_wdd);
+ rc = devm_watchdog_register_device(&pdev->dev, xilinx_wdt_wdd);
if (rc) {
dev_err(&pdev->dev, "Cannot register watchdog (err=%d)\n", rc);
- goto err_clk_disable;
+ return rc;
}
dev_info(&pdev->dev, "Xilinx Watchdog Timer at %p with timeout %ds\n",
xdev->base, xilinx_wdt_wdd->timeout);
- platform_set_drvdata(pdev, xdev);
-
- return 0;
-err_clk_disable:
- clk_disable_unprepare(xdev->clk);
-
- return rc;
-}
-
-static int xwdt_remove(struct platform_device *pdev)
-{
- struct xwdt_device *xdev = platform_get_drvdata(pdev);
-
- watchdog_unregister_device(&xdev->xilinx_wdt_wdd);
- clk_disable_unprepare(xdev->clk);
-
return 0;
}
@@ -255,7 +244,6 @@ MODULE_DEVICE_TABLE(of, xwdt_of_match);
static struct platform_driver xwdt_driver = {
.probe = xwdt_probe,
- .remove = xwdt_remove,
.driver = {
.name = WATCHDOG_NAME,
.of_match_table = xwdt_of_match,
--
2.7.4
^ permalink raw reply related
* [PATCH 44/62] watchdog: pnx4008_wdt: Convert to use device managed functions
From: Guenter Roeck @ 2017-01-11 0:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1484095516-12720-1-git-send-email-linux@roeck-us.net>
Use device managed functions to simplify error handling, reduce
source code size, improve readability, and reduce the likelyhood of bugs.
The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts used
to generate this commit log are available at
https://github.com/groeck/coccinelle-patches
- Use devm_add_action_or_reset() for calls to clk_disable_unprepare
- Replace 'goto l; ... l: return e;' with 'return e;'
- Drop remove function
- Use devm_watchdog_register_driver() to register watchdog device
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/watchdog/pnx4008_wdt.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 0529aed158a4..a0cda8748c9b 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -202,6 +202,11 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
ret = clk_prepare_enable(wdt_clk);
if (ret)
return ret;
+ ret = devm_add_action_or_reset(&pdev->dev,
+ (void(*)(void *))clk_disable_unprepare,
+ wdt_clk);
+ if (ret)
+ return ret;
pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ?
WDIOF_CARDRESET : 0;
@@ -211,28 +216,15 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
pnx4008_wdt_stop(&pnx4008_wdd); /* disable for now */
- ret = watchdog_register_device(&pnx4008_wdd);
+ ret = devm_watchdog_register_device(&pdev->dev, &pnx4008_wdd);
if (ret < 0) {
dev_err(&pdev->dev, "cannot register watchdog device\n");
- goto disable_clk;
+ return ret;
}
dev_info(&pdev->dev, "heartbeat %d sec\n", pnx4008_wdd.timeout);
return 0;
-
-disable_clk:
- clk_disable_unprepare(wdt_clk);
- return ret;
-}
-
-static int pnx4008_wdt_remove(struct platform_device *pdev)
-{
- watchdog_unregister_device(&pnx4008_wdd);
-
- clk_disable_unprepare(wdt_clk);
-
- return 0;
}
#ifdef CONFIG_OF
@@ -249,7 +241,6 @@ static struct platform_driver platform_wdt_driver = {
.of_match_table = of_match_ptr(pnx4008_wdt_match),
},
.probe = pnx4008_wdt_probe,
- .remove = pnx4008_wdt_remove,
};
module_platform_driver(platform_wdt_driver);
--
2.7.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox