Re: [PATCH v3] clock: max77686: Add driver for Maxim 77686 32KHzcrystal oscillator

From: Mark Brown
Date: Mon Jun 11 2012 - 07:22:04 EST


On Mon, Jun 11, 2012 at 02:09:59PM +0300, Felipe Balbi wrote:
> On Mon, Jun 11, 2012 at 08:01:20PM +0900, Jonghwa Lee wrote:

> > +static __devinit int max77686_clk_probe(struct platform_device *pdev)

> why platform_device ? Isn't this an i2c device ? So this should be
> i2c-client driver...

It's a component on an MFD.

> > + if (!max77686[i])
> > + return -ENOMEM;
> > +
> > + max77686[i]->iodev = iodev;
> > + max77686[i]->mask = 1 << i;
> > + mutex_init(&max77686[i]->mutex);
> > + }

> doesn't look like the right way to do this. What if a user doesn't use
> all clk outputs ?

It seems like a bad idea for the individual drivers to have to worry
about that, it seems simpler for them to register all their resources
and then let the subsystem do what it likes with them.

> > +static int __devexit max77686_clk_remove(struct platform_device *pdev)
> > +{
> > + kfree(clk32khz_ap);
> > + kfree(clk32khz_cp);
> > + kfree(clk32khz_pmic);

> kfree() or clk_unregister() ??

Shouldn't be kfree(), the memory is allocated with devm_kzalloc().

Attachment: signature.asc
Description: Digital signature