From patchwork Tue Oct 15 13:18:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 835596 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E39A31C07CC for ; Tue, 15 Oct 2024 13:18:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998319; cv=none; b=mrofgVCgj/MjCdfruifVOlzAfAi6oudc6NDesefuTmGzxdjwlJmGySSDPqSFvjODjKjI6GFoKnlKnnJFj2CGRbs013ctfC+bUMm5hyCWheThm33Ucr05XYllK8HMU1XkiyPAkL6Nll3DCVWz3T4Wpw43qFmwWgK7uQvhyaCDcwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998319; c=relaxed/simple; bh=GWE7IKCk7X4Vk66iIVqj9exPS89ESzElV0HbrMOUxRg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HUhbG4qTqlM+5UL8ieWs1d2edS7fuWbx9XyWlW7BKUbs58G+hk1ThcCF8Z5J54yzZmEkFnNNp96ez7M2ud8gpyUADOgBTAiQJwkLLIp/bFU/nne4KlqdZiLc3gSNPij3xv2GEF7y4FXjRDt97MQjLVyO/nbrSG8MLR7/L1KJPp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=SkCCZ1M5; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="SkCCZ1M5" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43057f4a16eso46852825e9.1 for ; Tue, 15 Oct 2024 06:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728998315; x=1729603115; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YtIz2qp9a7gBi4mP10l9nFI0kYJy4Vh55NDXHglG/3Q=; b=SkCCZ1M5zlffMHk31mTgxprIXq/6wbW9c5egzAs3pQE2ct8sdsuBaVWiMxogXtevHl fd0Jtd6qvD4gcGiMl0oKz8pzqjo2rV+XoH47qrXndrZoWauoi1V0a9D45QvfIVXED7vh BDbl+XURN0dzHlThy9f/jz9wY6nyCB0Nu9DBUr7RiPif6ShwrCVC+Mgi2Ckc2Qn37O7h JjE7eZAUaaoBWQQUsBnDCKe1uPEvmh9PjThGFIPIX6yJsRRJBmcXMHsDN17GAxmLc5Bm M5Z6/j1dT6BpF1icNWNyyw76ajx1/xL8iIXlAut89IxdS9Tk27qKlYm5X78bOG5/qxZ3 SWeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728998315; x=1729603115; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YtIz2qp9a7gBi4mP10l9nFI0kYJy4Vh55NDXHglG/3Q=; b=uhDnlGAAbYSJ5wG42URBYLVMNYDG0qjf56WOaQboFOfNUy1BfScXZynWsfyTl/F6Fr 22JGXa9a5M0JxVy0iLUH+DRoocLKjgJdy5kGETCgh1T8iGrE18+5z/puX3nB5Q8wby+1 a/npONEfbwbRXzjUBAV9Q+LmEl/v50x2fYZgPVMqxvmjpqg4ZFX4CzAM8CHflmw2W/FO q3JvKOCgeYqMBotG4fViXiG2ykxfgkaR7hX6/yQzDGQpUvopi938y68l2BEgdcyiGQ+v KDjQSJrClatMLis3QEpWgEspFo6eKkoboUPsK4kNpnsWpsUxntgxmfXZiMT4QKWlk0aB 2BWg== X-Gm-Message-State: AOJu0YweSJJxvRNbUWEwkRnI2TvMnwikdwabWJ7WL4t2+cZ30kKDYORx 9e0FUKN7mISO4WaZZxdgThUp1EdFvhTmfBBwHqDZyGj+k0Eoxf+TSFzVQFRLskoMBrRstHGFM+I 9 X-Google-Smtp-Source: AGHT+IEshOBUy0buJ/axJY+T/Itpy8gp+/ue1Lw8d1z6JIgCEpBspfjLYSVxq+GuZGDtJPjl/hfoJA== X-Received: by 2002:a05:600c:1c29:b0:42f:75e0:7829 with SMTP id 5b1f17b1804b1-4311df56494mr126042095e9.30.1728998314873; Tue, 15 Oct 2024 06:18:34 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:d382:b11b:c441:d747]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6c5524sm17676405e9.44.2024.10.15.06.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 06:18:34 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 1/4] gpio: grgpio: drop Kconfig dependency on OF_GPIO Date: Tue, 15 Oct 2024 15:18:29 +0200 Message-ID: <20241015131832.44678-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski This driver has no build-time dependency on gpiolib-of so remove the Kconfig switch. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index efddc6455315..2e91e02510f7 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -341,7 +341,6 @@ config GPIO_GRANITERAPIDS config GPIO_GRGPIO tristate "Aeroflex Gaisler GRGPIO support" - depends on OF_GPIO select GPIO_GENERIC select IRQ_DOMAIN help From patchwork Tue Oct 15 13:18:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 836397 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C7281C4A20 for ; Tue, 15 Oct 2024 13:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998319; cv=none; b=RR27uUDOGZKAtd/NrjlKEV+7hYmzio1F/s4iBJgQcSliaMpuRVWc8C8VOGuJtzrLhGYz5vCmocs/lsfXLglZFzfVy2IFtGtne9OhkJt9omORuIX5V3rOiMfAu87KHK3E8jRfBR5/hr2I3hOVTaOOKlnF0N93gGzroGnCGU8VJdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998319; c=relaxed/simple; bh=CjTrMsEwMR8QUk9UFcx/R0AQZNgypq1nAm9lVIPDiXg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mETNY1kkWOGUreG9kf7VdUHlKQMVMxl7c5SGKPC+lkGz/7u+XcUd9qBbMLt3ttnSHpdCnIkobvrcDUjmlXDYmM+eQGsA/Tw9cbgaVUHFl4tfDKopvl/vJsDgjD0K31S65cI749Jg3yl5ix6xwshEKDRvqg/+Jkjo2n7g7tcdybs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=ekH2g6OG; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="ekH2g6OG" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-43115887867so36810485e9.0 for ; Tue, 15 Oct 2024 06:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728998315; x=1729603115; darn=vger.kernel.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=OxiEcvm80AfMlwlCZyDwYfRsCJV3jVXg02TjVFfp6ps=; b=ekH2g6OGoEkXdS0ZgLDXOJLcJ6amCpcjVslNBkRBCpvigP9KBaemtGW38PYyumQOen UMoMUlchw/Xq9l+49NdG9MmU9GviH+86JCqkFr+JfuAz7+KyFpYZa0k05LGeYmnyowiz 20CIW3z1zxJ5vMlNrXNJHsTa1eH155V/BHlu22PMQGTMgLRzrE07gSRXCLWYT0VRRkVa kZNXz2fIc6bV+sqvQu/UY0tFRIRVYk33jTvS7RhVbcaSg5IySko3niTubQmDIGBTdfTi KT0pZq6qHaOGmb5AuIfP1vy4DcQ0xbpZhG7rERVFsLFksT7YTfBX0AchCGLLedf2V/+y ZLNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728998315; x=1729603115; 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=OxiEcvm80AfMlwlCZyDwYfRsCJV3jVXg02TjVFfp6ps=; b=dLdZQg41k7HrmY6xJXLen0ZArRZ0hANXvSTMm+mQm6QwXnNB0hTKCK3MVKN69SFVSL u1x1GePlMGOWWhkbHCZSvSXNsZoPISTwAJNT4a3va0/iMN1H0uJHdZ/PXNmky7Bc13SS tJyCRuFFFxIAuNErasYEegnYvT2Ba2Cye+0/recZG2GvyTF1kncDx2lQwHWCAx4xQKp6 RfiHeCqM6AUctU+sJCDqAZKvTd05KIF4q/gzM9DuReOsedXHX/A+PePihsnZnzuayAub Na9ADeOzoo9zsdihcqmQLBY4+7Lg8IZyKcINaUq+TczyynCbLRsODno/i4vvwdwo3+ev X+BA== X-Gm-Message-State: AOJu0Yzn6aOwGqfxQwgF7YNcWF2l83F0rW7QyWWirVwlbk814UP0rXay TKJ5dNfpWSyr4v65mQn/h8ZSKseen1Os1Ik1A3qG+NtM/IG864Dnt5y/XwaxrUs= X-Google-Smtp-Source: AGHT+IHg5MGJaDBbw3k6d7DovAj3mck54mh917oO5XzPsUEmkG6Td3u0dfP7w/+c9ZWDYTkIhB2lUA== X-Received: by 2002:a05:600c:1d99:b0:42c:b68f:38fb with SMTP id 5b1f17b1804b1-4311d89150cmr125357865e9.7.1728998315434; Tue, 15 Oct 2024 06:18:35 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:d382:b11b:c441:d747]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6c5524sm17676405e9.44.2024.10.15.06.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 06:18:35 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 2/4] gpio: grgpio: order headers alphabetically Date: Tue, 15 Oct 2024 15:18:30 +0200 Message-ID: <20241015131832.44678-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241015131832.44678-1-brgl@bgdev.pl> References: <20241015131832.44678-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski For easier maintenance: order all included headers alphabetically. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-grgpio.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index 017c7170eb57..4b53a932a186 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c @@ -16,20 +16,20 @@ * Contributors: Andreas Larsson */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include #include +#include #include #include -#include +#include +#include +#include +#include +#include +#include #define GRGPIO_MAX_NGPIO 32 From patchwork Tue Oct 15 13:18:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 836396 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D37541C4A2D for ; Tue, 15 Oct 2024 13:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998320; cv=none; b=kl9ufmL1cuAGmYvP4yQUvat8hy+jbRtBiDJaQxb2lRRjvr3k5AbGih70F3Rr89q1475yKiEYbNbTXKNWqlRjYSD5CjcnTnF8651Z57q1O1qOsHOUtVn4nxum/8BCrHLzRvaX4pyFAKqe0tzJTnvq0imOEY9GnvfSE6klCRDKaH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998320; c=relaxed/simple; bh=CTl7TRLTqdbVoTgX7tk04gXaLUwB+Dr06qcHXlaiTIg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b2KFf6JILuWNVMFzPCl0CiTQweEj8fL++4Zj/3ZIW4JlOaE1NYPt5T8j1qiSbvuoKHfqmxl1URWBTCCQxVL0j/V/Dj1emAOr5q1mYPpgeqzdqt1aKGrDLJZ+yKGbhIE8XwEcNdoDzdXGhVg7/L8alyzA/PL1/nl8Wi5SPB26SpA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=CXEeqbc1; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="CXEeqbc1" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-539e63c8678so3066149e87.0 for ; Tue, 15 Oct 2024 06:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728998317; x=1729603117; darn=vger.kernel.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=gmvAqLseAcbhjyldTYBk6kgveg2uJdWIgbtWH2HG6xE=; b=CXEeqbc1eme9UkG83DV3aq7tJMbnUhmC6kBKDm0UQx4SNwg9HcEvupJq/yPxn/10Un qGkEuc6dvpnZ25MJKGx4JqutCTb7C89HVf+ZqKodOYUxDU1Huq0TBFtcypeiF31RiowB QiAKL32r4XVLAHb1/wbkqKyEGnECHDw8FytJn1z7gphY/NdbviPA4VkCUCHZabyWvBl/ ldD5v17DNZtslpPjA2BOkAa5m8SIVNy3YVR/82KoaesXGAEdfSlpNglww18QCbqkuCJY MBuZkdyBREL9zX6hyNU6492lqGwW/KJUVEKwGbI57fl+OweOjhlH0mEXkSgw5bcPFXbK VArQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728998317; x=1729603117; 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=gmvAqLseAcbhjyldTYBk6kgveg2uJdWIgbtWH2HG6xE=; b=fbbBgamAg04B8ldcJ3Y5Z03+bIbO9nIc8ydOfhe+0uKW4FS55OmrVf7AiujPSui5L4 sVc+bcmAwn0VUwJg3VBxfpgr3+31l37YcW4UprXJkU1k+meUWWeStO6Tpo6nZ8E4UVT0 YfORe61etdDSFcge+6KBAJAYkTchm2fGlaelm0P3e9Os+TTugOE0wQsHGMw0jqE5mgSD 5Z4EadCoKXioJ/KD7vIq90LeQESi+ALOeYgrg4IZCA1rLxAWpkJuzp6TIwbFTxeyJsqW 7j6bz4lxRl93NCHoQAm1aQmaYyMPo3AXxRfG3UrVUm5OLrrvd3DFAyPOd27Be6UdgjrK tw5Q== X-Gm-Message-State: AOJu0YzP+GTkMtrEycmRctSEUQBPdshbtTqJujfqQVXhdMN/Lc+umI7t /IOtY732ZF5U9MHaCHXSw2NjK9tgvvwsTSjsQmPQSWnJAs0DN6r9VeoMZNK9IR9coFERZfAMQae Z X-Google-Smtp-Source: AGHT+IHpDSDAggeqdV2QFXz3TXKkVgqEVl5n2Cme+fsCB8fPnC839R+vFsgKKn1w6IlN6hiMsx+6KA== X-Received: by 2002:a05:6512:280c:b0:52e:7448:e137 with SMTP id 2adb3069b0e04-539e54d77a1mr5722548e87.6.1728998316669; Tue, 15 Oct 2024 06:18:36 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:d382:b11b:c441:d747]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6c5524sm17676405e9.44.2024.10.15.06.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 06:18:35 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 3/4] gpio: grgpio: use a helper variable to store the address of ofdev->dev Date: Tue, 15 Oct 2024 15:18:31 +0200 Message-ID: <20241015131832.44678-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241015131832.44678-1-brgl@bgdev.pl> References: <20241015131832.44678-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Instead of dereferencing the platform device pointer repeatedly, just store its address in a helper variable. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-grgpio.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index 4b53a932a186..e11d7c4ad04d 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c @@ -328,6 +328,7 @@ static const struct irq_domain_ops grgpio_irq_domain_ops = { static int grgpio_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; + struct device *dev = &ofdev->dev; void __iomem *regs; struct gpio_chip *gc; struct grgpio_priv *priv; @@ -337,7 +338,7 @@ static int grgpio_probe(struct platform_device *ofdev) int size; int i; - priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -346,28 +347,28 @@ static int grgpio_probe(struct platform_device *ofdev) return PTR_ERR(regs); gc = &priv->gc; - err = bgpio_init(gc, &ofdev->dev, 4, regs + GRGPIO_DATA, + err = bgpio_init(gc, dev, 4, regs + GRGPIO_DATA, regs + GRGPIO_OUTPUT, NULL, regs + GRGPIO_DIR, NULL, BGPIOF_BIG_ENDIAN_BYTE_ORDER); if (err) { - dev_err(&ofdev->dev, "bgpio_init() failed\n"); + dev_err(dev, "bgpio_init() failed\n"); return err; } priv->regs = regs; priv->imask = gc->read_reg(regs + GRGPIO_IMASK); - priv->dev = &ofdev->dev; + priv->dev = dev; gc->owner = THIS_MODULE; gc->to_irq = grgpio_to_irq; - gc->label = devm_kasprintf(&ofdev->dev, GFP_KERNEL, "%pOF", np); + gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", np); gc->base = -1; err = of_property_read_u32(np, "nbits", &prop); if (err || prop <= 0 || prop > GRGPIO_MAX_NGPIO) { gc->ngpio = GRGPIO_MAX_NGPIO; - dev_dbg(&ofdev->dev, - "No or invalid nbits property: assume %d\n", gc->ngpio); + dev_dbg(dev, "No or invalid nbits property: assume %d\n", + gc->ngpio); } else { gc->ngpio = prop; } @@ -379,7 +380,7 @@ static int grgpio_probe(struct platform_device *ofdev) irqmap = (s32 *)of_get_property(np, "irqmap", &size); if (irqmap) { if (size < gc->ngpio) { - dev_err(&ofdev->dev, + dev_err(dev, "irqmap shorter than ngpio (%d < %d)\n", size, gc->ngpio); return -EINVAL; @@ -389,7 +390,7 @@ static int grgpio_probe(struct platform_device *ofdev) &grgpio_irq_domain_ops, priv); if (!priv->domain) { - dev_err(&ofdev->dev, "Could not add irq domain\n"); + dev_err(dev, "Could not add irq domain\n"); return -EINVAL; } @@ -419,13 +420,13 @@ static int grgpio_probe(struct platform_device *ofdev) err = gpiochip_add_data(gc, priv); if (err) { - dev_err(&ofdev->dev, "Could not add gpiochip\n"); + dev_err(dev, "Could not add gpiochip\n"); if (priv->domain) irq_domain_remove(priv->domain); return err; } - dev_info(&ofdev->dev, "regs=0x%p, base=%d, ngpio=%d, irqs=%s\n", + dev_info(dev, "regs=0x%p, base=%d, ngpio=%d, irqs=%s\n", priv->regs, gc->base, gc->ngpio, priv->domain ? "on" : "off"); return 0; From patchwork Tue Oct 15 13:18:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 835595 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F1041C4A30 for ; Tue, 15 Oct 2024 13:18:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998320; cv=none; b=Htcqdga4j8kSR00rv+N7IGp0lKiZ/XwBUXm8420Ow/PJszURDj+CqGacXL07ydnuZl76TiSSLX8/oa+sZYsWZ13L613fdSLMhwJliqTNnAaYtF+D+U8IlYZbkAK1w/dGaqMHw+WD3sFnVp2pOsZFE+dvFeXEB2MBssoNsa7krWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728998320; c=relaxed/simple; bh=2CgSbgvvkBqtYryev+VqkEOiD0s0o6aEpuEPDRBhRys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RB7e6h5PktxAi7azKzBsIa3L+jJ9ws8az6JJCRYB0JUpI5XVdS2RPVYhh+mWIX6yfCdbWzzXkOTtoS3FAHqMLLybZPCYcAAtoJCKfNQpUErHyjWd6FzdvWjo5DkhOzqJ7roJt1H+l4Maco8044eFUpTit3ACRa5t4a48CHSEkKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=WliD97sU; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="WliD97sU" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4314735bca2so3303645e9.0 for ; Tue, 15 Oct 2024 06:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728998318; x=1729603118; darn=vger.kernel.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=mNdD2EpO9Y6gl3mviWbnlvM90nN1wpIKGR3Wg7HuC28=; b=WliD97sUtjxz2c1959dBaBopri2fKhugC79qdHE/I0UJSqjIW0zULB7S47VLOKQwHT BooUVe542fZYodKX3z6ijRZmkDKvq1r9UNl2AkU+Cxu3txtz5ZTPUnA/QJm3W+sOQd7w GRL2YfQEkCVCFBIIWXsMD/CqH9wKOyNGUmATJzRRxJYKxPxSKCdcn01vcsOjpTbLoH6g jRcZVdzsA+nR2a4E3WDtLS6nZKXkBkVU8t7/03OEIPSjv8QF9lsM2eFGxkcQxmHyGVSD UVm5Uuk/NZRLPPzKM2ZZ+wjmtz+uvJFZX4okOS92RlSr+Fl/T68/KmhlJrMTN6tL0cm0 VEuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728998318; x=1729603118; 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=mNdD2EpO9Y6gl3mviWbnlvM90nN1wpIKGR3Wg7HuC28=; b=BxgohjDTvSK2iWLJCHxHjIynml1AauWXYNdOQ++eLZqCmYVqY1xUNSzirkYOAHq7j0 Df01CMPv8VfNGEcCZdVBgoZGpSrsy1IaB4mi5KJpBxSccJEPQGymwknsA/MU62FeqSNB Mgy2/P0i4lRIWvnBVQLRlPoWcX5h6f0qzlTLyR/Ip67mscdV70s9Rpm49XjnGUY8E7ek f6cl7TPh4mcnnc4TLnUUpowECzKHSM8dN5VNs9v4XV1psCAGexBYDM0jLemHcqndZepy WV5A0cLIUes9WLOnOny+sXxfmNrx3k3TU3OnGEr+vPP1FYkAMAAGXKTZLfMlLSnKn8iz AXyw== X-Gm-Message-State: AOJu0Yz13aT59Rc7hmBexZaAvBhCxMB1xHjy1LrSDZnKv7St7zAcTKu5 u08LP3wDZZbRIZrmZ1anEitlTCQdHcxhkAS2lvkY24/lk6Jw1VX0q5sbNn0VVjU= X-Google-Smtp-Source: AGHT+IEjyVoGglejbSYjd5SDXqkOOWcWTIBT5N32UHdipzbJXhnvu7JKVdu/PvuBY9EOWP7lb2tj0A== X-Received: by 2002:a05:600c:1906:b0:42c:b45d:4a7b with SMTP id 5b1f17b1804b1-4314a37bb99mr4361445e9.25.1728998317447; Tue, 15 Oct 2024 06:18:37 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:d382:b11b:c441:d747]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6c5524sm17676405e9.44.2024.10.15.06.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 06:18:37 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 4/4] gpio: grgpio: remove remove() Date: Tue, 15 Oct 2024 15:18:32 +0200 Message-ID: <20241015131832.44678-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241015131832.44678-1-brgl@bgdev.pl> References: <20241015131832.44678-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Use devres to automatically manage resources and remove the remove() callback. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-grgpio.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index e11d7c4ad04d..7ffe59d845f0 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c @@ -318,6 +318,13 @@ static void grgpio_irq_unmap(struct irq_domain *d, unsigned int irq) raw_spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); } +static void grgpio_irq_domain_remove(void *data) +{ + struct irq_domain *domain = data; + + irq_domain_remove(domain); +} + static const struct irq_domain_ops grgpio_irq_domain_ops = { .map = grgpio_irq_map, .unmap = grgpio_irq_unmap, @@ -394,6 +401,11 @@ static int grgpio_probe(struct platform_device *ofdev) return -EINVAL; } + err = devm_add_action_or_reset(dev, grgpio_irq_domain_remove, + priv->domain); + if (err) + return err; + for (i = 0; i < gc->ngpio; i++) { struct grgpio_lirq *lirq; int ret; @@ -416,13 +428,9 @@ static int grgpio_probe(struct platform_device *ofdev) } } - platform_set_drvdata(ofdev, priv); - - err = gpiochip_add_data(gc, priv); + err = devm_gpiochip_add_data(dev, gc, priv); if (err) { dev_err(dev, "Could not add gpiochip\n"); - if (priv->domain) - irq_domain_remove(priv->domain); return err; } @@ -432,16 +440,6 @@ static int grgpio_probe(struct platform_device *ofdev) return 0; } -static void grgpio_remove(struct platform_device *ofdev) -{ - struct grgpio_priv *priv = platform_get_drvdata(ofdev); - - gpiochip_remove(&priv->gc); - - if (priv->domain) - irq_domain_remove(priv->domain); -} - static const struct of_device_id grgpio_match[] = { {.name = "GAISLER_GPIO"}, {.name = "01_01a"}, @@ -456,7 +454,6 @@ static struct platform_driver grgpio_driver = { .of_match_table = grgpio_match, }, .probe = grgpio_probe, - .remove_new = grgpio_remove, }; module_platform_driver(grgpio_driver);