Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2289498lqt; Mon, 22 Apr 2024 07:01:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUswB0RyKZIObOeH73h/MGWW5qorcL7IUoCX801L9ynPGeptypIw7YZnvwduI4jDGrkc22s3BwNaBCJZb1oSU3GhMCQ5cbD3OTOp/1GRw== X-Google-Smtp-Source: AGHT+IHuZT28ALGlL6qS9x8b+9gaIs0YKGMjNXti/SABL0Jgzxj81aEQJZr9XiBcGGPRLm7EylRr X-Received: by 2002:a05:6a21:3417:b0:1aa:41e4:f1a8 with SMTP id yn23-20020a056a21341700b001aa41e4f1a8mr11323903pzb.37.1713794503305; Mon, 22 Apr 2024 07:01:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713794503; cv=pass; d=google.com; s=arc-20160816; b=wzIczow/HL92Q3goesWZGT+/ztYqcb+FgZhuWhBYBw9nMS67utv4bt6S0dJJT/cAXg 4WQBvWUFPyXyBtSc3eW/WufqjzCbfrmew5B4MA4CQ5MqSRQBw7VSHkwco9+0Bd5wiNQY Qk0GHgEvY4dere8AShW2lRHBb2da/sDwraPPTK7uJ0YdvdT4olBt6N4VfgsG7vBk0VZh kwSwb4XEW3rddFnRNRBsyUIhHLJKeg8UKYt7RXKtCPxl0Nadpn3d+Y7tTCVuoMyLNqYD hsOHKMJ/vRmaqdwEr3aYAwGWQfSKyxAWwxY4zcsh2zUCabx1RZHrhD+SQnyNI+UjGTdS Ot3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DjWK16yEpG2qC4sEpfQe3ru9FwvfTS+uslLAL5h78t0=; fh=W/jvB2RUB6W4BtY/DVquhyeeuVyXkyNAPKOrafGLhss=; b=gwC20ulMm7zbyZm3PZYfsn8HrDEFz1FcO4vuG1u70TmSM4wNk3X5Mihr/D2m6/PK/2 PS0CylTSz6SJlpB3Sb+eERtOsS+L+3heV9m/zPMi+7AwRjWye24T6yAv29vy7MPP8WUw ITD7G2I6J2IkRGHni1OhCH8aPRzzlE3zXZMMs8u13z991zRNW+CZ8VqUiHLibPSdyqzr xnAwtyRMLWhfib/BJ6mM0GpeSXa3EtJ/kU/JlSBpjxQcBOuZNdZmwRYo3f/r1wsa6wmC 1qaJ7vGasf9Gg220pbCNV9wb1xa7Q8y4GeqrAFSu2eLIPNi+NMdZpWvGdYzJFv9F2TGR DhDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iu6p7yAg; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-153475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q25-20020a63f959000000b005cdfa6ec001si7872884pgk.380.2024.04.22.07.01.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:01:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iu6p7yAg; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-153475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4342CB20ED1 for ; Mon, 22 Apr 2024 13:42:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 682BF14F9FF; Mon, 22 Apr 2024 13:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iu6p7yAg" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AA6B5028B for ; Mon, 22 Apr 2024 13:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713793340; cv=none; b=ncs290V//nuAT8v11PWJfjM+tlb1Afi2wD9z10AutwC459yl99qi7kySh2awjOVO7+YN1mraOrOHfF6dPqIfVOmoKtrOca1RWMHQk6eYeguQcW7kAayJ9hV8R5kxwWRdjrc+hm3dyWZL925xBEdUgc/KQRpCelrrust7BJ12JP4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713793340; c=relaxed/simple; bh=2hQwBEpW01jp8qra2jvf/jNfR8J7cPQJApPJeAmp3hA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pZ0qfyDFhDiIt/RwO1EJLLt5LMJ18n+YyvXlGFts/G1sFpgrIZIixCHlCf/ioU65Qxq1hhu757uGxhh9I4P37y3B8nY3bgGrmVngDz/lIcW/FlxWpXiHFVUPI9BlSzucKM7Ik1vP5+skPELBSSBSxQHpQ7U/jTwNPUp4mUHq3z0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iu6p7yAg; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713793338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DjWK16yEpG2qC4sEpfQe3ru9FwvfTS+uslLAL5h78t0=; b=iu6p7yAgrFB/VWsW31UQD5c1uukqz2RiNfI/FZZnhy3iyVFRdzzjxM5PAwvcfNgqcxxWZQ /v47qcFf9y6G54f5bsk++8Tifv28o9tvLuOEFDaCE4G1WS11A63OslUwCtLSkXQyFGXbD7 jkC0iTj5IthxtmwZacHVgNPyTTMJeXw= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-dCFO5pkAPeOsrMvUykCeQQ-1; Mon, 22 Apr 2024 09:42:15 -0400 X-MC-Unique: dCFO5pkAPeOsrMvUykCeQQ-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a572ceb5340so30754266b.0 for ; Mon, 22 Apr 2024 06:42:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713793334; x=1714398134; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DjWK16yEpG2qC4sEpfQe3ru9FwvfTS+uslLAL5h78t0=; b=Yx5UIgFWryf7of/sOS5ooKerGXV0YPDKOaGR72y+wJmPgYBHluBPIx8LeTs84XyeGi bY/h37/jqMNr7wi3sR6cJeFpB/y9xx98d83hmylQXsM7ew8JDNP0L7U7l2S0SJpx0NB+ 0ijG5oO/R4NKYHa9TxOD0V4yzvs0ZqwsGRWlvlWM24/qlURFaBtDhOLjzK+UEhH0qNTS dp/Rn1GSJ+cAtsm0PDl65O578BRdpb2n/+2EVTZB8p+CX2N7kdfXyx1m2zYWsu1v5RZz 8hmXhlc8LYXv15eUc8b1557VadGCsUTxN6dXLhoWys0+5aJs+ahWYEKYzwMjP0KtZlxO cWyQ== X-Forwarded-Encrypted: i=1; AJvYcCW787RfFiJ1u5qB30Z5rv6uxa9wcL4lHprtoCAGVjV/UbAR7uXSwdtewMT2aysYjAhyn6Q9x5LPdTU3nxg2pzt+ZAZn2KzaqoKIHug5 X-Gm-Message-State: AOJu0YwUNVFWH4xbWpbFr8AqZkqvOlkqBV4V53x4W5rpMtjTldPV8twY Hh4y0MxJIaes4E9HXpLEgkPyoX/tsGTXYF8XV7laGQJWd/VseKSX8EC8v7cEnf67L9uBOkrGsDn spGGb2pwGcXE0rM3BiQj9D3ybZylPV51npHrevoD8xMVshnUourbGs+kQt0fUbw== X-Received: by 2002:a17:906:c79a:b0:a58:7192:8fbe with SMTP id cw26-20020a170906c79a00b00a5871928fbemr405956ejb.60.1713793334614; Mon, 22 Apr 2024 06:42:14 -0700 (PDT) X-Received: by 2002:a17:906:c79a:b0:a58:7192:8fbe with SMTP id cw26-20020a170906c79a00b00a5871928fbemr405945ejb.60.1713793334372; Mon, 22 Apr 2024 06:42:14 -0700 (PDT) Received: from [10.40.98.157] ([78.108.130.194]) by smtp.gmail.com with ESMTPSA id 13-20020a170906058d00b00a522d34fee8sm5759717ejn.114.2024.04.22.06.42.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Apr 2024 06:42:13 -0700 (PDT) Message-ID: <3db76d62-114a-4703-ac88-8e1f26791a36@redhat.com> Date: Mon, 22 Apr 2024 15:42:12 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] platform/x86: samsung-laptop: Use sysfs_emit() to replace the old interface sprintf() To: yunshui , linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: Ai Chao References: <20240419064106.2396705-1-jiangyunshui@kylinos.cn> Content-Language: en-US From: Hans de Goede In-Reply-To: <20240419064106.2396705-1-jiangyunshui@kylinos.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, On 4/19/24 8:41 AM, yunshui wrote: > As Documentation/filesystems/sysfs.rst suggested, > show() should only use sysfs_emit() or sysfs_emit_at() when formatting > the value to be returned to user space. > > Signed-off-by: yunshui > Reviewed-by: Ai Chao Thank you for your patch, I've applied this patch to my review-hans branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while. Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window. Regards, Hans > --- > drivers/platform/x86/samsung-laptop.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c > index b4aa8ba35d2d..3d2f8e758369 100644 > --- a/drivers/platform/x86/samsung-laptop.c > +++ b/drivers/platform/x86/samsung-laptop.c > @@ -661,9 +661,9 @@ static ssize_t get_performance_level(struct device *dev, > /* The logic is backwards, yeah, lots of fun... */ > for (i = 0; config->performance_levels[i].name; ++i) { > if (sretval.data[0] == config->performance_levels[i].value) > - return sprintf(buf, "%s\n", config->performance_levels[i].name); > + return sysfs_emit(buf, "%s\n", config->performance_levels[i].name); > } > - return sprintf(buf, "%s\n", "unknown"); > + return sysfs_emit(buf, "%s\n", "unknown"); > } > > static ssize_t set_performance_level(struct device *dev, > @@ -744,7 +744,7 @@ static ssize_t get_battery_life_extender(struct device *dev, > if (ret < 0) > return ret; > > - return sprintf(buf, "%d\n", ret); > + return sysfs_emit(buf, "%d\n", ret); > } > > static ssize_t set_battery_life_extender(struct device *dev, > @@ -813,7 +813,7 @@ static ssize_t get_usb_charge(struct device *dev, > if (ret < 0) > return ret; > > - return sprintf(buf, "%d\n", ret); > + return sysfs_emit(buf, "%d\n", ret); > } > > static ssize_t set_usb_charge(struct device *dev, > @@ -878,7 +878,7 @@ static ssize_t get_lid_handling(struct device *dev, > if (ret < 0) > return ret; > > - return sprintf(buf, "%d\n", ret); > + return sysfs_emit(buf, "%d\n", ret); > } > > static ssize_t set_lid_handling(struct device *dev,