Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp103812lqh; Mon, 6 May 2024 12:40:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQ7OhyrgVIy1qcnIeYNWl0qbU4tiDyD/ISh1jjj6kOngWZ5I+3MWdUfdvTAgMCHNZKzribvYacHXGHjidl8WjQTiuKVbfytJ3baJrJ5Q== X-Google-Smtp-Source: AGHT+IHscW16j37x+oX8bmmYMwQywSsdtbHWkXXXpWBxtO9jyXDsQDtS/QWtpRqhnim9ZUxkj7PA X-Received: by 2002:a17:90a:1fc2:b0:2a2:1900:493 with SMTP id z2-20020a17090a1fc200b002a219000493mr8586071pjz.40.1715024403425; Mon, 06 May 2024 12:40:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715024403; cv=pass; d=google.com; s=arc-20160816; b=YOw40hsoEL45ttLin8xbGpaD3hqCj3ukGzLiRMLtzNYg6eRW/dnonjEtt+l4ebil94 WFzpKazPzYQuT8N873BEXr4Z+hC65IurOVDWp+9InNlezHJ0baCsWaNtMRJgR3zdhY5y ILBBv1IFSdTlmGrkws115GeO2vKjZxheKvexSolDhnZHP6KhavbB+38s/StVN8RhC3n1 bwXloUWssogtGz4YpGskm1MYagccd1qcpVBLWlhtL1J4Ez9rCPLEVmdekiOloRDK6UqO f6MUqVwz8trBhJ/JXUdNBAUuwVMyBEFC39LeZ9krm70c+YmBjWmoFbQTUct9H1D6k8nI 3Pxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:date:dkim-signature:message-id; bh=a3/ApWtpZdFKL65BEqeavRpFjRU1ETt/whrh56InYF4=; fh=OvNZb/T3MDOchQVs4LeF6Fy3DUKGKr0IyuuHc3/FJy4=; b=xMvQ+DnqBsSiSbP1kDsSYtev3qERhj0NbabiwdeKjGXHgNMiLmMTrEwkC4NtmOVeHt HE3JvpUHtSixaIfsdygFapjJarWaQCF+NTU81cgu/4Q/GovazMVm2/zHcVWyqA2YenBp J9MYVfpBHlZVhZ+q4PmhCKHpRmiEFTyFp4eXyiq3okqtddjT3bpSZ0LGn5lADBWKhk5V FeZGI7TJbzWsoD+4NkIcI8qPGVG3yWO8/OmQqiVV0s1uHXZTMzSMCWQ8SwZhfZpajS6V QM6RKPItM6SUMYvAsn2tYGYNyPFmvz1yRMkN4PaORzWKRj3PwZ576Y4QFqhwr7GLTUuY B6jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mq0xAbuQ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o4-20020a17090ab88400b002a2414bfdd8si9087309pjr.164.2024.05.06.12.40.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 12:40:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mq0xAbuQ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0E39F283B95 for ; Mon, 6 May 2024 19:40:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A856E81207; Mon, 6 May 2024 19:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mq0xAbuQ" Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 58C575FDA5 for ; Mon, 6 May 2024 19:39:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715024395; cv=none; b=F9qbryZMpsrO8G4J6C+E+BZ1dbJTQI0tNglH9Vf9wsT19xpyfqq1VAgrJT0Yheac0s6dT7mP2dqrtepXJ31Gpj1JdbC5oxqFQWeDYu8UqJLrnlGNssChHiUF1U/Tz255lv+vNLuv8zct2JoVq3zhi9L6sSplqJYCv+k4AF5NAMM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715024395; c=relaxed/simple; bh=kSbC0P1iih9AHBDll0/qcniTyFWdHujHDEZeNGz4bcU=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=Hmd+fhHhrBuI8XqVQ9k/gXLo3vMZqOLWIJW/dT5JXUqOOI2RJJczRgFrtbJet6wTAeS+iSx2kmIF1libjl0FaIXl9ySPncWuJQX0XJ/7B2uqN2bubhUlP7XCEw6FfzYFrkPfMCxUPMKAqFTBZnckuxq0986NVYCqaDDYjvhttRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=mq0xAbuQ; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <4c6e3e74-cb0e-4f9e-81a5-751731130722@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715024392; 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=a3/ApWtpZdFKL65BEqeavRpFjRU1ETt/whrh56InYF4=; b=mq0xAbuQFZiNjxVWdwOuDhQyfJSF2ruAzqMGvg4b7GE7mUSjNn7WTq6u5xiRX/f69KeIuG hk6/ERsagPQ4wqy7s7W85YqCh8ZCMCzJj1hGMThUZX6gMFRKOO2BgYXL39CxqC8jjIYbnI /OFeacgHwu8swolD7wk0PoCKJbh43Jc= Date: Mon, 6 May 2024 15:39:47 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 2/2] pinctrl: zynqmp: Support muxing individual pins X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson 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> <628abfa4-7e7a-4be1-ab4c-f01b7a90e4af@linux.dev> Content-Language: en-US In-Reply-To: <628abfa4-7e7a-4be1-ab4c-f01b7a90e4af@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 5/6/24 15:38, Sean Anderson wrote: > 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. Sorry, the prefix is the same, but we have to use this format as to not break the devicetree ABI. --Sean