diff options
Diffstat (limited to 'drivers/hte/hte.c')
| -rw-r--r-- | drivers/hte/hte.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/hte/hte.c b/drivers/hte/hte.c index 67c15724ee78..23a6eeb8c506 100644 --- a/drivers/hte/hte.c +++ b/drivers/hte/hte.c @@ -10,14 +10,12 @@ #include <linux/err.h> #include <linux/slab.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/mutex.h> #include <linux/uaccess.h> #include <linux/hte.h> #include <linux/delay.h> #include <linux/debugfs.h> - -#define HTE_TS_NAME_LEN 10 +#include <linux/device.h> /* Global list of the HTE devices */ static DEFINE_SPINLOCK(hte_lock); @@ -88,7 +86,7 @@ struct hte_device { struct list_head list; struct hte_chip *chip; struct module *owner; - struct hte_ts_info ei[]; + struct hte_ts_info ei[] __counted_by(nlines); }; #ifdef CONFIG_DEBUG_FS @@ -389,13 +387,10 @@ static int __hte_req_ts(struct hte_ts_desc *desc, hte_ts_cb_t cb, atomic_inc(&gdev->ts_req); - ei->line_name = NULL; - if (!desc->attr.name) { - ei->line_name = kzalloc(HTE_TS_NAME_LEN, GFP_KERNEL); - if (ei->line_name) - scnprintf(ei->line_name, HTE_TS_NAME_LEN, "ts_%u", - desc->attr.line_id); - } + if (desc->attr.name) + ei->line_name = NULL; + else + ei->line_name = kasprintf(GFP_KERNEL, "ts_%u", desc->attr.line_id); hte_ts_dbgfs_init(desc->attr.name == NULL ? ei->line_name : desc->attr.name, ei); |
