From patchwork Mon Nov 14 17:00:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2253554wru; Mon, 14 Nov 2022 09:03:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iXXZmDCWc4E1IWiVrQ2MiPFMc2AcTYawgudGY/CG2ksIHEsRZhXWAk7xEN7+MGcbgFvGp X-Received: by 2002:a17:90a:5801:b0:209:46fe:871b with SMTP id h1-20020a17090a580100b0020946fe871bmr14647956pji.163.1668445401921; Mon, 14 Nov 2022 09:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445401; cv=none; d=google.com; s=arc-20160816; b=XYbpFV/Ki710spWnGdfJloRm0Vr95vTWJ+uuwq4YxT8ReBxjeUmzPy14ba1gC0Prrd ZW9HQ8piKqDR3wL8yjOocZ2Tdvimc8ybqZl1OPxN7ey9Z/1UddwR661QFDHC0TXb0Lbg YCcqHLzUjSM9agRRXEbm1NM8SYwODoPzsw9QpY3hEd7NEgg/9zwTu9vUivVY1L4EARvd nZlQYk1NAMqS+JyvO4iKFTQwhE83mGVPwHMbG/J+a2u7N+kTWsRyHXByUcp0olnQTrlY Fjyn4set0pde1s8AmKOLN36hr4R78Vw32TPQgRVrrOcX15gbKO3UnmsvmJr1/vuit1ZU K2vA== 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=W7LSw86hdWHXCbVrd8DpylXy5x03GJG2MtwYWbSM/6U=; b=kWHhnp83+Yb3LLjjbswqtJkE9fzI217lQYWfvNWs8KHb/pjO/0c39d4SdsKznh+/2A xygeAk8nUxjRZRq11qQRP2fSfPsN4vO+UlDE4zxywUIqxHeO8Jqtp8DCGok2+kKw9UzT eV4MTWbKW4wDPp/glVBlEAbNj0ZmEni49CN8R+vDVUo+b/EEvMuZsfgUhoPqUMbcozm2 of2hEVT1CJ124VZHPJ7jAVMypj9Lg5pKmLNEZ5U1RhL9jgq83E25SZpDsiEu7D+l8tgC gzGgA9KYIc3VHI+MY0OZxns3D/QHeKvpQtnSRkxDIW61h7Y4RAbiLs1CkuaXxSvHwL+F LIFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RWmd5IFZ; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a1709027c8c00b00186e9ff4edcsi9162592pll.408.2022.11.14.09.03.05; Mon, 14 Nov 2022 09:03:21 -0800 (PST) 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=@intel.com header.s=Intel header.b=RWmd5IFZ; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238139AbiKNRAx (ORCPT + 99 others); Mon, 14 Nov 2022 12:00:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238116AbiKNRAQ (ORCPT ); Mon, 14 Nov 2022 12:00:16 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A516B31DE7; Mon, 14 Nov 2022 08:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668445184; x=1699981184; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=B3cccWBw0rMFOaKNnRwHvr376JFvt2Uj98KrwSkBaa8=; b=RWmd5IFZxSSLu3KpR4NPOjs0IiqHO+JbMH2N9ovQTSHeYdHXoxkMiBn3 uIOq7Elm+ptOkkKxyb0HFT+1Lz7aIG8ddgd74v2vUyJlQ/11M+zmGwzJy e/mottGIogrIf1ratkBzwyIXxHbfSh+P6BH9ddRggqxupWFoo9n6aterX 4cjNzFGQjneHoQ8hxBxx4VbTkL4LYLch+rqnKHysYpPfrYI59EkDNlMZh neUBtCgibp4435Z2krXvQDgz6iJoT81VRR5zwtrzi/6laKo8x8ibvpUMw ltKTZMPKNPu5LE3DoHsqIewkUYz8CBXD14gCbyUheTTfDx+YEVOiPMpOc A==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="313168848" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="313168848" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:59:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="727595259" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="727595259" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 14 Nov 2022 08:59:42 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E9D382F3; Mon, 14 Nov 2022 19:00:06 +0200 (EET) From: Andy Shevchenko To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thierry Reding , Andy Shevchenko Subject: [PATCH v2 1/2] pwm: core: Refactor pwmchip_add() to avoid extra checks Date: Mon, 14 Nov 2022 19:00:04 +0200 Message-Id: <20221114170006.61751-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749491805915818372?= X-GMAIL-MSGID: =?utf-8?q?1749491805915818372?= When we already know that everything is fine there is no need to use ret variable. Refactor code accordingly. Signed-off-by: Andy Shevchenko --- v2: rebased with dropped wrong patch (LKP) drivers/pwm/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index d333e7422f4a..855abd0a776f 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -296,16 +296,16 @@ int pwmchip_add(struct pwm_chip *chip) INIT_LIST_HEAD(&chip->list); list_add(&chip->list, &pwm_chips); - ret = 0; - if (IS_ENABLED(CONFIG_OF)) of_pwmchip_add(chip); -out: mutex_unlock(&pwm_lock); - if (!ret) - pwmchip_sysfs_export(chip); + pwmchip_sysfs_export(chip); + + return 0; +out: + mutex_unlock(&pwm_lock); return ret; } From patchwork Mon Nov 14 17:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 19932 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2254329wru; Mon, 14 Nov 2022 09:04:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf75uw9HzZE+tYdEMZAluhwMM9SA91L9+r97xctWEEwHyzcZzhOOcSqqGs4SsW/QjGlw1yeM X-Received: by 2002:a17:90a:a391:b0:212:fe4a:c378 with SMTP id x17-20020a17090aa39100b00212fe4ac378mr14770898pjp.82.1668445468698; Mon, 14 Nov 2022 09:04:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668445468; cv=none; d=google.com; s=arc-20160816; b=wJiiMkbgRbY15Rt23CXLG34CgJ20MeGmTFYE29f2nKH1+J742+daA26EjpRKCT/+fq s9tJMJZc8G0ETFt1zvduYGpFpkbqdoNZFtcEo0TzQshqG+v3gquNNfQ5/Wtl7dWNu95m g62ovGjW0wDiY7ncgJIdIKJjW+FN0wL7+ImkEHZ8e+clKGAnW+8daZZL/wBH8j+orIGo sQJ/pIaLyli4mOfdpUr6PDqIPpW+rkWbRRSpFb+bRRjZQUzEJYMMLHMCgq41FDvh14/E MduPW9Geel0hohXGZlmMw+mJv4Ba4oIVCGTQ1vLrWlNZ//xw68kL9kNZhvWcQvr0jBRh lUWQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U1J+HPoKoCJ7qI6V/Vuk0ceZl9b/hotgwXEJ6KKlbL0=; b=QAZYWa6SSNZ/nTRsr5mBH3PdnOP1exZpC/E8IozoSwM5v7xfKDSEjCIesHEkL4JT/1 wYqAnnd7PONCqTlE2IqXCodaTX6o225H8d17L/OklnPFKWcEBWqgdCWspMkEyyTkDEYP j9HmL4aHDO9twzZg2IHJPR4TzqW1SPpbEboEH6EDRM7drZAdHPmmquv3eL5onKe/EU9Y KHRFKiZZZPEXfN8VQiAsc+v4Ca23pdivUCcOA2G2biWHYfV8e2x96g+FXXUq6p//hJ60 jU7ybMVwiDCoEdF/rvkgGqqVzeHTJzDAPCleCDaqSbKFduzmA9ZxpIaAb8+11u9XQSP6 KX2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dJ1sGb7V; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a170902a40300b0017c0d822437si9052878plq.82.2022.11.14.09.04.14; Mon, 14 Nov 2022 09:04:28 -0800 (PST) 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=@intel.com header.s=Intel header.b=dJ1sGb7V; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237735AbiKNRBB (ORCPT + 99 others); Mon, 14 Nov 2022 12:01:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238166AbiKNRAd (ORCPT ); Mon, 14 Nov 2022 12:00:33 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1716B22; Mon, 14 Nov 2022 08:59:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668445191; x=1699981191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=epLPs0koHWXMcPOrbhPMFM2RiIGVQ5fe2evVJvud0Vs=; b=dJ1sGb7VtZPHL+6h7CYo7Sezm7g0lKEzDAEldEXw2xbznbhJILJlk/kW gQ7t5L9PUTt5Sjrf03OZONJ6TBPmCdyB5DqU0JiCGTLsPm57O+gsEZTiX 8O9rc9JZmMAfuTEodmgVWpWpZpbJDIXLGQGQz1PwCKLSr7MfLEZbhy6x6 VJkMf/Z7m4fGSM9QC9VdnNJSSYina2NxiQo1UWMl4+PYBCQ6nGZylXvtF F+Oxjpq1mLv49pl/E5fDVQBkQBa0+TBQWicbz3dtUZDrEgZYgWY44CSG+ +Bx/o/VQvCX+ygrYO0Lie1PZJPMRnXYigOtqKJsL0XQwN8yFyzQlQwQaO Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="295384258" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="295384258" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:59:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="780997746" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="780997746" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 14 Nov 2022 08:59:42 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id F2CCFB7; Mon, 14 Nov 2022 19:00:06 +0200 (EET) From: Andy Shevchenko To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thierry Reding , Andy Shevchenko Subject: [PATCH v2 2/2] pwm: core: Remove S_IFREG from debugfs_create_file() Date: Mon, 14 Nov 2022 19:00:05 +0200 Message-Id: <20221114170006.61751-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114170006.61751-1-andriy.shevchenko@linux.intel.com> References: <20221114170006.61751-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749491875802605937?= X-GMAIL-MSGID: =?utf-8?q?1749491875802605937?= The debugfs_create_file() already has a check and adds S_IFREG automatically. Remove unneeded flag. Signed-off-by: Andy Shevchenko --- v2: rebased with dropped wrong patch (LKP) drivers/pwm/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 855abd0a776f..8f5cb665940f 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -1179,8 +1179,7 @@ DEFINE_SEQ_ATTRIBUTE(pwm_debugfs); static int __init pwm_debugfs_init(void) { - debugfs_create_file("pwm", S_IFREG | 0444, NULL, NULL, - &pwm_debugfs_fops); + debugfs_create_file("pwm", 0444, NULL, NULL, &pwm_debugfs_fops); return 0; }