summaryrefslogtreecommitdiffstats
path: root/drivers/aiodev/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/aiodev/core.c')
-rw-r--r--drivers/aiodev/core.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/aiodev/core.c b/drivers/aiodev/core.c
index b5d06da932..5bdc4d83d4 100644
--- a/drivers/aiodev/core.c
+++ b/drivers/aiodev/core.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* core.c - Code implementing core functionality of AIODEV susbsystem
*
@@ -5,18 +6,6 @@
*
* Copyright (c) 2015 Zodiac Inflight Innovation
* Author: Andrey Smirnov <andrew.smirnov@gmail.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <common.h>
@@ -27,7 +16,7 @@
LIST_HEAD(aiodevices);
EXPORT_SYMBOL(aiodevices);
-struct aiochannel *aiochannel_get_by_name(const char *name)
+struct aiochannel *aiochannel_by_name(const char *name)
{
struct aiodevice *aiodev;
int i;
@@ -40,18 +29,18 @@ struct aiochannel *aiochannel_get_by_name(const char *name)
return ERR_PTR(-ENOENT);
}
-EXPORT_SYMBOL(aiochannel_get_by_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);
@@ -59,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;
}
@@ -84,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;
@@ -102,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) {
@@ -134,7 +135,7 @@ int aiodevice_register(struct aiodevice *aiodev)
aiochannel_param_get_value,
&aiochan->value, "%d", aiochan);
- aiochan->name = xasprintf("%s.%s", aiodev->name, name);
+ aiochan->name = xasprintf("%s.%s", dev_name(&aiodev->dev), name);
free(name);
}