Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA81BC433ED for ; Wed, 7 Apr 2021 09:27:31 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A2AE61394 for ; Wed, 7 Apr 2021 09:27:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A2AE61394 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=foss.st.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6kYCd1Ik0g0mjwbcUqRJbjUwTJE57g3jms7K7PF6epU=; b=aIY1s4OqkLK1ztRXOkj4LN6nH pnOtKmmV5foztuhMnfXxbe0iQkaoastdE0Zkbug0QJQHmOEgJhn/ED/WMttIBXF4dOcD1Tf0zqkBs IX9VB1FMfVrUwJiDyb3pEdgjk9PwT/4z2jBwnRV9d6ac1GxZMrVRMFIF6WNjaikRPgVnLLL9fY3Fl X6SGWJRgvGjbsmBnJOt67CeqkEGChmESmZmTFhsGR9B9bLLSBsnbuNVa5asY5bJNyUHWg4/AHqu5c Zw3UL9Odp+/8RU2UT/Uvh0usicfjAWZmKME9YfIOpMStpTBc7s4l4g7Hs5TiIRxerrW+poD93tafY s7a5geiLA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lU4R4-004bHa-BQ; Wed, 07 Apr 2021 09:25:18 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lU4Qy-004bDt-Rv for linux-arm-kernel@lists.infradead.org; Wed, 07 Apr 2021 09:25:15 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1379LZaf004981; Wed, 7 Apr 2021 11:25:06 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=haSkKflyhulunAGGrOOIAsB2FDvMs1StPWjwpR2BzWc=; b=nesC2jeMj4MRa05JVrSgXU31cTSvls/KnMBVAP6bRNBTarlPmwCNPip0e7XmZc+l2WAI Q2YubDIiSZPNHZyRRwcJTrrV8t7yzljzP6nEcqG1RjpgZQkE4vbEZRy1W5beNo455MDt NsBFNOToR08AafKt3tdMTiqjTnP1Dz19tI+xPOWQ3dX/IbdgqHnNekBDn+8J62dHUvIn 3SqHfg/yigrq8vUMGTcnFNicpSAcSCgojkr9TSHsbH4KoktQyLqkBapXp7OqNvVRr52I RSjo0Oy0siEmgb97VaxORyPBlN8R3lMsi18ECSneCJb7qeBusPi4BgbO3ODhs10RbU+m PA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 37rv973we6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Apr 2021 11:25:06 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7EA3810002A; Wed, 7 Apr 2021 11:25:05 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 67D7921CA61; Wed, 7 Apr 2021 11:25:05 +0200 (CEST) Received: from [10.211.6.162] (10.75.127.48) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 7 Apr 2021 11:25:04 +0200 Subject: Re: [Linux-stm32] [PATCH] pinctrl: stm32: Print invalid AF warning inside stm32_pctrl_is_function_valid() To: Marek Vasut , CC: Linus Walleij , Alexandre Torgue , Fabien Dessenne , References: <20210406180035.279249-1-marex@denx.de> From: Fabien Dessenne Message-ID: <1e7d6e0c-1f7a-e7ca-dda9-d659f3ff744a@foss.st.com> Date: Wed, 7 Apr 2021 11:25:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210406180035.279249-1-marex@denx.de> Content-Language: en-US X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-04-07_07:2021-04-06, 2021-04-07 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210407_102513_271297_DD02945E X-CRM114-Status: GOOD ( 24.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marek, Thank you for the patch! On 06/04/2021 8:00 pm, Marek Vasut wrote: > The "invalid function %d on pin %d .\n" message is triplicated in the > driver in different variants, just pull it into the function and have > it once in the driver. The bonus is that all variants of the message > now print the pin number and AF consistently, so it is easier to debug > such pinmux problems. > > Signed-off-by: Marek Vasut Acked-by: Fabien Dessenne > Cc: Fabien Dessenne > Cc: Alexandre Torgue > Cc: Linus Walleij > Cc: linux-stm32@st-md-mailman.stormreply.com > To: linux-arm-kernel@lists.infradead.org > --- > drivers/pinctrl/stm32/pinctrl-stm32.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c > index da72e3e5c08d..ad9eb5ed8e81 100644 > --- a/drivers/pinctrl/stm32/pinctrl-stm32.c > +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c > @@ -531,6 +531,8 @@ static bool stm32_pctrl_is_function_valid(struct stm32_pinctrl *pctl, > break; > } > > + dev_err(pctl->dev, "invalid function %d on pin %d .\n", fnum, pin_num); > + > return false; > } > > @@ -545,11 +547,8 @@ static int stm32_pctrl_dt_node_to_map_func(struct stm32_pinctrl *pctl, > (*map)[*num_maps].type = PIN_MAP_TYPE_MUX_GROUP; > (*map)[*num_maps].data.mux.group = grp->name; > > - if (!stm32_pctrl_is_function_valid(pctl, pin, fnum)) { > - dev_err(pctl->dev, "invalid function %d on pin %d .\n", > - fnum, pin); > + if (!stm32_pctrl_is_function_valid(pctl, pin, fnum)) > return -EINVAL; > - } > > (*map)[*num_maps].data.mux.function = stm32_gpio_functions[fnum]; > (*num_maps)++; > @@ -620,7 +619,6 @@ static int stm32_pctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, > func = STM32_GET_PIN_FUNC(pinfunc); > > if (!stm32_pctrl_is_function_valid(pctl, pin, func)) { > - dev_err(pctl->dev, "invalid function.\n"); > err = -EINVAL; > goto exit; > } > @@ -821,11 +819,8 @@ static int stm32_pmx_set_mux(struct pinctrl_dev *pctldev, > int pin; > > ret = stm32_pctrl_is_function_valid(pctl, g->pin, function); > - if (!ret) { > - dev_err(pctl->dev, "invalid function %d on group %d .\n", > - function, group); > + if (!ret) > return -EINVAL; > - } > > range = pinctrl_find_gpio_range_from_pin(pctldev, g->pin); > if (!range) { > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel