Re: [PATCH] Input: da9052_tsi: make TSI reference regulator configurable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Fabio,

thank you for the comments.

Am Freitag, den 22.03.2013, 12:51 -0300 schrieb Fabio Estevam:
> Philipp Zabel wrote:
>  
> >  	if (!tsi->stopped) {
> > +		error = regulator_enable(tsi->tsiref);
> > +		if (error < 0) {
> > +			dev_err(tsi->da9052->dev,
> > +				"Failed to enable TSIREF regualtor: %d\n",
> 
> s/regualtor/regulator

I'll correct that.

> > @@ -274,12 +287,20 @@ static int da9052_ts_probe(struct platform_device *pdev)
> >  	/* Disable ADC */
> >  	da9052_ts_adc_toggle(tsi, false);
> >  
> > +	tsi->tsiref = regulator_get(tsi->da9052->dev, "tsiref");
> 
> You could use devm_regulator_get here ...

I chose not to use devm_... because tsi->da9052->dev is not pdev->dev
here, but thinking about it, no harm will be done if regulator_put is
only called by the parent device's remove function. I'll switch to
devm_regulator_get if nobody minds.

> > +	if (IS_ERR(tsi->tsiref)) {
> > +		dev_err(tsi->da9052->dev,
> > +				"Failed to get TSIREF regulator: %ld\n",
> > +				PTR_ERR(tsi->tsiref));
> > +		goto err_free_mem;
> > +	}
> > +
> >  	error = da9052_request_irq(tsi->da9052, DA9052_IRQ_PENDOWN,
> >  				"pendown-irq", da9052_ts_pendwn_irq, tsi);
> >  	if (error) {
> >  		dev_err(tsi->da9052->dev,
> >  			"Failed to register PENDWN IRQ: %d\n", error);
> > -		goto err_free_mem;
> > +		goto err_put_reg;
> >  	}
> >  
> >  	error = da9052_request_irq(tsi->da9052, DA9052_IRQ_TSIREADY,
> > @@ -310,6 +331,8 @@ err_free_datardy_irq:
> >  	da9052_free_irq(tsi->da9052, DA9052_IRQ_TSIREADY, tsi);
> >  err_free_pendwn_irq:
> >  	da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
> > +err_put_reg:
> > +	regulator_put(tsi->tsiref);
> >  err_free_mem:
> >  	kfree(tsi);
> >  	input_free_device(input_dev);
> > @@ -321,10 +344,9 @@ static int  da9052_ts_remove(struct platform_device *pdev)
> >  {
> >  	struct da9052_tsi *tsi = platform_get_drvdata(pdev);
> >  
> > -	da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x19);
> > -
> >  	da9052_free_irq(tsi->da9052, DA9052_IRQ_TSIREADY, tsi);
> >  	da9052_free_irq(tsi->da9052, DA9052_IRQ_PENDOWN, tsi);
> > +	regulator_put(tsi->tsiref);
> 
> and then no need to use the regulator_put.

regards
Philipp

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux