From patchwork Mon Feb 6 17:27:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandra Winter X-Patchwork-Id: 13130429 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE479C636D3 for ; Mon, 6 Feb 2023 17:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjBFR25 (ORCPT ); Mon, 6 Feb 2023 12:28:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230208AbjBFR2e (ORCPT ); Mon, 6 Feb 2023 12:28:34 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72332279A8; Mon, 6 Feb 2023 09:28:19 -0800 (PST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 316GvJf5011138; Mon, 6 Feb 2023 17:28:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ldvo4scQ2FKeR/aOeqLt9DfuGcR/v3Je3ER+Uz1LowQ=; b=chgSUIjvsznJRLNf2AOrLBwsnKpL7AZSrn3UQrdyR6wgF0YSfzEuPBH8Fa3DT7MHfvZE O4o65dSc8hz8DfOkD9lJ410MH4H1OOO11AH4EzE4RD0H4U7ZpwIRUrqDXnFOL6C+25QE nWRs0/qlSq60jq0wQhZpZi9rqedl+u4It3SVr9m9+oYc+6C3eXZNBszme9U1npom/HoQ qFaJmr/8aeIeA4+9rnR77hrbJ5TR8Mx9IP9rYA9xqGRbX9f5zpU6BNN/QLH38HP2lSby FZK+3PBfJ2iefbF4zEmwLWPJX+4UFrVn/y7ySC4uX9QADVms4F2lb2HiCxMKwndh6DRl Eg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nk3rmctvw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 17:28:10 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 316HRL7g013644; Mon, 6 Feb 2023 17:28:09 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nk3rmctuw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 17:28:09 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3160gBof019499; Mon, 6 Feb 2023 17:28:07 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma04fra.de.ibm.com (PPS) with ESMTPS id 3nhf06svqk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Feb 2023 17:28:07 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 316HS4Ai46399964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Feb 2023 17:28:04 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19D1E2004D; Mon, 6 Feb 2023 17:28:04 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E80202004B; Mon, 6 Feb 2023 17:28:03 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTPS; Mon, 6 Feb 2023 17:28:03 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55271) id A673BE075C; Mon, 6 Feb 2023 18:28:03 +0100 (CET) From: Alexandra Winter To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, Heiko Carstens , Thorsten Winkler , Jules Irenge , Joe Perches , Alexandra Winkler Subject: [PATCH net-next 3/4] s390/qeth: Convert sysfs sprintf to sysfs_emit Date: Mon, 6 Feb 2023 18:27:53 +0100 Message-Id: <20230206172754.980062-4-wintera@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230206172754.980062-1-wintera@linux.ibm.com> References: <20230206172754.980062-1-wintera@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: mX24i7uHfG6VyZTDbSfsRUd19WlQ27A8 X-Proofpoint-ORIG-GUID: qllqtioBf2YmjIMG_1gwXAiSyB5oj4pE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-06_07,2023-02-06_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 spamscore=0 malwarescore=0 clxscore=1011 bulkscore=0 adultscore=0 mlxscore=0 impostorscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302060149 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Thorsten Winkler Following the advice of the Documentation/filesystems/sysfs.rst. All sysfs related show()-functions should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Reported-by: Jules Irenge Reported-by: Joe Perches Reviewed-by: Alexandra Winkler Signed-off-by: Thorsten Winkler Signed-off-by: Alexandra Winter --- drivers/s390/net/qeth_core_sys.c | 66 ++++++++++++++++---------------- drivers/s390/net/qeth_l2_sys.c | 28 +++++++------- drivers/s390/net/qeth_l3_sys.c | 41 +++++++++----------- 3 files changed, 67 insertions(+), 68 deletions(-) diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c index d1adc4b83193..eea93f8f106f 100644 --- a/drivers/s390/net/qeth_core_sys.c +++ b/drivers/s390/net/qeth_core_sys.c @@ -23,15 +23,15 @@ static ssize_t qeth_dev_state_show(struct device *dev, switch (card->state) { case CARD_STATE_DOWN: - return sprintf(buf, "DOWN\n"); + return sysfs_emit(buf, "DOWN\n"); case CARD_STATE_SOFTSETUP: if (card->dev->flags & IFF_UP) - return sprintf(buf, "UP (LAN %s)\n", - netif_carrier_ok(card->dev) ? "ONLINE" : - "OFFLINE"); - return sprintf(buf, "SOFTSETUP\n"); + return sysfs_emit(buf, "UP (LAN %s)\n", + netif_carrier_ok(card->dev) ? + "ONLINE" : "OFFLINE"); + return sysfs_emit(buf, "SOFTSETUP\n"); default: - return sprintf(buf, "UNKNOWN\n"); + return sysfs_emit(buf, "UNKNOWN\n"); } } @@ -42,7 +42,7 @@ static ssize_t qeth_dev_chpid_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%02X\n", card->info.chpid); + return sysfs_emit(buf, "%02X\n", card->info.chpid); } static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL); @@ -52,7 +52,7 @@ static ssize_t qeth_dev_if_name_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%s\n", netdev_name(card->dev)); + return sysfs_emit(buf, "%s\n", netdev_name(card->dev)); } static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL); @@ -62,7 +62,7 @@ static ssize_t qeth_dev_card_type_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%s\n", qeth_get_cardname_short(card)); + return sysfs_emit(buf, "%s\n", qeth_get_cardname_short(card)); } static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL); @@ -86,7 +86,7 @@ static ssize_t qeth_dev_inbuf_size_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%s\n", qeth_get_bufsize_str(card)); + return sysfs_emit(buf, "%s\n", qeth_get_bufsize_str(card)); } static DEVICE_ATTR(inbuf_size, 0444, qeth_dev_inbuf_size_show, NULL); @@ -96,7 +96,7 @@ static ssize_t qeth_dev_portno_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%i\n", card->dev->dev_port); + return sysfs_emit(buf, "%i\n", card->dev->dev_port); } static ssize_t qeth_dev_portno_store(struct device *dev, @@ -134,7 +134,7 @@ static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store); static ssize_t qeth_dev_portname_show(struct device *dev, struct device_attribute *attr, char *buf) { - return sprintf(buf, "no portname required\n"); + return sysfs_emit(buf, "no portname required\n"); } static ssize_t qeth_dev_portname_store(struct device *dev, @@ -157,18 +157,18 @@ static ssize_t qeth_dev_prioqing_show(struct device *dev, switch (card->qdio.do_prio_queueing) { case QETH_PRIO_Q_ING_PREC: - return sprintf(buf, "%s\n", "by precedence"); + return sysfs_emit(buf, "%s\n", "by precedence"); case QETH_PRIO_Q_ING_TOS: - return sprintf(buf, "%s\n", "by type of service"); + return sysfs_emit(buf, "%s\n", "by type of service"); case QETH_PRIO_Q_ING_SKB: - return sprintf(buf, "%s\n", "by skb-priority"); + return sysfs_emit(buf, "%s\n", "by skb-priority"); case QETH_PRIO_Q_ING_VLAN: - return sprintf(buf, "%s\n", "by VLAN headers"); + return sysfs_emit(buf, "%s\n", "by VLAN headers"); case QETH_PRIO_Q_ING_FIXED: - return sprintf(buf, "always queue %i\n", + return sysfs_emit(buf, "always queue %i\n", card->qdio.default_out_queue); default: - return sprintf(buf, "disabled\n"); + return sysfs_emit(buf, "disabled\n"); } } @@ -242,7 +242,7 @@ static ssize_t qeth_dev_bufcnt_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%i\n", card->qdio.in_buf_pool.buf_count); + return sysfs_emit(buf, "%i\n", card->qdio.in_buf_pool.buf_count); } static ssize_t qeth_dev_bufcnt_store(struct device *dev, @@ -298,7 +298,7 @@ static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store); static ssize_t qeth_dev_performance_stats_show(struct device *dev, struct device_attribute *attr, char *buf) { - return sprintf(buf, "1\n"); + return sysfs_emit(buf, "1\n"); } static ssize_t qeth_dev_performance_stats_store(struct device *dev, @@ -335,7 +335,7 @@ static ssize_t qeth_dev_layer2_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%i\n", card->options.layer); + return sysfs_emit(buf, "%i\n", card->options.layer); } static ssize_t qeth_dev_layer2_store(struct device *dev, @@ -470,23 +470,25 @@ static ssize_t qeth_dev_switch_attrs_show(struct device *dev, int rc = 0; if (!qeth_card_hw_is_reachable(card)) - return sprintf(buf, "n/a\n"); + return sysfs_emit(buf, "n/a\n"); rc = qeth_query_switch_attributes(card, &sw_info); if (rc) return rc; if (!sw_info.capabilities) - rc = sprintf(buf, "unknown"); + rc = sysfs_emit(buf, "unknown"); if (sw_info.capabilities & QETH_SWITCH_FORW_802_1) - rc = sprintf(buf, (sw_info.settings & QETH_SWITCH_FORW_802_1 ? - "[802.1]" : "802.1")); + rc = sysfs_emit(buf, + (sw_info.settings & QETH_SWITCH_FORW_802_1 ? + "[802.1]" : "802.1")); if (sw_info.capabilities & QETH_SWITCH_FORW_REFL_RELAY) - rc += sprintf(buf + rc, - (sw_info.settings & QETH_SWITCH_FORW_REFL_RELAY ? - " [rr]" : " rr")); - rc += sprintf(buf + rc, "\n"); + rc += sysfs_emit_at(buf, rc, + (sw_info.settings & + QETH_SWITCH_FORW_REFL_RELAY ? + " [rr]" : " rr")); + rc += sysfs_emit_at(buf, rc, "\n"); return rc; } @@ -573,7 +575,7 @@ static ssize_t qeth_dev_blkt_total_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%i\n", card->info.blkt.time_total); + return sysfs_emit(buf, "%i\n", card->info.blkt.time_total); } static ssize_t qeth_dev_blkt_total_store(struct device *dev, @@ -593,7 +595,7 @@ static ssize_t qeth_dev_blkt_inter_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%i\n", card->info.blkt.inter_packet); + return sysfs_emit(buf, "%i\n", card->info.blkt.inter_packet); } static ssize_t qeth_dev_blkt_inter_store(struct device *dev, @@ -613,7 +615,7 @@ static ssize_t qeth_dev_blkt_inter_jumbo_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%i\n", card->info.blkt.inter_packet_jumbo); + return sysfs_emit(buf, "%i\n", card->info.blkt.inter_packet_jumbo); } static ssize_t qeth_dev_blkt_inter_jumbo_store(struct device *dev, diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c index a617351fff57..7f592f912517 100644 --- a/drivers/s390/net/qeth_l2_sys.c +++ b/drivers/s390/net/qeth_l2_sys.c @@ -19,7 +19,7 @@ static ssize_t qeth_bridge_port_role_state_show(struct device *dev, char *word; if (!qeth_bridgeport_allowed(card)) - return sprintf(buf, "n/a (VNIC characteristics)\n"); + return sysfs_emit(buf, "n/a (VNIC characteristics)\n"); mutex_lock(&card->sbp_lock); if (qeth_card_hw_is_reachable(card) && @@ -53,7 +53,7 @@ static ssize_t qeth_bridge_port_role_state_show(struct device *dev, QETH_CARD_TEXT_(card, 2, "SBP%02x:%02x", card->options.sbp.role, state); else - rc = sprintf(buf, "%s\n", word); + rc = sysfs_emit(buf, "%s\n", word); } mutex_unlock(&card->sbp_lock); @@ -66,7 +66,7 @@ static ssize_t qeth_bridge_port_role_show(struct device *dev, struct qeth_card *card = dev_get_drvdata(dev); if (!qeth_bridgeport_allowed(card)) - return sprintf(buf, "n/a (VNIC characteristics)\n"); + return sysfs_emit(buf, "n/a (VNIC characteristics)\n"); return qeth_bridge_port_role_state_show(dev, attr, buf, 0); } @@ -117,7 +117,7 @@ static ssize_t qeth_bridge_port_state_show(struct device *dev, struct qeth_card *card = dev_get_drvdata(dev); if (!qeth_bridgeport_allowed(card)) - return sprintf(buf, "n/a (VNIC characteristics)\n"); + return sysfs_emit(buf, "n/a (VNIC characteristics)\n"); return qeth_bridge_port_role_state_show(dev, attr, buf, 1); } @@ -132,11 +132,11 @@ static ssize_t qeth_bridgeport_hostnotification_show(struct device *dev, int enabled; if (!qeth_bridgeport_allowed(card)) - return sprintf(buf, "n/a (VNIC characteristics)\n"); + return sysfs_emit(buf, "n/a (VNIC characteristics)\n"); enabled = card->options.sbp.hostnotification; - return sprintf(buf, "%d\n", enabled); + return sysfs_emit(buf, "%d\n", enabled); } static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev, @@ -180,7 +180,7 @@ static ssize_t qeth_bridgeport_reflect_show(struct device *dev, char *state; if (!qeth_bridgeport_allowed(card)) - return sprintf(buf, "n/a (VNIC characteristics)\n"); + return sysfs_emit(buf, "n/a (VNIC characteristics)\n"); if (card->options.sbp.reflect_promisc) { if (card->options.sbp.reflect_promisc_primary) @@ -190,7 +190,7 @@ static ssize_t qeth_bridgeport_reflect_show(struct device *dev, } else state = "none"; - return sprintf(buf, "%s\n", state); + return sysfs_emit(buf, "%s\n", state); } static ssize_t qeth_bridgeport_reflect_store(struct device *dev, @@ -280,10 +280,10 @@ static ssize_t qeth_vnicc_timeout_show(struct device *dev, rc = qeth_l2_vnicc_get_timeout(card, &timeout); if (rc == -EBUSY) - return sprintf(buf, "n/a (BridgePort)\n"); + return sysfs_emit(buf, "n/a (BridgePort)\n"); if (rc == -EOPNOTSUPP) - return sprintf(buf, "n/a\n"); - return rc ? rc : sprintf(buf, "%d\n", timeout); + return sysfs_emit(buf, "n/a\n"); + return rc ? rc : sysfs_emit(buf, "%d\n", timeout); } /* change timeout setting */ @@ -318,10 +318,10 @@ static ssize_t qeth_vnicc_char_show(struct device *dev, rc = qeth_l2_vnicc_get_state(card, vnicc, &state); if (rc == -EBUSY) - return sprintf(buf, "n/a (BridgePort)\n"); + return sysfs_emit(buf, "n/a (BridgePort)\n"); if (rc == -EOPNOTSUPP) - return sprintf(buf, "n/a\n"); - return rc ? rc : sprintf(buf, "%d\n", state); + return sysfs_emit(buf, "n/a\n"); + return rc ? rc : sysfs_emit(buf, "%d\n", state); } /* change setting of characteristic */ diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index 6143dd485810..f0f8adaa2f05 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c @@ -32,26 +32,26 @@ static ssize_t qeth_l3_dev_route_show(struct qeth_card *card, { switch (route->type) { case PRIMARY_ROUTER: - return sprintf(buf, "%s\n", "primary router"); + return sysfs_emit(buf, "%s\n", "primary router"); case SECONDARY_ROUTER: - return sprintf(buf, "%s\n", "secondary router"); + return sysfs_emit(buf, "%s\n", "secondary router"); case MULTICAST_ROUTER: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) - return sprintf(buf, "%s\n", "multicast router+"); + return sysfs_emit(buf, "%s\n", "multicast router+"); else - return sprintf(buf, "%s\n", "multicast router"); + return sysfs_emit(buf, "%s\n", "multicast router"); case PRIMARY_CONNECTOR: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) - return sprintf(buf, "%s\n", "primary connector+"); + return sysfs_emit(buf, "%s\n", "primary connector+"); else - return sprintf(buf, "%s\n", "primary connector"); + return sysfs_emit(buf, "%s\n", "primary connector"); case SECONDARY_CONNECTOR: if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO) - return sprintf(buf, "%s\n", "secondary connector+"); + return sysfs_emit(buf, "%s\n", "secondary connector+"); else - return sprintf(buf, "%s\n", "secondary connector"); + return sysfs_emit(buf, "%s\n", "secondary connector"); default: - return sprintf(buf, "%s\n", "no"); + return sysfs_emit(buf, "%s\n", "no"); } } @@ -138,7 +138,7 @@ static ssize_t qeth_l3_dev_sniffer_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%i\n", card->options.sniffer ? 1 : 0); + return sysfs_emit(buf, "%i\n", card->options.sniffer ? 1 : 0); } static ssize_t qeth_l3_dev_sniffer_store(struct device *dev, @@ -200,7 +200,7 @@ static ssize_t qeth_l3_dev_hsuid_show(struct device *dev, memcpy(tmp_hsuid, card->options.hsuid, sizeof(tmp_hsuid)); EBCASC(tmp_hsuid, 8); - return sprintf(buf, "%s\n", tmp_hsuid); + return sysfs_emit(buf, "%s\n", tmp_hsuid); } static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, @@ -285,7 +285,7 @@ static ssize_t qeth_l3_dev_ipato_enable_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%u\n", card->ipato.enabled ? 1 : 0); + return sysfs_emit(buf, "%u\n", card->ipato.enabled ? 1 : 0); } static ssize_t qeth_l3_dev_ipato_enable_store(struct device *dev, @@ -330,7 +330,7 @@ static ssize_t qeth_l3_dev_ipato_invert4_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%u\n", card->ipato.invert4 ? 1 : 0); + return sysfs_emit(buf, "%u\n", card->ipato.invert4 ? 1 : 0); } static ssize_t qeth_l3_dev_ipato_invert4_store(struct device *dev, @@ -388,14 +388,13 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card, if (entry_len + 1 > PAGE_SIZE - str_len - 1) break; - entry_len = scnprintf(buf, PAGE_SIZE - str_len, - "%s/%i\n", addr_str, ipatoe->mask_bits); + entry_len = sysfs_emit_at(buf, str_len, "%s/%i\n", + addr_str, ipatoe->mask_bits); str_len += entry_len; - buf += entry_len; } mutex_unlock(&card->ip_lock); - return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n"); + return str_len ? str_len : sysfs_emit(buf, "\n"); } static ssize_t qeth_l3_dev_ipato_add4_show(struct device *dev, @@ -501,7 +500,7 @@ static ssize_t qeth_l3_dev_ipato_invert6_show(struct device *dev, { struct qeth_card *card = dev_get_drvdata(dev); - return sprintf(buf, "%u\n", card->ipato.invert6 ? 1 : 0); + return sysfs_emit(buf, "%u\n", card->ipato.invert6 ? 1 : 0); } static ssize_t qeth_l3_dev_ipato_invert6_store(struct device *dev, @@ -607,14 +606,12 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf, if (entry_len + 1 > PAGE_SIZE - str_len - 1) break; - entry_len = scnprintf(buf, PAGE_SIZE - str_len, "%s\n", - addr_str); + entry_len = sysfs_emit_at(buf, str_len, "%s\n", addr_str); str_len += entry_len; - buf += entry_len; } mutex_unlock(&card->ip_lock); - return str_len ? str_len : scnprintf(buf, PAGE_SIZE, "\n"); + return str_len ? str_len : sysfs_emit(buf, "\n"); } static ssize_t qeth_l3_dev_vipa_add4_show(struct device *dev,