Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3684347imw; Mon, 11 Jul 2022 13:37:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s3mXpuJPO9SdzrYbzC83MviP8GcisvjtIfvl/7Q/xRoWzXPdToJi34q6PkAn5esVKumGtE X-Received: by 2002:a17:906:84f0:b0:72b:72b6:c7b2 with SMTP id zp16-20020a17090684f000b0072b72b6c7b2mr1926759ejb.642.1657571855524; Mon, 11 Jul 2022 13:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657571855; cv=none; d=google.com; s=arc-20160816; b=wXjsRzxO/g0WdFHu71cQZDsJCMIRB4OanzWmD8epS9e4SM9r9MRXqWbwzX2HrhWWjL yUfAokfj2R8LwXnRgFiWfmkvFTH+HKCklnFHSZ52GhqwXr0eiWhMEX2xd3urjOPaP/gY G+A35OB7KWhMR8Iw4SwJ1vuMzq1IA/V5yaLcxZSFJKgr7nNAAE2QOG9JReJkQBhuJbtK uKwHw8g2iBIuRmYQUK4bDrX1wWiuIUbgumhSbzU+RzlDyIjDk9ZAHB8bzBZlC28LgK1q A6TvyoabpJV8qJBBM9xnwMX2ixtXuNfP144EJ7vNggHmCiEg9LyuExe9KmSE7PLaONKp va4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=847p17DesiUPrAbTrGt+da4YJYmyj4ybBvLUVEuSIjY=; b=thg6UL7iIYpgs2KrohiAhoXTOlBfPm+m2dLvpCporQ3EccQfmGtzfom0hG5kZiboyg P4CdCWW0anVxI0QU9sSuDh1LRHyGfbbhskT5VjGfHRwVSsKcOU3ZVUxZoNSfreHrQ7DP JkHs88VjaqIOsBD77Okx0DDnBcMaBCU39YZ89xtbdmEy7jZSHCFcen8OiJnj1p/L6s/L QxWzgfSbFI2tYereLxjHr1M1mJ1uvDoRyRsy9k3dFdvBJ3p1oHtV6iVf0qJmyL8DZ8Sl FjTJf2UoufWbaVsDa7VR2f8i0xUfQPwno0ULFIdZFP6TgBXK2rSqUqLKf0MCpIkdGwRh SkRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=J4WttHla; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw37-20020a1709066a2500b00722668dbcacsi14188653ejc.575.2022.07.11.13.37.10; Mon, 11 Jul 2022 13:37:35 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=J4WttHla; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbiGKUdw (ORCPT + 99 others); Mon, 11 Jul 2022 16:33:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiGKUdu (ORCPT ); Mon, 11 Jul 2022 16:33:50 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1905D33404; Mon, 11 Jul 2022 13:33:49 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-31cac89d8d6so61444227b3.2; Mon, 11 Jul 2022 13:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=847p17DesiUPrAbTrGt+da4YJYmyj4ybBvLUVEuSIjY=; b=J4WttHlaqvEgBfuXBOlq7Cn8H1LHHBEHnfD+usVNNf3XdpUKSGcz8IGIC0CH1Yfmol kUpd0qMrcglCv7BVwhQ7brGk96fa5ovV5b6TzmWIVXjV4xgrpuznHRCgtQRSzXPr7E/J OUS2TYH8ALc8D31qvjCclWzRy4E5MwvPQSsMuUve8EGSRLKpr6FS7ilsuaz2fPNiMnjg FJrsIi8Yuu1Etq+XLcVJ0li4S7B1wVbV1xnFvRZhlWo4rS4foOG3zIEb5Xi1OzBdOI6s Ksz0exapPlOZnUdUZ4jrnGSIvV/1pTKOzmXtNiZs/w3LY3lPGrlG7HVFdyUzmuOpLkDF G5nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=847p17DesiUPrAbTrGt+da4YJYmyj4ybBvLUVEuSIjY=; b=bY3/IWI/zLkJFl5xNRR1pweqAi544ETzwKyP25tAIQRS/lahDl6xH6m4Iht8ghY5FI 8RL3ZQLwuiCMGTeaAB05hms4/ToATwrLOLnh+g5B7qoq5lnDKjvN2HZYQdois1JEiRjA ptA7IdeABzUuXqSwjOjBDcGA4RwKzBvivh+ElnV9wRWL6ljE5plN6WPjJbrIsKLbnQYT 3INexnYuzEVCSGfilINBPrLd8V1J1lfM66BXscbjmNCwDT7Ec18ZI19ZXNoP2/RVcaNq BAyJ2vs6+NLHuuTJhM9AH4ArXskt25878Y4n20hNCG9WaZ5DiEZE9Xa//f6hvu44ZlY9 gOWg== X-Gm-Message-State: AJIora/eqMjjlWign45HJ79ABw/CqY7Vu+sIv87xF2CKbyr7ajOefMFD f2iyE7O78U1vtiUjnSLeqXPieQv+URvOKRJRbiQ= X-Received: by 2002:a81:4bd7:0:b0:31c:91da:5a20 with SMTP id y206-20020a814bd7000000b0031c91da5a20mr23140384ywa.131.1657571628325; Mon, 11 Jul 2022 13:33:48 -0700 (PDT) MIME-Version: 1.0 References: <20220711192113.3522664-1-horatiu.vultur@microchip.com> <20220711192113.3522664-3-horatiu.vultur@microchip.com> <20220711202646.om65vrksyifvkfkw@soft-dev3-1.localhost> In-Reply-To: From: Andy Shevchenko Date: Mon, 11 Jul 2022 22:33:11 +0200 Message-ID: Subject: Re: [PATCH v3 2/2] pinctrl: ocelot: Fix pincfg To: Horatiu Vultur Cc: "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Linus Walleij , kavyasree.kotagiri@microchip.com, Alexandre Belloni , Colin Foster , Microchip Linux Driver Support , Maxime Chevallier , Michael Walle Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Mon, Jul 11, 2022 at 10:29 PM Andy Shevchenko wrote: > > On Mon, Jul 11, 2022 at 10:23 PM Horatiu Vultur > wrote: > > > > The 07/11/2022 21:51, Andy Shevchenko wrote: > > > > > > On Mon, Jul 11, 2022 at 9:17 PM Horatiu Vultur > > > wrote: > > > > > > > > The blamed commit changed to use regmaps instead of __iomem. But it > > > > didn't update the register offsets to be at word offset, so it uses byte > > > > offset. > > > > Another issue with the same commit is that it has a limit of 32 registers > > > > which is incorrect. The sparx5 has 64 while lan966x has 77. > > > > > > ... > > > > > > > -static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev) > > > > +static struct regmap *ocelot_pinctrl_create_pincfg(struct ocelot_pinctrl *info, > > > > + struct platform_device *pdev) > > > > > > const? > > > > > > And I would leave pdev to be the first parameter, if there are no > > > other functions that have them like this. > > > > I will do that in the next version. > > Just for my understanding/knowledge why is this desire to have const or > > to keep the const? > > For non-POD types it's a good coding practice to reduce surface of > attack, if any (the data will be located in the pages with RO flag > set, and attempt to write will give you a page fault or other > exception, it depends on architecture). > Also a common sense, if you don't change data (which is actually > initial configuration or so), then why shouldn't you use const? > Note, in cases when it's not initial data, but runtime stuff (like > really run time), const is obviously either can't or not needed to be > used. One more specifically for drivers (related to the first item above), it allows one to scope the point of failure in case of wrong configuration comes in. The device might misbehave badly because of some garbage somewhere. Also, the driver won't write data to that area, which is just a good preventive programming practice (but this I already implied by the second item above). -- With Best Regards, Andy Shevchenko