From patchwork Tue Sep 5 18:53:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13374945 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 8C276CA0FF7 for ; Tue, 5 Sep 2023 18:54:21 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k8DME9JlMA6/Q4gg/2GjCQ7mGMr3chkC3QFGQdMFNQw=; b=XL6K/sFmQFPKcz +3O9BxGDHY/oBwF68AR+YD1oMfgNMhdbJo4PiAEE7moWtfnyYzXpBPv62N/gEA7iYpyq7gPT6LCEZ 2GLEAnDP5p3aQCWiEEZwL2+jK4oDJkU0jmCgnSQoArnbyGJzpMoX9VCZXiXf69tszzg28B3Eqrsjm IrjVPcox0pgTortv4oUVBW6A8ltI2lFuzDbeZiJMoIK+EZ9UYLYTfUY565W/MSGzkLsN1ZgPMjlWp 8lOA4uFFf/Xtvu6Jk4joOwGmP+Zm+hLqwKut6Kt5+pG+inY10AB7oUW6M4TxechpBKjWtKYgcr7T+ /uP3+PiwnXrCSBLTCEKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qdbBT-006Yf9-04; Tue, 05 Sep 2023 18:53:55 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qdbBL-006YVg-36 for linux-arm-kernel@lists.infradead.org; Tue, 05 Sep 2023 18:53:49 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31c6d17aec4so2396234f8f.1 for ; Tue, 05 Sep 2023 11:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1693940024; x=1694544824; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gFpxyOwy5Bm9Qt9hRSpXKADqH+X+nrhUxL/zhVP0yhY=; b=cTyuVZRXdWg6q8NihY0x8Go/KD2QCUe3LoRUGZ08W+BUJXDvW24f495sdynqvPgud3 Wppjte9zqD+dHxYt9JiblalyKUDglF/eroZAMDKeEuf4v9hM2/Q4VAFmEAvztKssqJZw pQgJ5ew6WIXHfa4ZiDl2fYgviYqiNGDKwmDyPGyouAC1iKNox+l/mb/SvvuSPvxyfLRn 8k6JUY1nG8huiXg6CQaZR6MrhIRlYELR7TReoCjnlXsD2XMybItk+4Ou27MDrUdETP5l cpSuEDHYpWWQKxWkhxyUDcDqiJzO+tLlEImVTmU97e4lznSH3E2mw2IVNoWNmXUI3fu2 jPvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693940024; x=1694544824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFpxyOwy5Bm9Qt9hRSpXKADqH+X+nrhUxL/zhVP0yhY=; b=MvetUN5LgmPBbnrwDXDsU2tZeEfnv5wbBlVCOjsmObkFDzDODBCHNWPxo6mbNCNKCo nX3aV6L1Edp3AdCHvwfJheLV8MdlQAlZdKtv8FjFrjTpx0S+KtxCgU0CbYDjSeP8Jxg1 IXTCUCTAqsqh4jQJ8czn/9n0NG0cpsFhtagGNgQernp3R6IZHxup++9gteWJvV1pPZTY C46G3WkJiUSYJ+gICUIbCKFLa3IMdRE3WP8tkpzk7wSBVFG01z06KYUX2xlj/PP3mIp7 8fhvF9lazEVeY4IwHSjo9NP1oyCLRCbqe8BlrNVG8Plw9an+6ueLkF6SLRGsh3f/QO+J 5KWg== X-Gm-Message-State: AOJu0Yzsaa7UuaL2pbwmkTZAP6uMe7XIzS+bAMBe+GC2WOeJ4mzoxntf Ub63KDyVuCdc6u/4pIY26v5H+78haP8jR4AjHKA= X-Google-Smtp-Source: AGHT+IFRNQIOeT3zr09E3n7bBEGrta/pNu8Vff14KdMD6sxtlr9ZDhLyFMZ76FUBno0gzmLiwhMBVA== X-Received: by 2002:a5d:5592:0:b0:317:54de:9719 with SMTP id i18-20020a5d5592000000b0031754de9719mr425005wrv.70.1693940024276; Tue, 05 Sep 2023 11:53:44 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:7a54:5dbc:6d09:48b7]) by smtp.gmail.com with ESMTPSA id 17-20020a05600c249100b003fbc30825fbsm17550010wms.39.2023.09.05.11.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 11:53:43 -0700 (PDT) From: Bartosz Golaszewski To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Russell King , Mika Westerberg , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , Dipen Patel , Thierry Reding , Jonathan Hunter , Hans de Goede , Mark Gross Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, timestamp@lists.linux.dev, linux-tegra@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 15/21] arm: omap1: ams-delta: stop using gpiochip_find() Date: Tue, 5 Sep 2023 20:53:03 +0200 Message-Id: <20230905185309.131295-16-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230905185309.131295-1-brgl@bgdev.pl> References: <20230905185309.131295-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230905_115348_000078_887699DD X-CRM114-Status: GOOD ( 19.48 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski gpiochip_find() is going away as it's not hot-unplug safe. This platform is not affected by any of the related problems as this GPIO controller cannot really go away but in order to finally remove this function, we need to convert it to using gpio_device_find() as well. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Acked-by: Janusz Krzysztofik Acked-by: Tony Lindgren --- arch/arm/mach-omap1/board-ams-delta.c | 36 +++++++++++++-------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 9808cd27e2cf..a28ea6ac1eba 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -560,22 +560,6 @@ static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = { &ams_delta_nand_gpio_table, }; -/* - * Some drivers may not use GPIO lookup tables but need to be provided - * with GPIO numbers. The same applies to GPIO based IRQ lines - some - * drivers may even not use GPIO layer but expect just IRQ numbers. - * We could either define GPIO lookup tables then use them on behalf - * of those devices, or we can use GPIO driver level methods for - * identification of GPIO and IRQ numbers. For the purpose of the latter, - * defina a helper function which identifies GPIO chips by their labels. - */ -static int gpiochip_match_by_label(struct gpio_chip *chip, void *data) -{ - char *label = data; - - return !strcmp(label, chip->label); -} - static struct gpiod_hog ams_delta_gpio_hogs[] = { GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, "keybrd_dataout", GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW), @@ -615,14 +599,28 @@ static void __init modem_assign_irq(struct gpio_chip *chip) */ static void __init omap_gpio_deps_init(void) { + struct gpio_device *gdev; struct gpio_chip *chip; - chip = gpiochip_find(OMAP_GPIO_LABEL, gpiochip_match_by_label); - if (!chip) { - pr_err("%s: OMAP GPIO chip not found\n", __func__); + /* + * Some drivers may not use GPIO lookup tables but need to be provided + * with GPIO numbers. The same applies to GPIO based IRQ lines - some + * drivers may even not use GPIO layer but expect just IRQ numbers. + * We could either define GPIO lookup tables then use them on behalf + * of those devices, or we can use GPIO driver level methods for + * identification of GPIO and IRQ numbers. + * + * This reference will be leaked but that's alright as this device + * never goes down. + */ + gdev = gpio_device_find_by_label(OMAP_GPIO_LABEL); + if (!gdev) { + pr_err("%s: OMAP GPIO device not found\n", __func__); return; } + chip = gpio_device_get_chip(gdev); + /* * Start with FIQ initialization as it may have to request * and release successfully each OMAP GPIO pin in turn.