Skip to content

Commit

Permalink
i2c-s3c2410: Remove default platform data.
Browse files Browse the repository at this point in the history
The platform data should now always be present when the device
is initialised, so we can remove the default platform data in
the driver.

All the device initialisation points in the board specific code
should already have been changed to initialise this as necessary.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Ben Dooks committed Dec 16, 2008
1 parent 8be310a commit 6a039ca
Showing 1 changed file with 8 additions and 31 deletions.
39 changes: 8 additions & 31 deletions drivers/i2c/busses/i2c-s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,7 @@ struct s3c24xx_i2c {
#endif
};

/* default platform data to use if not supplied in the platform_device
*/

static struct s3c2410_platform_i2c s3c24xx_i2c_default_platform = {
.flags = 0,
.slave_addr = 0x10,
.bus_freq = 100*1000,
.max_freq = 400*1000,
.sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON,
};
/* default platform data removed, dev should always carry data. */

/* s3c24xx_i2c_is2440()
*
Expand All @@ -100,22 +91,6 @@ static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
return !strcmp(pdev->name, "s3c2440-i2c");
}


/* s3c24xx_i2c_get_platformdata
*
* get the platform data associated with the given device, or return
* the default if there is none
*/

static inline struct s3c2410_platform_i2c *
s3c24xx_i2c_get_platformdata(struct device *dev)
{
if (dev->platform_data != NULL)
return (struct s3c2410_platform_i2c *)dev->platform_data;

return &s3c24xx_i2c_default_platform;
}

/* s3c24xx_i2c_master_complete
*
* complete the message and wake up the caller, using the given return code,
Expand Down Expand Up @@ -648,16 +623,14 @@ static inline int freq_acceptable(unsigned int freq, unsigned int wanted)

static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
{
struct s3c2410_platform_i2c *pdata;
struct s3c2410_platform_i2c *pdata = i2c->dev->platform_data;
unsigned long clkin = clk_get_rate(i2c->clk);
unsigned int divs, div1;
u32 iiccon;
int freq;
int start, end;

i2c->clkrate = clkin;

pdata = s3c24xx_i2c_get_platformdata(i2c->adap.dev.parent);
clkin /= 1000; /* clkin now in KHz */

dev_dbg(i2c->dev, "pdata %p, freq %lu %lu..%lu\n",
Expand Down Expand Up @@ -778,7 +751,7 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)

/* get the plafrom data */

pdata = s3c24xx_i2c_get_platformdata(i2c->dev);
pdata = i2c->dev->platform_data;

/* inititalise the gpio */

Expand Down Expand Up @@ -829,7 +802,11 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
struct resource *res;
int ret;

pdata = s3c24xx_i2c_get_platformdata(&pdev->dev);
pdata = pdev->dev.platform_data;
if (!pdata) {
dev_err(&pdev->dev, "no platform data\n");
return -EINVAL;
}

/* find the clock and enable it */

Expand Down

0 comments on commit 6a039ca

Please sign in to comment.