summaryrefslogtreecommitdiffstats
path: root/include/driver.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-11-09 10:55:05 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-09 10:55:05 +0100
commit227426f16163d3721fee82650980aae0eef01375 (patch)
treea64101906c15b814ec942468e88875ce8160e45d /include/driver.h
parentc024f90f5dd5604d3f82dbbc055fd88a69d59187 (diff)
parentac7324a0ed12a67fc836b383388f2562d32e55ed (diff)
downloadbarebox-227426f16163d3721fee82650980aae0eef01375.tar.gz
barebox-227426f16163d3721fee82650980aae0eef01375.tar.xz
Merge branch 'for-next/net-switch-mv88e6xxx'
Diffstat (limited to 'include/driver.h')
-rw-r--r--include/driver.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/include/driver.h b/include/driver.h
index 63facbfbe5..7da184d3ab 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -23,7 +23,6 @@
#include <linux/ioport.h>
#include <of.h>
-#define MAX_DRIVER_NAME 32
#define FORMAT_DRIVER_NAME_ID "%s%d"
#include <param.h>
@@ -38,10 +37,19 @@ struct platform_device_id {
/** @brief Describes a particular device present in the system */
struct device_d {
- /*! This member (and 'type' described below) is used to match with a
- * driver. This is a descriptive name and could be MPC5XXX_ether or
- * imx_serial. */
- char name[MAX_DRIVER_NAME];
+ /*! This member (and 'type' described below) is used to match
+ * with a driver. This is a descriptive name and could be
+ * MPC5XXX_ether or imx_serial. Unless absolutely necessary,
+ * should not be modified directly and dev_set_name() should
+ * be used instead.
+ */
+ char *name;
+
+ /*! This member is used to store device's unique name as
+ * obtained by calling dev_id(). Internal field, do not
+ * access it directly.
+ */
+ char *unique_name;
/*! The id is used to uniquely identify a device in the system. The id
* will show up under /dev/ as the device's name. Usually this is
* something like eth0 or nor0. */
@@ -170,13 +178,18 @@ int get_free_deviceid(const char *name_template);
char *deviceid_from_spec_str(const char *str, char **endp);
-extern const char *dev_id(const struct device_d *dev);
+static inline const char *dev_id(const struct device_d *dev)
+{
+ return (dev->id != DEVICE_ID_SINGLE) ? dev->unique_name : dev->name;
+}
static inline const char *dev_name(const struct device_d *dev)
{
return dev_id(dev);
}
+int dev_set_name(struct device_d *dev, const char *fmt, ...);
+
/*
* get resource 'num' for a device
*/