mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 19:47:08 +02:00
staging:iio:adc:lpc32xx rename local state structure to _state
Previously it was called _info with instances as info. This caused some confusion against the info structure that are used in the core of IIO. Since this driver was written it's become a fairly strong convention to use _state and st for instances so change to that. Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
5023574adc
commit
7901b2a145
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
#define LPC32XXAD_NAME "lpc32xx-adc"
|
#define LPC32XXAD_NAME "lpc32xx-adc"
|
||||||
|
|
||||||
struct lpc32xx_adc_info {
|
struct lpc32xx_adc_state {
|
||||||
void __iomem *adc_base;
|
void __iomem *adc_base;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct completion completion;
|
struct completion completion;
|
||||||
|
|
@ -75,21 +75,21 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev,
|
||||||
int *val2,
|
int *val2,
|
||||||
long mask)
|
long mask)
|
||||||
{
|
{
|
||||||
struct lpc32xx_adc_info *info = iio_priv(indio_dev);
|
struct lpc32xx_adc_state *st = iio_priv(indio_dev);
|
||||||
|
|
||||||
if (mask == IIO_CHAN_INFO_RAW) {
|
if (mask == IIO_CHAN_INFO_RAW) {
|
||||||
mutex_lock(&indio_dev->mlock);
|
mutex_lock(&indio_dev->mlock);
|
||||||
clk_prepare_enable(info->clk);
|
clk_prepare_enable(st->clk);
|
||||||
/* Measurement setup */
|
/* Measurement setup */
|
||||||
__raw_writel(LPC32XXAD_INTERNAL | (chan->address) |
|
__raw_writel(LPC32XXAD_INTERNAL | (chan->address) |
|
||||||
LPC32XXAD_REFp | LPC32XXAD_REFm,
|
LPC32XXAD_REFp | LPC32XXAD_REFm,
|
||||||
LPC32XXAD_SELECT(info->adc_base));
|
LPC32XXAD_SELECT(st->adc_base));
|
||||||
/* Trigger conversion */
|
/* Trigger conversion */
|
||||||
__raw_writel(LPC32XXAD_PDN_CTRL | LPC32XXAD_STROBE,
|
__raw_writel(LPC32XXAD_PDN_CTRL | LPC32XXAD_STROBE,
|
||||||
LPC32XXAD_CTRL(info->adc_base));
|
LPC32XXAD_CTRL(st->adc_base));
|
||||||
wait_for_completion(&info->completion); /* set by ISR */
|
wait_for_completion(&st->completion); /* set by ISR */
|
||||||
clk_disable_unprepare(info->clk);
|
clk_disable_unprepare(st->clk);
|
||||||
*val = info->value;
|
*val = st->value;
|
||||||
mutex_unlock(&indio_dev->mlock);
|
mutex_unlock(&indio_dev->mlock);
|
||||||
|
|
||||||
return IIO_VAL_INT;
|
return IIO_VAL_INT;
|
||||||
|
|
@ -120,19 +120,19 @@ static const struct iio_chan_spec lpc32xx_adc_iio_channels[] = {
|
||||||
|
|
||||||
static irqreturn_t lpc32xx_adc_isr(int irq, void *dev_id)
|
static irqreturn_t lpc32xx_adc_isr(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct lpc32xx_adc_info *info = dev_id;
|
struct lpc32xx_adc_state *st = dev_id;
|
||||||
|
|
||||||
/* Read value and clear irq */
|
/* Read value and clear irq */
|
||||||
info->value = __raw_readl(LPC32XXAD_VALUE(info->adc_base)) &
|
st->value = __raw_readl(LPC32XXAD_VALUE(st->adc_base)) &
|
||||||
LPC32XXAD_VALUE_MASK;
|
LPC32XXAD_VALUE_MASK;
|
||||||
complete(&info->completion);
|
complete(&st->completion);
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lpc32xx_adc_probe(struct platform_device *pdev)
|
static int lpc32xx_adc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct lpc32xx_adc_info *info = NULL;
|
struct lpc32xx_adc_state *st = NULL;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
int retval = -ENODEV;
|
int retval = -ENODEV;
|
||||||
struct iio_dev *iodev = NULL;
|
struct iio_dev *iodev = NULL;
|
||||||
|
|
@ -144,23 +144,23 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
iodev = devm_iio_device_alloc(&pdev->dev, sizeof(*info));
|
iodev = devm_iio_device_alloc(&pdev->dev, sizeof(*st));
|
||||||
if (!iodev)
|
if (!iodev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
info = iio_priv(iodev);
|
st = iio_priv(iodev);
|
||||||
|
|
||||||
info->adc_base = devm_ioremap(&pdev->dev, res->start,
|
st->adc_base = devm_ioremap(&pdev->dev, res->start,
|
||||||
resource_size(res));
|
resource_size(res));
|
||||||
if (!info->adc_base) {
|
if (!st->adc_base) {
|
||||||
dev_err(&pdev->dev, "failed mapping memory\n");
|
dev_err(&pdev->dev, "failed mapping memory\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->clk = devm_clk_get(&pdev->dev, NULL);
|
st->clk = devm_clk_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(info->clk)) {
|
if (IS_ERR(st->clk)) {
|
||||||
dev_err(&pdev->dev, "failed getting clock\n");
|
dev_err(&pdev->dev, "failed getting clock\n");
|
||||||
return PTR_ERR(info->clk);
|
return PTR_ERR(st->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
irq = platform_get_irq(pdev, 0);
|
irq = platform_get_irq(pdev, 0);
|
||||||
|
|
@ -170,7 +170,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0,
|
retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0,
|
||||||
LPC32XXAD_NAME, info);
|
LPC32XXAD_NAME, st);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
dev_err(&pdev->dev, "failed requesting interrupt\n");
|
dev_err(&pdev->dev, "failed requesting interrupt\n");
|
||||||
return retval;
|
return retval;
|
||||||
|
|
@ -178,7 +178,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
platform_set_drvdata(pdev, iodev);
|
platform_set_drvdata(pdev, iodev);
|
||||||
|
|
||||||
init_completion(&info->completion);
|
init_completion(&st->completion);
|
||||||
|
|
||||||
iodev->name = LPC32XXAD_NAME;
|
iodev->name = LPC32XXAD_NAME;
|
||||||
iodev->dev.parent = &pdev->dev;
|
iodev->dev.parent = &pdev->dev;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user