mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-19 12:24:34 +08:00
usb: gadget: ether: Add \n to each attribute of ethernet functions
Generally in SysFS and ConfigFS files are new line terminated. Also most of USB functions adds a trailing newline to each attribute. Let's follow this convention also in ethernet functions. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
8236800da1
commit
00b6c62eb7
@ -913,9 +913,16 @@ EXPORT_SYMBOL_GPL(gether_set_dev_addr);
|
|||||||
int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len)
|
int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len)
|
||||||
{
|
{
|
||||||
struct eth_dev *dev;
|
struct eth_dev *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
dev = netdev_priv(net);
|
dev = netdev_priv(net);
|
||||||
return get_ether_addr_str(dev->dev_mac, dev_addr, len);
|
ret = get_ether_addr_str(dev->dev_mac, dev_addr, len);
|
||||||
|
if (ret + 1 < len) {
|
||||||
|
dev_addr[ret++] = '\n';
|
||||||
|
dev_addr[ret] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(gether_get_dev_addr);
|
EXPORT_SYMBOL_GPL(gether_get_dev_addr);
|
||||||
|
|
||||||
@ -935,9 +942,16 @@ EXPORT_SYMBOL_GPL(gether_set_host_addr);
|
|||||||
int gether_get_host_addr(struct net_device *net, char *host_addr, int len)
|
int gether_get_host_addr(struct net_device *net, char *host_addr, int len)
|
||||||
{
|
{
|
||||||
struct eth_dev *dev;
|
struct eth_dev *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
dev = netdev_priv(net);
|
dev = netdev_priv(net);
|
||||||
return get_ether_addr_str(dev->host_mac, host_addr, len);
|
ret = get_ether_addr_str(dev->host_mac, host_addr, len);
|
||||||
|
if (ret + 1 < len) {
|
||||||
|
host_addr[ret++] = '\n';
|
||||||
|
host_addr[ret] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(gether_get_host_addr);
|
EXPORT_SYMBOL_GPL(gether_get_host_addr);
|
||||||
|
|
||||||
@ -984,10 +998,12 @@ EXPORT_SYMBOL_GPL(gether_get_qmult);
|
|||||||
|
|
||||||
int gether_get_ifname(struct net_device *net, char *name, int len)
|
int gether_get_ifname(struct net_device *net, char *name, int len)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
strlcpy(name, netdev_name(net), len);
|
ret = snprintf(name, len, "%s\n", netdev_name(net));
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return strlen(name);
|
return ret < len ? ret : len;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(gether_get_ifname);
|
EXPORT_SYMBOL_GPL(gether_get_ifname);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
mutex_lock(&opts->lock); \
|
mutex_lock(&opts->lock); \
|
||||||
qmult = gether_get_qmult(opts->net); \
|
qmult = gether_get_qmult(opts->net); \
|
||||||
mutex_unlock(&opts->lock); \
|
mutex_unlock(&opts->lock); \
|
||||||
return sprintf(page, "%d", qmult); \
|
return sprintf(page, "%d\n", qmult); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static ssize_t _f_##_opts_qmult_store(struct config_item *item, \
|
static ssize_t _f_##_opts_qmult_store(struct config_item *item, \
|
||||||
|
Loading…
Reference in New Issue
Block a user