Skip to content

Commit 50ec881

Browse files
andy-shevmarckleinebudde
authored andcommitted
can: mcp251x: get rid of legacy platform data
Instead of using legacy platform data, switch to use device properties. For clock frequency we are using well established clock-frequency property. Users, two for now, are also converted here. Cc: Daniel Mack <[email protected]> Cc: Haojian Zhuang <[email protected]> Cc: Robert Jarzmik <[email protected]> Cc: Russell King <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 371fd7b commit 50ec881

File tree

4 files changed

+14
-35
lines changed

4 files changed

+14
-35
lines changed

arch/arm/mach-pxa/icontrol.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <linux/irq.h>
1414
#include <linux/platform_device.h>
15+
#include <linux/property.h>
1516
#include <linux/gpio.h>
1617

1718
#include <asm/mach-types.h>
@@ -22,7 +23,6 @@
2223

2324
#include <linux/spi/spi.h>
2425
#include <linux/spi/pxa2xx_spi.h>
25-
#include <linux/can/platform/mcp251x.h>
2626
#include <linux/regulator/machine.h>
2727

2828
#include "generic.h"
@@ -69,8 +69,9 @@ static struct pxa2xx_spi_chip mcp251x_chip_info4 = {
6969
.gpio_cs = ICONTROL_MCP251x_nCS4
7070
};
7171

72-
static struct mcp251x_platform_data mcp251x_info = {
73-
.oscillator_frequency = 16E6,
72+
static const struct property_entry mcp251x_properties[] = {
73+
PROPERTY_ENTRY_U32("clock-frequency", 16000000),
74+
{}
7475
};
7576

7677
static struct spi_board_info mcp251x_board_info[] = {
@@ -79,7 +80,7 @@ static struct spi_board_info mcp251x_board_info[] = {
7980
.max_speed_hz = 6500000,
8081
.bus_num = 3,
8182
.chip_select = 0,
82-
.platform_data = &mcp251x_info,
83+
.properties = mcp251x_properties,
8384
.controller_data = &mcp251x_chip_info1,
8485
.irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ1)
8586
},

arch/arm/mach-pxa/zeus.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/leds.h>
1414
#include <linux/irq.h>
1515
#include <linux/pm.h>
16+
#include <linux/property.h>
1617
#include <linux/gpio.h>
1718
#include <linux/gpio/machine.h>
1819
#include <linux/serial_8250.h>
@@ -27,7 +28,6 @@
2728
#include <linux/platform_data/i2c-pxa.h>
2829
#include <linux/platform_data/pca953x.h>
2930
#include <linux/apm-emulation.h>
30-
#include <linux/can/platform/mcp251x.h>
3131
#include <linux/regulator/fixed.h>
3232
#include <linux/regulator/machine.h>
3333

@@ -428,14 +428,15 @@ static struct gpiod_lookup_table can_regulator_gpiod_table = {
428428
},
429429
};
430430

431-
static struct mcp251x_platform_data zeus_mcp2515_pdata = {
432-
.oscillator_frequency = 16*1000*1000,
431+
static const struct property_entry mcp251x_properties[] = {
432+
PROPERTY_ENTRY_U32("clock-frequency", 16000000),
433+
{}
433434
};
434435

435436
static struct spi_board_info zeus_spi_board_info[] = {
436437
[0] = {
437438
.modalias = "mcp2515",
438-
.platform_data = &zeus_mcp2515_pdata,
439+
.properties = mcp251x_properties,
439440
.irq = PXA_GPIO_TO_IRQ(ZEUS_CAN_GPIO),
440441
.max_speed_hz = 1*1000*1000,
441442
.bus_num = 3,

drivers/net/can/spi/mcp251x.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <linux/can/core.h>
2323
#include <linux/can/dev.h>
2424
#include <linux/can/led.h>
25-
#include <linux/can/platform/mcp251x.h>
2625
#include <linux/clk.h>
2726
#include <linux/completion.h>
2827
#include <linux/delay.h>
@@ -986,19 +985,19 @@ MODULE_DEVICE_TABLE(spi, mcp251x_id_table);
986985
static int mcp251x_can_probe(struct spi_device *spi)
987986
{
988987
const void *match = device_get_match_data(&spi->dev);
989-
struct mcp251x_platform_data *pdata = dev_get_platdata(&spi->dev);
990988
struct net_device *net;
991989
struct mcp251x_priv *priv;
992990
struct clk *clk;
993-
int freq, ret;
991+
u32 freq;
992+
int ret;
994993

995994
clk = devm_clk_get_optional(&spi->dev, NULL);
996995
if (IS_ERR(clk))
997996
return PTR_ERR(clk);
998997

999998
freq = clk_get_rate(clk);
1000-
if (freq == 0 && pdata)
1001-
freq = pdata->oscillator_frequency;
999+
if (freq == 0)
1000+
device_property_read_u32(&spi->dev, "clock-frequency", &freq);
10021001

10031002
/* Sanity check */
10041003
if (freq < 1000000 || freq > 25000000)

include/linux/can/platform/mcp251x.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)