Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 289048
b: refs/heads/master
c: 7389266
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Feb 9, 2012
1 parent 990839a commit 8c79770
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b2c04a34aa9a1b82af590b7e7cc965e7125ce9fa
refs/heads/master: 7389266cc9fa4b9b2761785bcc6fba7bbeb8d070
33 changes: 10 additions & 23 deletions trunk/drivers/staging/iio/dac/ad5446.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,30 +149,8 @@ static struct attribute *ad5446_attributes[] = {
NULL,
};

static umode_t ad5446_attr_is_visible(struct kobject *kobj,
struct attribute *attr, int n)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad5446_state *st = iio_priv(indio_dev);

umode_t mode = attr->mode;

if (!st->chip_info->store_pwr_down &&
(attr == &iio_dev_attr_out_voltage0_powerdown.dev_attr.attr ||
attr == &iio_dev_attr_out_voltage_powerdown_mode.
dev_attr.attr ||
attr ==
&iio_const_attr_out_voltage_powerdown_mode_available.
dev_attr.attr))
mode = 0;

return mode;
}

static const struct attribute_group ad5446_attribute_group = {
.attrs = ad5446_attributes,
.is_visible = ad5446_attr_is_visible,
};

#define AD5446_CHANNEL(bits, storage, shift) { \
Expand Down Expand Up @@ -321,6 +299,12 @@ static const struct iio_info ad5446_info = {
.driver_module = THIS_MODULE,
};

static const struct iio_info ad5446_info_no_pwr_down = {
.read_raw = ad5446_read_raw,
.write_raw = ad5446_write_raw,
.driver_module = THIS_MODULE,
};

static int __devinit ad5446_probe(struct spi_device *spi)
{
struct ad5446_state *st;
Expand Down Expand Up @@ -353,7 +337,10 @@ static int __devinit ad5446_probe(struct spi_device *spi)
/* Estabilish that the iio_dev is a child of the spi device */
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->info = &ad5446_info;
if (st->chip_info->store_pwr_down)
indio_dev->info = &ad5446_info;
else
indio_dev->info = &ad5446_info_no_pwr_down;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = &st->chip_info->channel;
indio_dev->num_channels = 1;
Expand Down

0 comments on commit 8c79770

Please sign in to comment.