Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp99009lqh; Mon, 6 May 2024 12:29:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVWumlEElnf5+WR0/w6pzqdxr3v6DjjkCiVZB0tRFI9d1/ScMoegk8qHOm8Q5afbdZBTuz75rz2vxp5al67/aMkc+Mx7izPf+5iezcRfQ== X-Google-Smtp-Source: AGHT+IF/aMDMX9Ulmv9s2bRkyTKKuoh71sgnILQxPwC9USdXCYLsJqU7zD5Vt+IOaw+0zkTSn60L X-Received: by 2002:a05:6a21:3405:b0:1af:9fba:ed44 with SMTP id yn5-20020a056a21340500b001af9fbaed44mr8948561pzb.34.1715023796847; Mon, 06 May 2024 12:29:56 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d6-20020a170903230600b001e28a8a83d8si9069857plh.270.2024.05.06.12.29.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 12:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170340-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-170340-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170340-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 07954B213B7 for ; Mon, 6 May 2024 19:26:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DF2B15956D; Mon, 6 May 2024 19:26:09 +0000 (UTC) Received: from fgw20-7.mail.saunalahti.fi (fgw20-7.mail.saunalahti.fi [62.142.5.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C2E015920A for ; Mon, 6 May 2024 19:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715023568; cv=none; b=tYUpkUnrpNuPgC2EPvoAgWtRFr/NYy/26Lo1QtrPYRCSl8b91XPn3BSSQZzjM4E9j7KhrdnUmkWCAjYHzE9HXKJ1lF5gd6m52JaD8psyoFcej9YSsAay9p2+NNxGqY74F1NyERdRyxX5FEWaTm//MjnO9Y3PU6mO72oTdP+nksg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715023568; c=relaxed/simple; bh=5NvJh0n1w6lBWPnK2SnxtXvu5LZHpQLhtLGSSaX2Mk4=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XaYIIlghKCHJTs0UFC3hCI4zIfp3MskNgSV7poTjgwxpFrGobZNfdEp3GpiA2JqjVJqRjob6WbCwMg1sjauFBHk7xCPDFXWTS2p1MQBVvx0nuqwjopV4DKf5DLzgewMjvfaqfR1A3Q2pBkZuf9W1tM2SpR6NTdtNtfiy6JvuAMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-25-208.elisa-laajakaista.fi [88.113.25.208]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 7b050ce9-0bde-11ef-abf4-005056bdd08f; Mon, 06 May 2024 22:26:05 +0300 (EEST) From: Andy Shevchenko Date: Mon, 6 May 2024 22:26:04 +0300 To: Sean Anderson Cc: Linus Walleij , Michal Simek , linux-gpio@vger.kernel.org, Krishna Potthuri , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/2] pinctrl: zynqmp: Support muxing individual pins Message-ID: References: <20240503162217.1999467-1-sean.anderson@linux.dev> <20240503162217.1999467-3-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240503162217.1999467-3-sean.anderson@linux.dev> Fri, May 03, 2024 at 12:22:17PM -0400, Sean Anderson kirjoitti: > While muxing groups of pins at once can be convenient for large > interfaces, it can also be rigid. This is because the group is set to > all pins which support a particular function, even though not all pins > may be used. For example, the sdhci0 function may be used with a 8-bit > eMMC, 4-bit SD card, or even a 1-bit SD card. In these cases, the extra > pins may be repurposed for other uses, but this is not currently > allowed. > > Add a new group for each pin which can be muxed. These groups are part > of each function the pin can be muxed to. We treat group selectors > beyond the number of groups as "pin" groups. To set this up, we > initialize groups before functions, and then create a bitmap of used > pins for each function. These used pins are appended to the function's > list of groups. .. > + for (pin = 0; pin < groups[resp[i]].npins; pin++) > + set_bit(groups[resp[i]].pins[pin], used_pins); Why atomic bit operation? .. > + fgroups = devm_kcalloc(dev, func->ngroups + npins, sizeof(*fgroups), size_add() from overflow.h. > + GFP_KERNEL); > + if (!fgroups) > + return -ENOMEM; .. > + for (i = 0; i < func->ngroups; i++) { > + fgroups[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%d_grp", > + func->name, i); > + if (!fgroups[i]) > + return -ENOMEM; > + } Hmm... Can this benefit from devm_kasprintf_strarray()? -- With Best Regards, Andy Shevchenko