Skip to content

Commit

Permalink
Merge branch 'for-davem' of git://gitorious.org/linux-can/linux-can-next
Browse files Browse the repository at this point in the history
Marc Kleine-Budde says:

====================
this is a pull-request for net-next/master. It consists of two patches
by Fabio Estevam, cleaning up the flexcan driver (remove default
pinctrl and switch to SIMPLE_DEV_PM_OPS). A patch by me to simplify the
Kconfig [1] handling for flexcan. And a patch by Jingoo Han that
converts the can drivers to use platform_{get,set}_drvdata().

[1] My patch touches arch/{arm,powerpc}, so I collected Acked-bys from
Arnd Bergmann, Shawn Guo and Benjamin Herrenschmidt.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 5, 2013
2 parents 600fed5 + 00e4bbc commit 6f45eba
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 58 deletions.
4 changes: 0 additions & 4 deletions arch/arm/mach-imx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ config SOC_IMX25
select ARCH_MXC_IOMUX_V3
select COMMON_CLK
select CPU_ARM926T
select HAVE_CAN_FLEXCAN if CAN
select MXC_AVIC

config SOC_IMX27
Expand All @@ -137,7 +136,6 @@ config SOC_IMX35
select ARCH_MXC_IOMUX_V3
select COMMON_CLK
select CPU_V6K
select HAVE_CAN_FLEXCAN if CAN
select HAVE_EPIT
select MXC_AVIC
select SMP_ON_UP if SMP
Expand Down Expand Up @@ -776,7 +774,6 @@ comment "Device tree only"

config SOC_IMX53
bool "i.MX53 support"
select HAVE_CAN_FLEXCAN if CAN
select HAVE_IMX_SRC
select IMX_HAVE_PLATFORM_IMX2_WDT
select PINCTRL
Expand All @@ -799,7 +796,6 @@ config SOC_IMX6Q
select CPU_V7
select HAVE_ARM_SCU if SMP
select HAVE_ARM_TWD if LOCAL_TIMERS
select HAVE_CAN_FLEXCAN if CAN
select HAVE_IMX_ANATOP
select HAVE_IMX_GPC
select HAVE_IMX_MMDC
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-imx/devices/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ config IMX_HAVE_PLATFORM_FEC

config IMX_HAVE_PLATFORM_FLEXCAN
bool
select HAVE_CAN_FLEXCAN if CAN

config IMX_HAVE_PLATFORM_FSL_USB2_UDC
bool
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-mxs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ config SOC_IMX28
select ARM_AMBA
select ARM_CPU_SUSPEND if PM
select CPU_ARM926T
select HAVE_CAN_FLEXCAN if CAN
select HAVE_PWM
select PINCTRL_IMX28

Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@ config SBUS

config FSL_SOC
bool
select HAVE_CAN_FLEXCAN if NET && CAN

config FSL_PCI
bool
Expand Down
5 changes: 1 addition & 4 deletions drivers/net/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,9 @@ config CAN_JANZ_ICAN3
This driver can also be built as a module. If so, the module will be
called janz-ican3.ko.

config HAVE_CAN_FLEXCAN
bool

config CAN_FLEXCAN
tristate "Support for Freescale FLEXCAN based chips"
depends on HAVE_CAN_FLEXCAN
depends on ARM || PPC
---help---
Say Y here if you want to support for Freescale FlexCAN.

Expand Down
10 changes: 4 additions & 6 deletions drivers/net/can/bfin_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ static int bfin_can_probe(struct platform_device *pdev)
priv->pin_list = pdata;
priv->can.clock.freq = get_sclk();

dev_set_drvdata(&pdev->dev, dev);
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);

dev->flags |= IFF_ECHO; /* we support local echo */
Expand Down Expand Up @@ -613,16 +613,14 @@ static int bfin_can_probe(struct platform_device *pdev)

static int bfin_can_remove(struct platform_device *pdev)
{
struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct net_device *dev = platform_get_drvdata(pdev);
struct bfin_can_priv *priv = netdev_priv(dev);
struct resource *res;

bfin_can_set_reset_mode(dev);

unregister_candev(dev);

dev_set_drvdata(&pdev->dev, NULL);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, resource_size(res));

Expand All @@ -635,7 +633,7 @@ static int bfin_can_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
{
struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct net_device *dev = platform_get_drvdata(pdev);
struct bfin_can_priv *priv = netdev_priv(dev);
struct bfin_can_regs __iomem *reg = priv->membase;
int timeout = BFIN_CAN_TIMEOUT;
Expand All @@ -658,7 +656,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)

static int bfin_can_resume(struct platform_device *pdev)
{
struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct net_device *dev = platform_get_drvdata(pdev);
struct bfin_can_priv *priv = netdev_priv(dev);
struct bfin_can_regs __iomem *reg = priv->membase;

Expand Down
5 changes: 2 additions & 3 deletions drivers/net/can/cc770/cc770_isa.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static int cc770_isa_probe(struct platform_device *pdev)
else
priv->clkout = COR_DEFAULT;

dev_set_drvdata(&pdev->dev, dev);
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);

err = register_cc770dev(dev);
Expand Down Expand Up @@ -293,12 +293,11 @@ static int cc770_isa_probe(struct platform_device *pdev)

static int cc770_isa_remove(struct platform_device *pdev)
{
struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct net_device *dev = platform_get_drvdata(pdev);
struct cc770_priv *priv = netdev_priv(dev);
int idx = pdev->id;

unregister_cc770dev(dev);
dev_set_drvdata(&pdev->dev, NULL);

if (mem[idx]) {
iounmap(priv->reg_base);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/can/cc770/cc770_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static int cc770_platform_probe(struct platform_device *pdev)
priv->reg_base, dev->irq, priv->can.clock.freq,
priv->cpu_interface, priv->bus_config, priv->clkout);

dev_set_drvdata(&pdev->dev, dev);
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);

err = register_cc770dev(dev);
Expand All @@ -240,7 +240,7 @@ static int cc770_platform_probe(struct platform_device *pdev)

static int cc770_platform_remove(struct platform_device *pdev)
{
struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct net_device *dev = platform_get_drvdata(pdev);
struct cc770_priv *priv = netdev_priv(dev);
struct resource *mem;

Expand Down
26 changes: 9 additions & 17 deletions drivers/net/can/flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/consumer.h>

#define DRV_NAME "flexcan"

Expand Down Expand Up @@ -1004,16 +1003,11 @@ static int flexcan_probe(struct platform_device *pdev)
struct flexcan_priv *priv;
struct resource *mem;
struct clk *clk_ipg = NULL, *clk_per = NULL;
struct pinctrl *pinctrl;
void __iomem *base;
resource_size_t mem_size;
int err, irq;
u32 clock_freq = 0;

pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
if (IS_ERR(pinctrl))
return PTR_ERR(pinctrl);

if (pdev->dev.of_node)
of_property_read_u32(pdev->dev.of_node,
"clock-frequency", &clock_freq);
Expand Down Expand Up @@ -1137,10 +1131,10 @@ static int flexcan_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM
static int flexcan_suspend(struct platform_device *pdev, pm_message_t state)
#ifdef CONFIG_PM_SLEEP
static int flexcan_suspend(struct device *device)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct net_device *dev = dev_get_drvdata(device);
struct flexcan_priv *priv = netdev_priv(dev);

flexcan_chip_disable(priv);
Expand All @@ -1154,9 +1148,9 @@ static int flexcan_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}

static int flexcan_resume(struct platform_device *pdev)
static int flexcan_resume(struct device *device)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct net_device *dev = dev_get_drvdata(device);
struct flexcan_priv *priv = netdev_priv(dev);

priv->can.state = CAN_STATE_ERROR_ACTIVE;
Expand All @@ -1168,21 +1162,19 @@ static int flexcan_resume(struct platform_device *pdev)

return 0;
}
#else
#define flexcan_suspend NULL
#define flexcan_resume NULL
#endif
#endif /* CONFIG_PM_SLEEP */

static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume);

static struct platform_driver flexcan_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
.pm = &flexcan_pm_ops,
.of_match_table = flexcan_of_match,
},
.probe = flexcan_probe,
.remove = flexcan_remove,
.suspend = flexcan_suspend,
.resume = flexcan_resume,
.id_table = flexcan_id_table,
};

Expand Down
5 changes: 2 additions & 3 deletions drivers/net/can/grcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
if (err)
goto exit_free_candev;

dev_set_drvdata(&ofdev->dev, dev);
platform_set_drvdata(ofdev, dev);

/* Reset device to allow bit-timing to be set. No need to call
* grcan_reset at this stage. That is done in grcan_open.
Expand Down Expand Up @@ -1715,13 +1715,12 @@ static int grcan_probe(struct platform_device *ofdev)

static int grcan_remove(struct platform_device *ofdev)
{
struct net_device *dev = dev_get_drvdata(&ofdev->dev);
struct net_device *dev = platform_get_drvdata(ofdev);
struct grcan_priv *priv = netdev_priv(dev);

unregister_candev(dev); /* Will in turn call grcan_close */

irq_dispose_mapping(dev->irq);
dev_set_drvdata(&ofdev->dev, NULL);
netif_napi_del(&priv->napi);
free_candev(dev);

Expand Down
10 changes: 4 additions & 6 deletions drivers/net/can/mscan/mpc5xxx_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
goto exit_free_mscan;
}

dev_set_drvdata(&ofdev->dev, dev);
platform_set_drvdata(ofdev, dev);

dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
priv->reg_base, dev->irq, priv->can.clock.freq);
Expand All @@ -321,11 +321,9 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)

static int mpc5xxx_can_remove(struct platform_device *ofdev)
{
struct net_device *dev = dev_get_drvdata(&ofdev->dev);
struct net_device *dev = platform_get_drvdata(ofdev);
struct mscan_priv *priv = netdev_priv(dev);

dev_set_drvdata(&ofdev->dev, NULL);

unregister_mscandev(dev);
iounmap(priv->reg_base);
irq_dispose_mapping(dev->irq);
Expand All @@ -338,7 +336,7 @@ static int mpc5xxx_can_remove(struct platform_device *ofdev)
static struct mscan_regs saved_regs;
static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state)
{
struct net_device *dev = dev_get_drvdata(&ofdev->dev);
struct net_device *dev = platform_get_drvdata(ofdev);
struct mscan_priv *priv = netdev_priv(dev);
struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;

Expand All @@ -349,7 +347,7 @@ static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state

static int mpc5xxx_can_resume(struct platform_device *ofdev)
{
struct net_device *dev = dev_get_drvdata(&ofdev->dev);
struct net_device *dev = platform_get_drvdata(ofdev);
struct mscan_priv *priv = netdev_priv(dev);
struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;

Expand Down
5 changes: 2 additions & 3 deletions drivers/net/can/sja1000/sja1000_isa.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int sja1000_isa_probe(struct platform_device *pdev)
else
priv->cdr = CDR_DEFAULT;

dev_set_drvdata(&pdev->dev, dev);
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);

err = register_sja1000dev(dev);
Expand Down Expand Up @@ -225,12 +225,11 @@ static int sja1000_isa_probe(struct platform_device *pdev)

static int sja1000_isa_remove(struct platform_device *pdev)
{
struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct net_device *dev = platform_get_drvdata(pdev);
struct sja1000_priv *priv = netdev_priv(dev);
int idx = pdev->id;

unregister_sja1000dev(dev);
dev_set_drvdata(&pdev->dev, NULL);

if (mem[idx]) {
iounmap(priv->reg_base);
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/can/sja1000/sja1000_of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ static void sja1000_ofp_write_reg(const struct sja1000_priv *priv,

static int sja1000_ofp_remove(struct platform_device *ofdev)
{
struct net_device *dev = dev_get_drvdata(&ofdev->dev);
struct net_device *dev = platform_get_drvdata(ofdev);
struct sja1000_priv *priv = netdev_priv(dev);
struct device_node *np = ofdev->dev.of_node;
struct resource res;

dev_set_drvdata(&ofdev->dev, NULL);

unregister_sja1000dev(dev);
free_sja1000dev(dev);
iounmap(priv->reg_base);
Expand Down Expand Up @@ -181,7 +179,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev)
priv->reg_base, dev->irq, priv->can.clock.freq,
priv->ocr, priv->cdr);

dev_set_drvdata(&ofdev->dev, dev);
platform_set_drvdata(ofdev, dev);
SET_NETDEV_DEV(dev, &ofdev->dev);

err = register_sja1000dev(dev);
Expand Down
5 changes: 2 additions & 3 deletions drivers/net/can/sja1000/sja1000_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static int sp_probe(struct platform_device *pdev)
break;
}

dev_set_drvdata(&pdev->dev, dev);
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);

err = register_sja1000dev(dev);
Expand All @@ -161,12 +161,11 @@ static int sp_probe(struct platform_device *pdev)

static int sp_remove(struct platform_device *pdev)
{
struct net_device *dev = dev_get_drvdata(&pdev->dev);
struct net_device *dev = platform_get_drvdata(pdev);
struct sja1000_priv *priv = netdev_priv(dev);
struct resource *res;

unregister_sja1000dev(dev);
dev_set_drvdata(&pdev->dev, NULL);

if (priv->reg_base)
iounmap(priv->reg_base);
Expand Down

0 comments on commit 6f45eba

Please sign in to comment.