Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2343845rwi; Fri, 21 Oct 2022 02:45:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Rgna+nI7CxYMntoy1O5Y1wxeaBS2lyYlOoesCIuPGgIuYuh4PoZbBq/hnE4Mk6F7axe+U X-Received: by 2002:a17:90b:1644:b0:20d:459b:9d81 with SMTP id il4-20020a17090b164400b0020d459b9d81mr21033447pjb.196.1666345516095; Fri, 21 Oct 2022 02:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666345516; cv=none; d=google.com; s=arc-20160816; b=hYmrsvjPpIhy4l+Pds/990GDvbodcA4U9W1NJxHlQFfZJLAVZr1ftDRA6Jliz/w312 FL4uHPlBfqmpYoObyvH3Pd2+cvQpwg6xv6U9siwrs1prYAc4GbE7ITHeaZ3Qw6uLTuA0 ECXp9Lnh1Jd7fmCmMe5E4G8VzbWpmTdJ206Pqqb1AcNWL7s5rvdzd95R7MoFDVfv7Qw1 2kR8g1j5ZDJP+6+1YKjjSo8C9mxfBu2WEFWR8wk3o0bmHdnS12uM9L/2+aaVJq2+Cyfm XQMADvvr1k917cuNQvuL2+o65tWcoQgGMFBGdG43OSorY29H4P9AxN9Ge1yGXPGmnSrZ ufVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NW463Igz6cQC3RaEvw8WDzTJ4CdrSyo6nM6hGHOMkTg=; b=qVN+bmU5pIsuGj1EHBObDS2v01N9i1KOKaHu2JnqcciSb9Dswp7yNfINIUKEj9ArZV yQ+9n1jdZcPUCyG0b6Qyt1y3eV1MYKFiq1zW3YVIEIMq+9Z95YsgcfkX6pkRQamQ2GoJ hoaPLCYMs99U3nk6NTdk1r3Sdnx0vPnkrnVPm6j0+SUpFICK4gj0cKNXRqM2hMuH3bAo 74pjv+9jPOYJYFGMWs9QEfWOJqgZIecjwX741cEvX+rjEZykgA8O7aJx0IJSeTBE1KUx QF/jOgkzSsmviZ57EQCdPHwx5sC4Z2X4BT/l72IN1MfvpuDn2rA/gt6gtt/FeuNY1JqU dAkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="drX/ctD2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a056a00134700b005635c47d783si26933351pfu.357.2022.10.21.02.45.03; Fri, 21 Oct 2022 02:45:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="drX/ctD2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbiJUIzR (ORCPT + 99 others); Fri, 21 Oct 2022 04:55:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbiJUIzF (ORCPT ); Fri, 21 Oct 2022 04:55:05 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE3958F278; Fri, 21 Oct 2022 01:54:55 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d10so1990184pfh.6; Fri, 21 Oct 2022 01:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NW463Igz6cQC3RaEvw8WDzTJ4CdrSyo6nM6hGHOMkTg=; b=drX/ctD2faQZRSHwPE6bgBOPuQP4t2psLZ1zSbIMSreWD+ceMp5xID5RhVjMEGvhLo 7IszKXtAuSnpMk47VmJCpL8Kf0yYz+9YFbgjy8i7bFx/OqAI5Q2Xh9wUVtFCuiQv2+kj BChLBtgAMSfEssm6UC9Fp3o2L+GEOZlWVM/dIeM0Xi2oYLWXPdTB+dq1S02uC/s7YPSq 5a18zdlgdRXGC4SsQDVfkCHbeUZaCEj6AoNWF7dxByEiSuTEZ86LYwi312rM6QLvdE3i btXNYpZjrijjuR4ujJDOU6VIfWdH2sXrmv/xDMYAmyJJiMoy37JZ/hDyirc4QUbGkEZK n0Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NW463Igz6cQC3RaEvw8WDzTJ4CdrSyo6nM6hGHOMkTg=; b=Sxklm+i+ki5kEV2ZSqSn6CxwRgY9K6ABEhoMoHq+ChcJ6QFuPY0xReUau+52QbY8Hb rbEvU3IurFjm+EEpsvm+T7z0AzrWISFlX5lYCJ5SaFqzo2Y/etAk6qdXmHJ4JvKLHxUY toQW+KiHCccsYXvNIUBsyP6GD5f3yTwBF80KM/PEIH/j5FII9d8a2dhHwY1TVqMrKBiG iiKtbo88MfjlEbhz9pPq9MJYMypILqlGuBbomPPdJZsSVq354AQ+rUwC3owyF8w53c5x aTi+3Pvgj/7kMQaWazXpd9aSBozs6hHixPNqFS9gMPMNfsLEnMHB0PGviJ92s7ypRA9m SYsQ== X-Gm-Message-State: ACrzQf2B9YT1itmBK0Um40co107NeQEvAGExriwzWmgfmcYrdjv5pIJ2 m7ONQcW2dB4zzVDDDIN/BbY= X-Received: by 2002:a63:4507:0:b0:43c:9cf4:f1d6 with SMTP id s7-20020a634507000000b0043c9cf4f1d6mr15852327pga.316.1666342494338; Fri, 21 Oct 2022 01:54:54 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id p3-20020a170902780300b001811a197797sm14069544pll.194.2022.10.21.01.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 01:54:53 -0700 (PDT) From: yexingchen116@gmail.com X-Google-Original-From: ye.xingchen@zte.com.cn To: axboe@kernel.dk Cc: kch@nvidia.com, damien.lemoal@opensource.wdc.com, johannes.thumshirn@wdc.com, bvanassche@acm.org, ming.lei@redhat.com, vincent.fu@samsung.com, shinichiro.kawasaki@wdc.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ye xingchen Subject: [PATCH linux-next] null_blk: use sysfs_emit() to instead of scnprintf() Date: Fri, 21 Oct 2022 08:54:46 +0000 Message-Id: <20221021085446.414696-1-ye.xingchen@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: ye xingchen Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen --- drivers/block/null_blk/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 1f154f92f4c2..5317ef2ba227 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -255,18 +255,18 @@ static inline struct nullb_device *to_nullb_device(struct config_item *item) static inline ssize_t nullb_device_uint_attr_show(unsigned int val, char *page) { - return snprintf(page, PAGE_SIZE, "%u\n", val); + return sysfs_emit(page, "%u\n", val); } static inline ssize_t nullb_device_ulong_attr_show(unsigned long val, char *page) { - return snprintf(page, PAGE_SIZE, "%lu\n", val); + return sysfs_emit(page, "%lu\n", val); } static inline ssize_t nullb_device_bool_attr_show(bool val, char *page) { - return snprintf(page, PAGE_SIZE, "%u\n", val); + return sysfs_emit(page, "%u\n", val); } static ssize_t nullb_device_uint_attr_store(unsigned int *val, -- 2.25.1