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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 B4DEDC433F5 for ; Sat, 11 Sep 2021 22:06:06 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0DE1860F9C for ; Sat, 11 Sep 2021 22:06:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0DE1860F9C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EA959838A7; Sun, 12 Sep 2021 00:06:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="HWPU19vp"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="I0fMPrVz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 24B38838A2; Sun, 12 Sep 2021 00:06:00 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 14DE283840 for ; Sun, 12 Sep 2021 00:05:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 5BAC15C00BC; Sat, 11 Sep 2021 18:05:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 11 Sep 2021 18:05:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=87UW36G05WBegEpWb5WKJzrczq ZyUPOtuavfyLopDoU=; b=HWPU19vplNJ7suEXJ/T+E52RSfTb61MbhdCmgAGZWM kE3geLOd5wlo3vOkMzVkk5RKqcoPGMXRYYj0NI2OAYEFVej6kSTIWxmfMQ9OOZ8i +edQTN2I55aQ/yuOH9Z+zM1D4fSo/B4P4IMdGWwAPQtMDrfTDOZWe1oTICU9q5ZZ K77C7WV0B9k9BmvpX0TAVoMDrEWebJYd7/QsXUvTYDJG6DEt1LLTmAhy+NJgHVHj mVbqySQeyaI/5i4+Zw0EDmuov02zgmhvFiPSbYyrsu3i+2ugF+WVnNXr1mpxt44B egrarmnx+l1O1pAd6uWbeNGg8TuKdmTuyAbKYxWZ0hQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=87UW36G05WBegEpWb 5WKJzrczqZyUPOtuavfyLopDoU=; b=I0fMPrVz9Lvq9+UYNIL26nyA885ZAgkZr TcHda/qODPfvcWsB5FJAaTUquGV7jL1RjW9sNawODiieJJaX6X9JE+MSX0SyJqVu Va0JfbEI3/QnxmH/4D4D190IRDS4EjuruzY7nO6Vv9bNH3Htu6P710QnFPU2Yuqh 9tK8afNblJp8N26BVHu6XO2nZPySDN587Stofp5QOQIpfoloBV5bo53U/JxF5iSy x5OyUuBbVSg8exvGn9B3Eonijtye0LPsTl2BGbONPJUXkBL34M0KuBUVXkDDAU27 +6q3ySZNIEYFuq0VOcHCUnqUXkKmilo4gk7Eh2eBTlp2GLe5t6V0Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeggedgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgvlhcu jfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtffrrg htthgvrhhnpeeiteekhfehuddugfeltddufeejjeefgeevheekueffhffhjeekheeiffdt vedtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 Sep 2021 18:05:54 -0400 (EDT) From: Samuel Holland To: u-boot@lists.denx.de Cc: Samuel Holland , Dario Binacchi , Jean-Jacques Hiblot , Patrick Delaunay , Pratyush Yadav , Simon Glass Subject: [PATCH 0/3] gpio: uclass enhancements for DM_GPIO drivers Date: Sat, 11 Sep 2021 17:05:50 -0500 Message-Id: <20210911220553.9427-1-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean This series makes a couple of enhancements to the generic GPIO code that simplified updating some DM_GPIO drivers. Patches 1-2 add bounds checking when looking up GPIOs by name and from the device tree. After this, all functions that fill out a gpio_desc ensure the offset field is in bounds, so each driver doesn't need separate bounds checking in its ops functions. Patch 3 allows the GPIO flag translation code to be shared by drivers that use the same flags, but cannot use gpio_xlate_offs_flags directly. For example, the sunxi GPIO binding has 3 cells because it separates the bank and pin numbers. Samuel Holland (3): gpio: Verify validity of pin offsets when looking up names gpio: Verify validity of pin offsets from device trees gpio: Factor out DT flag translation drivers/gpio/gpio-uclass.c | 55 +++++++++++++++++++++++--------------- include/asm-generic/gpio.h | 8 ++++++ 2 files changed, 42 insertions(+), 21 deletions(-) -- 2.31.1