Received: by 10.223.176.5 with SMTP id f5csp1458524wra; Sun, 4 Feb 2018 04:37:04 -0800 (PST) X-Google-Smtp-Source: AH8x224qR0JcVnYpiXWpfUuSoy+1rfLnNZxserQtoUbTL8PPoylv1bR9Z0d3LekX/Jmeh/KjBMAl X-Received: by 10.98.7.207 with SMTP id 76mr44831960pfh.130.1517747824723; Sun, 04 Feb 2018 04:37:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517747824; cv=none; d=google.com; s=arc-20160816; b=noiTE2I/C8OBLmboGf2Ts1NBSFWz2p/wp5Ns0NGOvZUjw9IfWxYypD7Lka/kLP5uPb 2sQCAlg1MpuAb3401FXUMMcpaJb4BtUDuMqcaHqrZ46t6yLdjF9OuKxAhJHdQ2JIj6NV /mY/FgmHJ6BUCWZ5m9FTJCyXbNkFE4QOfx9Nuos8+IINUT/xcvdVXs5FCDgSCGP1T1rB wHJhYg0UE69B9LW69KSFhoyZORjxzPyv7V/kBn3YI3n6KVx2qG7sh2nRxYGjgeuwn5Vx WhwQjxumUMU5MS+TSOiXfGRoSwSDjrLeOOe25vsxMoTX9oXa0NanXiy+Ly+VAwmzBMc+ ASUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=mVQfBfR+zf92ciBEwY1wCurgLvK/UQZPtTbkawSvg38=; b=XSB3W4KRoWOERF4qam5bS6sjQsccWR4yImSHmPlgPW6w/Po79aWgJJImsaaL1izVv4 v0+VGtg/qPdfR4ujvfwOh+2yJp429PDs6uqWKuYRYV78Zu5gfnW6htW5AGTKLWWrjkQ/ u6ZjrDkG8RVnQl8clfY7yZ5lYMc4Zs3O0asD3N3vCAwTvwZMyEivmZZeS3+inuR7pRit GSB6flAeAA0DW0w5HZ28ySZnTCZgKqQPnnX7Xqa+xjWIIjRp/SJYXrNgdxOuzCm3XZRK AZBRZOwSfGTh0d9Ru4JtxWZCs5Vo4F6DNFuAfggUSurQ2gIQ+CwvlFj1nr1OCBEcMQyT MDsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si5258570pfj.60.2018.02.04.04.36.50; Sun, 04 Feb 2018 04:37:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbeBDMeJ (ORCPT + 99 others); Sun, 4 Feb 2018 07:34:09 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36712 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750802AbeBDMeD (ORCPT ); Sun, 4 Feb 2018 07:34:03 -0500 Received: from localhost (unknown [104.153.224.167]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 39280F70; Sun, 4 Feb 2018 12:34:00 +0000 (UTC) Date: Sun, 4 Feb 2018 13:33:43 +0100 From: Greg KH To: Stanislav Nijnikov Cc: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "jaegeuk@kernel.org" , Alex Lemberg Subject: Re: [PATCH v4 01/10] ufs: sysfs: attribute group for existing sysfs entries. Message-ID: <20180204123343.GA940@kroah.com> References: <1517501746-19075-1-git-send-email-stanislav.nijnikov@wdc.com> <1517501746-19075-2-git-send-email-stanislav.nijnikov@wdc.com> <20180201165923.GA12838@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 04, 2018 at 12:29:06PM +0000, Stanislav Nijnikov wrote: > > > + curr_len += snprintf((buf + curr_len), (PAGE_SIZE - curr_len), > > > + "\nAll available Runtime PM levels info:\n"); > > > + for (lvl = UFS_PM_LVL_0; lvl < UFS_PM_LVL_MAX; lvl++) > > > + curr_len += snprintf((buf + curr_len), (PAGE_SIZE - curr_len), > > > + "\tRuntime PM level [%d] => dev_state > > [%s] link_state [%s]\n", > > > + lvl, > > > + ufschd_ufs_dev_pwr_mode_to_string( > > > + ufs_pm_lvl_states[lvl].dev_state), > > > + ufschd_uic_link_state_to_string( > > > + ufs_pm_lvl_states[lvl].link_state)); > > > + > > > > sysfs if "one value per file", not "random text that someone has to parse per > > file" please. > > > > Huge hint, if you ever care about checking the size of the sysfs buffer you are > > writing into, you are doing something really really wrong. > > > Hi Greg > It's the existing code, added by: > commit 09690d5a6ae1b7e4cb5ac429c311b99d09352c12 > Author: subhashj@codeaurora.org > Date: Thu Dec 22 18:41:00 2016 -0800 > > scsi: ufs: provide sysfs attribute to select the PM level > > This patch provides the sysfs attribute to choose the power management > level for UFS runtime and system suspend. > > Reviewed-by: Sujit Reddy Thumma > Signed-off-by: Subhash Jadavani > Signed-off-by: Martin K. Petersen > > I just moved it to an another file and changed the sysfs entries creation by > Jaegeuk Kim' request. At the moment the entry shows the PM level, the device > state, the link state and all possible PM levels. Do you want me to change it? Ah, you are just moving this code around. Ok, that's fine for this patch, but please fix it up as part of this patch series because this isn't an acceptable sysfs file at all. If it were documented that would be a lot more obvious as to just how wrong it was :( And, as it wasn't documented, you can change it as it's obvious no one used it :) thanks, greg k-h