net: atm: use %*ph to print small buffer
Use %*ph format to print small buffer as hex string. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
edc7e4898d
commit
79ac522402
|
@ -33,23 +33,17 @@ static ssize_t show_atmaddress(struct device *cdev,
|
|||
unsigned long flags;
|
||||
struct atm_dev *adev = to_atm_dev(cdev);
|
||||
struct atm_dev_addr *aaddr;
|
||||
int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
|
||||
int i, j, count = 0;
|
||||
int count = 0;
|
||||
|
||||
spin_lock_irqsave(&adev->lock, flags);
|
||||
list_for_each_entry(aaddr, &adev->local, entry) {
|
||||
for (i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) {
|
||||
if (j == *fmt) {
|
||||
count += scnprintf(buf + count,
|
||||
PAGE_SIZE - count, ".");
|
||||
++fmt;
|
||||
j = 0;
|
||||
}
|
||||
count += scnprintf(buf + count,
|
||||
PAGE_SIZE - count, "%02x",
|
||||
aaddr->addr.sas_addr.prv[i]);
|
||||
}
|
||||
count += scnprintf(buf + count, PAGE_SIZE - count, "\n");
|
||||
count += scnprintf(buf + count, PAGE_SIZE - count,
|
||||
"%1phN.%2phN.%10phN.%6phN.%1phN\n",
|
||||
&aaddr->addr.sas_addr.prv[0],
|
||||
&aaddr->addr.sas_addr.prv[1],
|
||||
&aaddr->addr.sas_addr.prv[3],
|
||||
&aaddr->addr.sas_addr.prv[13],
|
||||
&aaddr->addr.sas_addr.prv[19]);
|
||||
}
|
||||
spin_unlock_irqrestore(&adev->lock, flags);
|
||||
|
||||
|
|
|
@ -799,13 +799,8 @@ static const char *lec_arp_get_status_string(unsigned char status)
|
|||
|
||||
static void lec_info(struct seq_file *seq, struct lec_arp_table *entry)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ETH_ALEN; i++)
|
||||
seq_printf(seq, "%2.2x", entry->mac_addr[i] & 0xff);
|
||||
seq_printf(seq, " ");
|
||||
for (i = 0; i < ATM_ESA_LEN; i++)
|
||||
seq_printf(seq, "%2.2x", entry->atm_addr[i] & 0xff);
|
||||
seq_printf(seq, "%pM ", entry->mac_addr);
|
||||
seq_printf(seq, "%*phN ", ATM_ESA_LEN, entry->atm_addr);
|
||||
seq_printf(seq, "%s %4.4x", lec_arp_get_status_string(entry->status),
|
||||
entry->flags & 0xffff);
|
||||
if (entry->vcc)
|
||||
|
@ -1354,7 +1349,7 @@ static void dump_arp_table(struct lec_priv *priv)
|
|||
{
|
||||
struct lec_arp_table *rulla;
|
||||
char buf[256];
|
||||
int i, j, offset;
|
||||
int i, offset;
|
||||
|
||||
pr_info("Dump %p:\n", priv);
|
||||
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
|
||||
|
@ -1364,12 +1359,8 @@ static void dump_arp_table(struct lec_priv *priv)
|
|||
offset += sprintf(buf, "%d: %p\n", i, rulla);
|
||||
offset += sprintf(buf + offset, "Mac: %pM ",
|
||||
rulla->mac_addr);
|
||||
offset += sprintf(buf + offset, " Atm:");
|
||||
for (j = 0; j < ATM_ESA_LEN; j++) {
|
||||
offset += sprintf(buf + offset,
|
||||
"%2.2x ",
|
||||
rulla->atm_addr[j] & 0xff);
|
||||
}
|
||||
offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
|
||||
rulla->atm_addr);
|
||||
offset += sprintf(buf + offset,
|
||||
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
|
||||
rulla->vcc ? rulla->vcc->vpi : 0,
|
||||
|
@ -1393,11 +1384,8 @@ static void dump_arp_table(struct lec_priv *priv)
|
|||
hlist_for_each_entry(rulla, &priv->lec_no_forward, next) {
|
||||
offset = 0;
|
||||
offset += sprintf(buf + offset, "Mac: %pM ", rulla->mac_addr);
|
||||
offset += sprintf(buf + offset, " Atm:");
|
||||
for (j = 0; j < ATM_ESA_LEN; j++) {
|
||||
offset += sprintf(buf + offset, "%2.2x ",
|
||||
rulla->atm_addr[j] & 0xff);
|
||||
}
|
||||
offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
|
||||
rulla->atm_addr);
|
||||
offset += sprintf(buf + offset,
|
||||
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
|
||||
rulla->vcc ? rulla->vcc->vpi : 0,
|
||||
|
@ -1418,11 +1406,8 @@ static void dump_arp_table(struct lec_priv *priv)
|
|||
hlist_for_each_entry(rulla, &priv->lec_arp_empty_ones, next) {
|
||||
offset = 0;
|
||||
offset += sprintf(buf + offset, "Mac: %pM ", rulla->mac_addr);
|
||||
offset += sprintf(buf + offset, " Atm:");
|
||||
for (j = 0; j < ATM_ESA_LEN; j++) {
|
||||
offset += sprintf(buf + offset, "%2.2x ",
|
||||
rulla->atm_addr[j] & 0xff);
|
||||
}
|
||||
offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
|
||||
rulla->atm_addr);
|
||||
offset += sprintf(buf + offset,
|
||||
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
|
||||
rulla->vcc ? rulla->vcc->vpi : 0,
|
||||
|
@ -1443,11 +1428,8 @@ static void dump_arp_table(struct lec_priv *priv)
|
|||
hlist_for_each_entry(rulla, &priv->mcast_fwds, next) {
|
||||
offset = 0;
|
||||
offset += sprintf(buf + offset, "Mac: %pM ", rulla->mac_addr);
|
||||
offset += sprintf(buf + offset, " Atm:");
|
||||
for (j = 0; j < ATM_ESA_LEN; j++) {
|
||||
offset += sprintf(buf + offset, "%2.2x ",
|
||||
rulla->atm_addr[j] & 0xff);
|
||||
}
|
||||
offset += sprintf(buf + offset, "Atm: %*ph ", ATM_ESA_LEN,
|
||||
rulla->atm_addr);
|
||||
offset += sprintf(buf + offset,
|
||||
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
|
||||
rulla->vcc ? rulla->vcc->vpi : 0,
|
||||
|
@ -1973,17 +1955,8 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
|
|||
* Vcc which we don't want to make default vcc,
|
||||
* attach it anyway.
|
||||
*/
|
||||
pr_debug("LEC_ARP:Attaching data direct, not default: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
|
||||
ioc_data->atm_addr[0], ioc_data->atm_addr[1],
|
||||
ioc_data->atm_addr[2], ioc_data->atm_addr[3],
|
||||
ioc_data->atm_addr[4], ioc_data->atm_addr[5],
|
||||
ioc_data->atm_addr[6], ioc_data->atm_addr[7],
|
||||
ioc_data->atm_addr[8], ioc_data->atm_addr[9],
|
||||
ioc_data->atm_addr[10], ioc_data->atm_addr[11],
|
||||
ioc_data->atm_addr[12], ioc_data->atm_addr[13],
|
||||
ioc_data->atm_addr[14], ioc_data->atm_addr[15],
|
||||
ioc_data->atm_addr[16], ioc_data->atm_addr[17],
|
||||
ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
|
||||
pr_debug("LEC_ARP:Attaching data direct, not default: %*phN\n",
|
||||
ATM_ESA_LEN, ioc_data->atm_addr);
|
||||
entry = make_entry(priv, bus_mac);
|
||||
if (entry == NULL)
|
||||
goto out;
|
||||
|
@ -1999,17 +1972,8 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data,
|
|||
dump_arp_table(priv);
|
||||
goto out;
|
||||
}
|
||||
pr_debug("LEC_ARP:Attaching data direct, default: %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
|
||||
ioc_data->atm_addr[0], ioc_data->atm_addr[1],
|
||||
ioc_data->atm_addr[2], ioc_data->atm_addr[3],
|
||||
ioc_data->atm_addr[4], ioc_data->atm_addr[5],
|
||||
ioc_data->atm_addr[6], ioc_data->atm_addr[7],
|
||||
ioc_data->atm_addr[8], ioc_data->atm_addr[9],
|
||||
ioc_data->atm_addr[10], ioc_data->atm_addr[11],
|
||||
ioc_data->atm_addr[12], ioc_data->atm_addr[13],
|
||||
ioc_data->atm_addr[14], ioc_data->atm_addr[15],
|
||||
ioc_data->atm_addr[16], ioc_data->atm_addr[17],
|
||||
ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
|
||||
pr_debug("LEC_ARP:Attaching data direct, default: %*phN\n",
|
||||
ATM_ESA_LEN, ioc_data->atm_addr);
|
||||
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
|
||||
hlist_for_each_entry(entry,
|
||||
&priv->lec_arp_tables[i], next) {
|
||||
|
|
Loading…
Reference in New Issue