From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E535C25B10 for ; Mon, 6 May 2024 19:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DTdAsI1sOmyeGiboQv2vqT3rivss25j6T+ipn6WAP+8=; b=3VYVBjQIpWeRes 8Qka5DMTg/VY6paVVPcz1GRC14m/gCa9Q0jbLrsqJNcqKvMlysyJASgTQQTPwBR/rAj/lamHcJmkd DCnMEnVEejQevkMUsvNGO8hNJK99DN2kwsYksluC4Dg1z7wAXJFgMx3fIl8pCyr4SSQr6HPw293bE WRDC+Hd4H5EgkFeGLU3EAezLfI4M+duSi9CdUq2r+HL+HxT7iESSnwnWv4veTiQqkKwZki4+x/c2W eGejwN4J5gVqfbtCHoUvWW2Hil8o5UDl82b5d5TM/HgupaFXKkdkew/R5DxRrEfYM/Zm6KRWsJXJm znSA81KP+rQ7bPVy0afw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s44AG-00000008XOd-2TPI; Mon, 06 May 2024 19:38:20 +0000 Received: from out-174.mta0.migadu.com ([91.218.175.174]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s44AD-00000008XO7-2hlE for linux-arm-kernel@lists.infradead.org; Mon, 06 May 2024 19:38:19 +0000 Message-ID: <628abfa4-7e7a-4be1-ab4c-f01b7a90e4af@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715024293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EitrPKgOgNSA4s7vKg5u/VXB+zVHCVjfbxVpdIai8XY=; b=SYLA9OZKxnyK6WLDXQ4SRKnG8RXEN50I5KEiK9PmyE4kjWsJQEKXtzNYqK+1f6nj5ticCY AlOXowlOYX29b8viadhHJkBLGSGsPLGksxEwjhVdNQ9FCdusGsxmv2wVcJjEyH8XsJVZ24 /5RQY948Y7L8p6A9TvL14nrgOnCiKHc= Date: Mon, 6 May 2024 15:38:09 -0400 MIME-Version: 1.0 Subject: Re: [PATCH 2/2] pinctrl: zynqmp: Support muxing individual pins To: Andy Shevchenko Cc: Linus Walleij , Michal Simek , linux-gpio@vger.kernel.org, Krishna Potthuri , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20240503162217.1999467-1-sean.anderson@linux.dev> <20240503162217.1999467-3-sean.anderson@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240506_123818_054563_A562F735 X-CRM114-Status: GOOD ( 17.56 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 5/6/24 15:26, Andy Shevchenko wrote: > 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? The name was easier to remember. I can make it non-atomic. > ... > >> + fgroups = devm_kcalloc(dev, func->ngroups + npins, sizeof(*fgroups), > > size_add() from overflow.h. OK >> + 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()? > I don't think so, since the prefix is different for each group. Thanks for the suggestions. --Sean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel