Message ID | 33cd8f96-4b4f-4741-ac05-ef1bd267ce6b@p183 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-52387-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp780768dyb; Mon, 5 Feb 2024 02:18:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVQt2GPNn7a3sUDJigTiXRaFdGeg8hgbFAqm75Ke/W6pIx37+HlfV5R1RdvCF+oI5RmJHH X-Received: by 2002:a05:6870:4727:b0:219:231c:1e34 with SMTP id b39-20020a056870472700b00219231c1e34mr6790843oaq.15.1707128293186; Mon, 05 Feb 2024 02:18:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707128293; cv=pass; d=google.com; s=arc-20160816; b=0YPUxtz0GN8EuSnexvdsWcBgfiJrpfwUhSkIyQ+zqh3rtHjEfK1eoCt0U5Jetsznrd BoQEIKJ1KMnGHff2SeEwjRn0sbGRrVIHeZQOTNfSL4O+qCwxjO4jtyFm1NQpTp5u8D6t 0+xVMwmsvF1hujXW9ISFbFOD44V0+K7vnpi9S/FPJrRlzhVLEuVGv62pQ4ykFKGqIrfV Q8wC/SQ+QBrOhIRf4++c9LpsaXLIpkKisYn7U4md/khIW64RBju0+Kaqymic+1ojer4H 73Xh7S8WPIiR5A0Z/POvmORYz9uQzxFyLwbxDtPkVJjht1kfNKvwk55FRHWMzru13uPF KHRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=fx6SHSzTyrYuQWTW6XOrFFYgXM0nYIj9ZDGPGiFkmuk=; fh=Cs5glWbmOG456kDWCMa8caGYi/yVs2hi9FZUJPW97xA=; b=BBU64Q9j+Axl7Fn1k4YrmmsqtXP0kzkb2qdCSVPwpSJNYjZqbBKmu1QnaL/Ia5EHTX rb8BUeDlK4ZDbK0dCx1lieMCvLdIgL5hKeY6iWrM1IBnRDkT7viJDLtnMYeaBJaRrm86 3RB5sd1lsY/ojK353cuilhkMvTXcQBW9/j2gV+jvcIFffPs/KqFQDCZxwOuYukcdIVwB mQ+VPWWcCJFLlWEA7lExoy9XvzEkw7x03WgVTR0/uGCSSupSwVo0tkxz2ga3sNUSrx7t cNuosyQEcvLKY2LS0x2gDyyvZBnfwCP+kJGJagGVSNPxhhjyi/+wQ/fQeIHxGp9vvZ7a BmPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kAyDVk2y; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-52387-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52387-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCX5SdFSEzuOQPVEQwjkwpNIJzjMyVdEVcIQ5iY0pJw8iZNkD5WMa8bAdu+3TRPUrZ7ymo/gz6zgw6ihbLD+NFh6VoT5OA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 32-20020a630b20000000b005d2520bdefbsi5836978pgl.208.2024.02.05.02.18.13 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 02:18:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52387-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kAyDVk2y; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-52387-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52387-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DA5F628A889 for <ouuuleilei@gmail.com>; Mon, 5 Feb 2024 10:11:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A9BB171A3; Mon, 5 Feb 2024 10:11:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kAyDVk2y" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AF5A14AA1 for <linux-kernel@vger.kernel.org>; Mon, 5 Feb 2024 10:11:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707127901; cv=none; b=E8ljD+YA4QVC8nhCvfT9mKeBrVYBovjwleqhzEFdW1KkDstH9xd/+3D2LRUjRyRxdOKDSRVQjBYUYay2uBwbWeuzJWUGnUD4Xsoif+Xjw5uKb6BBoFMQvvQ+LszXRvE1mXw6rNkFjAdcLYii+QHc1Ul3fojR8/H6gk3sq2Ft+5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707127901; c=relaxed/simple; bh=1JXPf4IxvAnsYNQKuCSuwWhoBI3O9aaNpBx6WWZQ3rA=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=XkWH3oovJFnTeQEEkHxGAbIeR8zOxAo1Hvd3NhU+1tABJxTOgw/8WFCBNLbLPEUp6ssp4Z68/YWG90MqbnRqKDfQ25f0xIKNCRuO7qCooMb4Lg+IaImo/LpXfDjAOTyvoZjtN1A4IyxJETrNwZjUh1PZchwb0s74LCmMgYDyaNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kAyDVk2y; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40fb3b5893eso34714005e9.0 for <linux-kernel@vger.kernel.org>; Mon, 05 Feb 2024 02:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707127898; x=1707732698; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=fx6SHSzTyrYuQWTW6XOrFFYgXM0nYIj9ZDGPGiFkmuk=; b=kAyDVk2yvSM+z5o8T285wadf8XN6Bj+5StB8QkB1psTG2lownPwnTXrVjjVSkB1iN0 Dq1guiejFEejk4nE5vH+rlsKQiWIt+VolcLxXQMoV6l+jrG1WMwBJmrCU5Fpilc6bCa1 2JPpFn5VUxSaLHo5RJcazbW5RP9o/tWaDxTK+tvGWCDOY8u/3gyHYKQCgWPBNfLaPhO7 vwErAy7oGqRDyKMzm2oLHgAFntNsF1AqognzHF+LFMIztGGs99yiWh0j55S/ZWWtmzK7 qjuBiIb/FCnn6I51n7lmVBoJhBLUtq6PYFZAybT7sx4T0xGqC0cyaLVsyYuA4VQv0noE Nh/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707127898; x=1707732698; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fx6SHSzTyrYuQWTW6XOrFFYgXM0nYIj9ZDGPGiFkmuk=; b=EMEL8auDh5Zl/UBO/LqY5cyGoh7r9DHNzx9JVD/X6fldnNNmu1QE0JYf6LEy40iMxz 2XaHNh17Y8+1WWriwuHZD8pKNeQk/ieTipcS3vl/fQnLUHy9f85s08OLY8VgoHzMnvht FrjFF919lyfYbpBFu6Y6RSIKSx9IDFidSd/AzgeWK1ZG2LtwJQcEoXYvueLe7bI8wzdu 8HPxuFrRmJkYrlPdgHK9kPJ5ezug3l3r+BXg1BghJ7t97ikl3CahXZtjo6inDZR9DuGY q6c4gjRsI5Td1JSzztAvN2Qk4qEqodIYY7379hj0IWHb/v2ijvWjitr0rsD29+tgpV9E vtqQ== X-Gm-Message-State: AOJu0Yzu9x/kFSlH2mx5RzNvtN5M8FlymnKqJenSk/1x6iwBG8R21P+/ U6IxNxRao/AyD5dJx/7j3BCI61fWCkkyjrdC0XGLkjyV5gdcVmr4TOfIscRo+A== X-Received: by 2002:a05:600c:458f:b0:40e:8fe8:a173 with SMTP id r15-20020a05600c458f00b0040e8fe8a173mr3998054wmo.4.1707127898379; Mon, 05 Feb 2024 02:11:38 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVM0bf4J8+2x3kdZCfKFeSGp2Batbc39r7onq2ybFrUR9DzmAH+Mq4v4ybCLYMEDvuM/cjGFeug59/5hGCiY4bhb0jSZAWVAGgIV4Qz Received: from p183 ([46.53.250.163]) by smtp.gmail.com with ESMTPSA id b5-20020a5d4b85000000b0033b41af645asm673647wrt.108.2024.02.05.02.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 02:11:38 -0800 (PST) Date: Mon, 5 Feb 2024 13:11:36 +0300 From: Alexey Dobriyan <adobriyan@gmail.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Rafael J. Wysocki" <rafael@kernel.org>, linux-kernel@vger.kernel.org Subject: [PATCH] sysfs: make sysfs_emit() return ssize_t Message-ID: <33cd8f96-4b4f-4741-ac05-ef1bd267ce6b@p183> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790053757039126035 X-GMAIL-MSGID: 1790053757039126035 |
Series |
sysfs: make sysfs_emit() return ssize_t
|
|
Commit Message
Alexey Dobriyan
Feb. 5, 2024, 10:11 a.m. UTC
sysfs_emit() is most often found in functions returning ssize_t
not int:
static ssize_t oops_count_show(...)
{
return sysfs_emit(page, ...);
}
This pattern results in sign-extension instruction between
sysfs_emit() return value (int) and caller return value (which is
ssize_t).
But it is better to do sign-extension once inside sysfs_emit()
then duplicate it at nearly every call site on 64-bit.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/sysfs/file.c | 2 +-
include/linux/sysfs.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -739,7 +739,7 @@ EXPORT_SYMBOL_GPL(sysfs_change_owner); * * Returns number of characters written to @buf. */ -int sysfs_emit(char *buf, const char *fmt, ...) +ssize_t sysfs_emit(char *buf, const char *fmt, ...) { va_list args; int len; --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -356,7 +356,7 @@ int sysfs_group_change_owner(struct kobject *kobj, const struct attribute_group *groups, kuid_t kuid, kgid_t kgid); __printf(2, 3) -int sysfs_emit(char *buf, const char *fmt, ...); +ssize_t sysfs_emit(char *buf, const char *fmt, ...); __printf(3, 4) int sysfs_emit_at(char *buf, int at, const char *fmt, ...); @@ -607,7 +607,7 @@ static inline int sysfs_group_change_owner(struct kobject *kobj, } __printf(2, 3) -static inline int sysfs_emit(char *buf, const char *fmt, ...) +static inline ssize_t sysfs_emit(char *buf, const char *fmt, ...) { return 0; }