Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1660591pxb; Wed, 10 Feb 2021 13:36:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpEAVYI7arzJ8oHxzbXLDAVtZ/Lv47ILw3EerM/uNIdZZaOPr3g/KRCt9oIU/OeB6QJJiF X-Received: by 2002:aa7:c6d9:: with SMTP id b25mr5317199eds.84.1612992975842; Wed, 10 Feb 2021 13:36:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612992975; cv=none; d=google.com; s=arc-20160816; b=JKrqhUB+7ijDgYJZuaDY6yK31+m9qnwGgLaYCu1uuwLTtFj7TiRE1wTOYceUfEyQph tD0NZH1KCIZMi9/5dXRqDKDhN6h83TcQZdiLE6JbfgdCbcyKp7gAeBcqH28I5y2Rsuk5 M5rxIhwCovcUBC1avU6W8rxrFALvtZAHqGJ2iNfIU6VwlaZDRGi8vJ3+KXnEN0oSN/cB HhMuFcoNL/uPJdZAYB1nUW1K4z/hHDeueesEloP0pwvPwdFkUyMOX8tEVrC6+H3pUTlP yB6jBjS6Y7Wi2fWxsMWRd9ujQwuCyhKImeGMbTjlMjdOhAMsfZEJZuMOut5LEz1V/zyy pjyg== 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=qvqSlhch54qKd6Z/euk8bPQFbQJTiG8Sl5LeBocD2oY=; b=G6pSuO79z23pCHIJUp3qINO/kxzpbc3lP+NMxQ7GKqoLMvnu3J2K9Oryxcfdqm25yg lpOx7FkT4Go1t3FisrN2SqYx1rmXrPqPM77uQvS+ecQJNbHr75yvv4AnUyclGFtJwE5H z31DpgVzTJG01Kku2jl3Z0ykNUPASogfKTC/h497T3gPizjWIW/rIyHB05LJBGkMBozf dQVRF3E3OkwC9C0ggHOKsQK34tZ9Cg/cUrnHG81ejFmAc6KknnIBssmygXc/vF3SpynN /3J0H1GaEMuLWwc2K0/VynmSSO1Aj4eiz+mhkA+9asy6sraTF1QWsHyWLjcz9YggSXWp vuXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@beagleboard-org.20150623.gappssmtp.com header.s=20150623 header.b=ewq2ZJYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si2045183ejf.749.2021.02.10.13.35.50; Wed, 10 Feb 2021 13:36:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@beagleboard-org.20150623.gappssmtp.com header.s=20150623 header.b=ewq2ZJYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232318AbhBJVfP (ORCPT + 99 others); Wed, 10 Feb 2021 16:35:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232097AbhBJVfN (ORCPT ); Wed, 10 Feb 2021 16:35:13 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D493DC06174A for ; Wed, 10 Feb 2021 13:34:33 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id fa16so1898742pjb.1 for ; Wed, 10 Feb 2021 13:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beagleboard-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qvqSlhch54qKd6Z/euk8bPQFbQJTiG8Sl5LeBocD2oY=; b=ewq2ZJYkhG+l2oxZATjN/3r6VnQhfS6os6buQNGLgJILEcHKR57DuF1R8nNJeTnh1s Jw3EgkrinW9DWJUpOBAwiffdCrjbWfXsfJdH3gENyl1ZzpEFTYx7gkEXi8Xk7l4ywNxb f9bduu2eqMOXwg4OH3HU0KbQVbKH4+pIXwCc2sxtYqlSwOIaDHrxBC5y2tsYLEyabNB4 Xoz5XBCTb7DdKY6zRVEt1+jfxWjeOoKjb2uBbMLnhGZ8KPN70nKRlweduw2sXGXrhDaf aFyx7LErt0+Nz5RHgGCJ9+T60bGT//irI4MGgwrsVa6UbhMpHtgtcq4fQ/BkS3iLbpDY LJpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qvqSlhch54qKd6Z/euk8bPQFbQJTiG8Sl5LeBocD2oY=; b=IdcJzG6S53HzZSVb7zKv6VrJSuYH2a2AzQLUipJowvsdvG/fUyXSICvAziLSi54yl+ /vqScAnapO+G1HCTgxk21sEmKFrUHqqkn9PjI1NYBJI4ni9zYaP2Uzqz7eHHMwICqWD7 rLMS3T2ZZS90rqf2USckFqs+1sDLNEc8Kk+bxqy5BthM7e/OBi/TZeIx3r3oKkXQh0c8 ZUnI85IcDeUfPWtiLMQYFgVgWpL6jbvwppOHPrApyTNS4p9ZitET04GoteZNwpWLn7fh Oiu/vgcByf8+gntXzR6u+xmHs+lMh/bHh2wzoodWUt25lfljINTAeNC47x1mNcbaHgPe h9Ew== X-Gm-Message-State: AOAM533rsHDWwfpaMoFVhO+vc3P1z2whNusTRQUD8kjyo0oim8ltKr7q dyFsC4Dn3FVcP+FKwcYgd/sO/w== X-Received: by 2002:a17:90a:f497:: with SMTP id bx23mr875535pjb.170.1612992873373; Wed, 10 Feb 2021 13:34:33 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c0:4701:ae70:7b19:df69:92d6:528e]) by smtp.gmail.com with ESMTPSA id h8sm3006928pfv.154.2021.02.10.13.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 13:34:32 -0800 (PST) From: Drew Fustini To: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Lindgren , Andy Shevchenko , Alexandre Belloni , Geert Uytterhoeven , Pantelis Antoniou , Jason Kridner , Robert Nelson , Joe Perches , Dan Carpenter Cc: Drew Fustini Subject: [PATCH v3 0/2] pinctrl: pinmux: Add pinmux-select debugfs file Date: Wed, 10 Feb 2021 13:34:18 -0800 Message-Id: <20210210213419.227285-1-drew@beagleboard.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series first converts the debugfs files in the pinctrl subsystem to octal permissions and then adds a new debug file "pinmux-select". Add function name and group name can be written to "pinmux-select" which will cause the function and group to be activated on the pin controller. Notes for PATCH v3: - add Suggested-by: Andy Shevchenko to the "pinctrl: use to octal permissions for debugfs files" patch - change the octal permissions from 0400 to 0444 to correctly match the symbolic permissions (thanks to Joe Perches and Geert Uytterhoeven) - note that S_IFREG flag is added to the mode in __debugfs_create_file() (thanks to Andy for highlighting this and Joe for suggesting I should add a note to the commit message) - fix order of the goto labels so that the buffers are freed correctly as suggested by Dan Carpenter - move from devm_kzalloc() to kzalloc() as the buffers are only used inside the pinmux_select() function and not related to the lifetime of the pin controller device (thanks to Andy for pointing this out) - correct the pinmux-select example in commit message to use the function and group name instead of selector (thanks to Geert) Notes for PATCH v2: - create patch series that includes patch to switch all the debugfs files in pinctrl subsystem over to octal permission - write function name and group name, instead of error-prone selector numbers, to the 'pinmux-select' file - switch from static to dynamic allocation for the kernel buffer filled by strncpy_from_user() - look up function selector from function name using pinmux_func_name_to_selector() - validate group name with get_function_groups() and match_string() - look up selector for group name with pinctrl_get_group_selector() Notes for PATCH v1: - posted seperate patch to switch all the debugfs files in pinctrl subsystem over to octal permission [1] - there is no existing documentation for any of the debugfs enteries for pinctrl, so it seemed to have a bigger scope than just this patch. I also noticed that rst documentation is confusingly named "pinctl" (no 'r') and started thread about that [2]. Linus suggested chaning that to 'pin-control'. Thus I am planning a seperate documentation patch series where the file is renamed, references changed and a section on the pinctrl debugfs files is added. Notes for RFC v2 [3]: - rename debugfs file "pinmux-set" to "pinmux-select" - renmae pinmux_set_write() to pinmux_select() - switch from memdup_user_nul() to strncpy_from_user() - switch from pr_warn() to dev_err() [1] https://lore.kernel.org/linux-gpio/20210126044742.87602-1-drew@beagleboard.org/ [2] https://lore.kernel.org/linux-gpio/20210126050817.GA187797@x1/ [3] https://lore.kernel.org/linux-gpio/20210123064909.466225-1-drew@beagleboard.org/ Drew Fustini (2): pinctrl: use to octal permissions for debugfs files pinctrl: pinmux: Add pinmux-select debugfs file drivers/pinctrl/core.c | 6 +-- drivers/pinctrl/pinconf.c | 4 +- drivers/pinctrl/pinmux.c | 111 +++++++++++++++++++++++++++++++++++++- 3 files changed, 114 insertions(+), 7 deletions(-) -- 2.25.1