diff options
Diffstat (limited to 'drivers/aiodev/core.c')
-rw-r--r-- | drivers/aiodev/core.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/aiodev/core.c b/drivers/aiodev/core.c index 9f5c422500..5bdc4d83d4 100644 --- a/drivers/aiodev/core.c +++ b/drivers/aiodev/core.c @@ -31,16 +31,16 @@ struct aiochannel *aiochannel_by_name(const char *name) } EXPORT_SYMBOL(aiochannel_by_name); -struct aiochannel *aiochannel_get(struct device_d *dev, int index) +struct aiochannel *aiochannel_get(struct device *dev, int index) { struct of_phandle_args spec; struct aiodevice *aiodev; int ret, chnum = 0; - if (!dev->device_node) + if (!dev->of_node) return ERR_PTR(-EINVAL); - ret = of_parse_phandle_with_args(dev->device_node, + ret = of_parse_phandle_with_args(dev->of_node, "io-channels", "#io-channel-cells", index, &spec); @@ -48,7 +48,7 @@ struct aiochannel *aiochannel_get(struct device_d *dev, int index) return ERR_PTR(ret); list_for_each_entry(aiodev, &aiodevices, list) { - if (aiodev->hwdev->device_node == spec.np) + if (aiodev->hwdev->of_node == spec.np) goto found; } @@ -73,6 +73,18 @@ int aiochannel_get_value(struct aiochannel *aiochan, int *value) } EXPORT_SYMBOL(aiochannel_get_value); +int aiochannel_name_get_value(const char *chname, int *value) +{ + struct aiochannel *aio; + + aio = aiochannel_by_name(chname); + if (IS_ERR(aio)) + return PTR_ERR(aio); + + return aiochannel_get_value(aio, value); +} +EXPORT_SYMBOL(aiochannel_name_get_value); + int aiochannel_get_index(struct aiochannel *aiochan) { return aiochan->index; @@ -91,10 +103,10 @@ int aiodevice_register(struct aiodevice *aiodev) int i, ret; if (!aiodev->name && aiodev->hwdev && - aiodev->hwdev->device_node) { + aiodev->hwdev->of_node) { aiodev->dev.id = DEVICE_ID_SINGLE; - aiodev->name = of_alias_get(aiodev->hwdev->device_node); + aiodev->name = of_alias_get(aiodev->hwdev->of_node); } if (!aiodev->name) { |