From patchwork Tue Jun 10 12:33:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 895383 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 39125294A19 for ; Tue, 10 Jun 2025 12:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558808; cv=none; b=iIqJEXzg5HBVVB6//13j/DdE3OXN/gNlNJW6vYiWaUwVyMpH7LFpSHqEbHQyguhW1Ub9Qjy2rFsJQ1algWjxHHUnzlH7nwWaB5VL5UtoLWb5+kxl7iYvuIn/h54GkdIyWNvb/yGUo0ZBcTMbT+Fmh6SuVB5BCuLp+phXEdzErEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558808; c=relaxed/simple; bh=nygEAepek5StAfde9/dswNCLDOlRBZWC0ZkAHODgTos=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oyzqfJhgyFBPfMXU58MBLqTYuRjJL3XFW3CGsTcIvebY7/t5CCF1DyaZsCMAkV3kqZb0kI3B8dBXBEIGMQbPazmt3F2A7EIuwKj043BBuHyumOJ216Jj+TOQGBT0YQMB17N9wXezN+F6TiI2fCSbFq0J99LaDwd5/kNphaz59xU= 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=zbHGwptJ; arc=none smtp.client-ip=209.85.221.50 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="zbHGwptJ" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3a4f71831abso5075175f8f.3 for ; Tue, 10 Jun 2025 05:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558804; x=1750163604; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RNc8thwf36Hc/crv6zEElCG/dHhZG4znGHrJi9L7hvE=; b=zbHGwptJV3d/dnbHPHxlJmOEg2koIiWy2/X/7/vnEVizpFK9ok2lZCN9yNBuFpWXt7 8BV4mS7yHiTu6bhBddWwzFqkeUhR32G1cy6sWebvU6/9luycuGLpk1fBtz0i6ECKeBGq xKoPhaW9ROy0KooszAd4GRp8DDpFUSocgWOBW+9e4e/ewbtX5P3F1/uoOede5Gd6zq7Y JXGk0yoZiioZFWx5DtKKSwCPMh0R7sbZBVLmrHainFsP525aF6Y7GXS3UGEqzKq7YDy+ EKT4qhVt5JDi+wyahY9XLO/+/xxF42lTDLZAShMHh130fCOKlRKWRR0al1ZC+7z5/UHa 5A5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558804; x=1750163604; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RNc8thwf36Hc/crv6zEElCG/dHhZG4znGHrJi9L7hvE=; b=DfxWtvljNRAFDPS6m+Hq8sqkh6zd4auEIBh2TecOv8xcDjLhsrG6d6d4N0HSeHQ+tS 78eYODc8Hib8xREP9KbGBhdZFfqVQtdPoT0ACdAtpv0D+YnRuRmzE4Hy9eBG3X+5AF2A za5YZLH+7QN55Kc2dcKpWLXzw50Y//2CTlOhAyfvOMaSIldDFLG4X3cw9gmkO0j7Jb+q E6Nlv79XTlKZYrJZM9Aq8DNbX56FVFlDGQXWxObLIqpLKgMnsAJ/OK4weUhV2ovelF8r yRbXMzHXuY1N1G73yondQ3XEN2RMkirobR5zF1cpjQm6chf7YasB+cPRjHoBJHsZhhXS GbCQ== X-Gm-Message-State: AOJu0YzCJmHgpzJbJbY9N8K5kEKLiXiyayo66Pd05JjiP1iS7yIs8OY0 Tv9qoTo5Vi5Tn+H+egQLe6BXMILl2p9ZdEz+hL3uLvtmWoQXDmOX2jWvhLisq/aSWMyxWPiSK1L mPplL X-Gm-Gg: ASbGncuO0yDxk8wbO5vPu5u+iCTdW5ga9ihDiBnEQftA7G54w+R68d6RqiSfu78o01N J4mK2wA48mPul47e0y60XN6ZjiMy9FZJ7+dxAo4RnKZ+kUHwG15BZ9Q6+JmJqQjR94rLArq9AkD X0BntW8jN7LPju2CYW8ZP5dynaROGsfhOnCX1jPTNCBGcZD0zXASfpkbL5XlsdaQlBizQ2rJeNF aqKCGQ2YO7oxssdCfWMzqnmRqzYDiXj0z1EmgQjfLxQRHVkpkUW/utIhvJRKKvQAAkaVhq0LF68 H1UDtMQWVLM8v3kxJCQ4pvozlZuSQXWmt5AaSbWFjilKpUXI5fEaUA== X-Google-Smtp-Source: AGHT+IGV3Vn6yhZaRUVNvlMafFgkrcv+bSXbOKrnS2PqVCasr+PxmHXeoHC+wE2lIVXIMNJyFwWweg== X-Received: by 2002:a05:6000:2504:b0:3a4:dfa9:ce28 with SMTP id ffacd0b85a97d-3a5318822demr15550216f8f.5.1749558803465; Tue, 10 Jun 2025 05:33:23 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:22 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:11 +0200 Subject: [PATCH 01/12] gpio: mmio: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-1-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4849; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=/UH4x/fbI0BIFJX3mIEzmmNo36J/N7bN+pZNnL+oU7M=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYOFAEvwIEsxV1MXfRknm+eXRkQlcJgIZH4/ +1R9Xhb0bKJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDgAKCRARpy6gFHHX cmxBD/4hi6WLQtzhS7/j0anJqFfcC06CXtfOJaLR+lYY6czknEMDeGFb+xLjlYIn4qRsoBWf85I drjoL1zNnkc7/SSy+dFT35KteOcWxXiAvJ5iRFuiQbUF0yyNvLP10Ee8/G91k49QfuQ8fRvCT/D jQVS1Q8NtvK2xD19vjsPWYvufNHB+CV1QiL/nB9PH5aVCLnrmfqHP7oXIebxMFTd5UyM6CV8u6+ xxj6tpMDW17Idokc90HfORu+kEHNvJTH6pAiQXPUbN2OH8AGzNSRQnrHBPtSwNg2nNTsCX1kTg/ JNZzoIy409MxDnaxREy6Zv1bsQv4gjInQXmp2v2IVtiF52H6mxNqydzNCswYmhOaXbjOflt2lT+ R23/z9U1J1kDbEr2hbA2N8BKFRXNmc1rVTylsrzniQxCyHZIxRNXmA3gJ3zjDqXqH+0xT66ht+2 QCNpNf2hD/r7aOyJoRRM1biGgO98Y1b5XgTH3Xui51nBMJNGcC75zIay96zEsz5XDv8KehN47xg CKLzxQzZtCPVgBe7LRiEmYBdjPJWuW0Rb72XsB4n3gcp4WylME3gGn1SGIAtwcjyUbT8MFoNW4s oHaokbunFa/lEpVFYZbi6gW1I28Hkpy4BsFekKQ7s2IZfh39C4/O3IoEx35s8GWtxzvhuhCj/uN /FpOY/4Ggy1QTnQ== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij --- drivers/gpio/gpio-mmio.c | 53 ++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c index 4841e4ebe7a67d0f954e9a6f995ec5758f124edd..9169eccadb238efe944d494054b1e009f16eee7f 100644 --- a/drivers/gpio/gpio-mmio.c +++ b/drivers/gpio/gpio-mmio.c @@ -211,11 +211,12 @@ static int bgpio_get_multiple_be(struct gpio_chip *gc, unsigned long *mask, return 0; } -static void bgpio_set_none(struct gpio_chip *gc, unsigned int gpio, int val) +static int bgpio_set_none(struct gpio_chip *gc, unsigned int gpio, int val) { + return 0; } -static void bgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) +static int bgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { unsigned long mask = bgpio_line2mask(gc, gpio); unsigned long flags; @@ -230,10 +231,12 @@ static void bgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) gc->write_reg(gc->reg_dat, gc->bgpio_data); raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); + + return 0; } -static void bgpio_set_with_clear(struct gpio_chip *gc, unsigned int gpio, - int val) +static int bgpio_set_with_clear(struct gpio_chip *gc, unsigned int gpio, + int val) { unsigned long mask = bgpio_line2mask(gc, gpio); @@ -241,9 +244,11 @@ static void bgpio_set_with_clear(struct gpio_chip *gc, unsigned int gpio, gc->write_reg(gc->reg_set, mask); else gc->write_reg(gc->reg_clr, mask); + + return 0; } -static void bgpio_set_set(struct gpio_chip *gc, unsigned int gpio, int val) +static int bgpio_set_set(struct gpio_chip *gc, unsigned int gpio, int val) { unsigned long mask = bgpio_line2mask(gc, gpio); unsigned long flags; @@ -258,6 +263,8 @@ static void bgpio_set_set(struct gpio_chip *gc, unsigned int gpio, int val) gc->write_reg(gc->reg_set, gc->bgpio_data); raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); + + return 0; } static void bgpio_multiple_get_masks(struct gpio_chip *gc, @@ -298,21 +305,25 @@ static void bgpio_set_multiple_single_reg(struct gpio_chip *gc, raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); } -static void bgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, +static int bgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, unsigned long *bits) { bgpio_set_multiple_single_reg(gc, mask, bits, gc->reg_dat); + + return 0; } -static void bgpio_set_multiple_set(struct gpio_chip *gc, unsigned long *mask, - unsigned long *bits) +static int bgpio_set_multiple_set(struct gpio_chip *gc, unsigned long *mask, + unsigned long *bits) { bgpio_set_multiple_single_reg(gc, mask, bits, gc->reg_set); + + return 0; } -static void bgpio_set_multiple_with_clear(struct gpio_chip *gc, - unsigned long *mask, - unsigned long *bits) +static int bgpio_set_multiple_with_clear(struct gpio_chip *gc, + unsigned long *mask, + unsigned long *bits) { unsigned long set_mask, clear_mask; @@ -322,6 +333,8 @@ static void bgpio_set_multiple_with_clear(struct gpio_chip *gc, gc->write_reg(gc->reg_set, set_mask); if (clear_mask) gc->write_reg(gc->reg_clr, clear_mask); + + return 0; } static int bgpio_dir_return(struct gpio_chip *gc, unsigned int gpio, bool dir_out) @@ -510,18 +523,18 @@ static int bgpio_setup_io(struct gpio_chip *gc, if (set && clr) { gc->reg_set = set; gc->reg_clr = clr; - gc->set = bgpio_set_with_clear; - gc->set_multiple = bgpio_set_multiple_with_clear; + gc->set_rv = bgpio_set_with_clear; + gc->set_multiple_rv = bgpio_set_multiple_with_clear; } else if (set && !clr) { gc->reg_set = set; - gc->set = bgpio_set_set; - gc->set_multiple = bgpio_set_multiple_set; + gc->set_rv = bgpio_set_set; + gc->set_multiple_rv = bgpio_set_multiple_set; } else if (flags & BGPIOF_NO_OUTPUT) { - gc->set = bgpio_set_none; - gc->set_multiple = NULL; + gc->set_rv = bgpio_set_none; + gc->set_multiple_rv = NULL; } else { - gc->set = bgpio_set; - gc->set_multiple = bgpio_set_multiple; + gc->set_rv = bgpio_set; + gc->set_multiple_rv = bgpio_set_multiple; } if (!(flags & BGPIOF_UNREADABLE_REG_SET) && @@ -654,7 +667,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, } gc->bgpio_data = gc->read_reg(gc->reg_dat); - if (gc->set == bgpio_set_set && + if (gc->set_rv == bgpio_set_set && !(flags & BGPIOF_UNREADABLE_REG_SET)) gc->bgpio_data = gc->read_reg(gc->reg_set); From patchwork Tue Jun 10 12:33:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 896419 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 BB68B294A06 for ; Tue, 10 Jun 2025 12:33:26 +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=1749558808; cv=none; b=aEijmpGDRi+bT4AdEixk5XgKn70QLgFlRpR1Jw2frZvSeoqiPYAz/9JbRJ2ZxkOlywv5zRIQbrPuzwU9HZTvVxfYrSnKOzw18BAwYiKNIMk05emOChV7wSAeTBBzFbOoN2D+qeD73MlZpNMpFUkKyf+YOPAuSUAkSoEbPU1cn/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558808; c=relaxed/simple; bh=JPSbp5yJtajANs5Kx0BJVfQNVJZOTJjm7ySQemaTVgs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DFS9U+gnUAK88Iptmj0H8Lf8MWTsTnxDd9Zyc2Z0YvRz7ppXV/feBRwNyTkRQFAH0EOdhcvtA9rUoEs2EgLd4GIEuNsoplJurPCL+7j9lK05kh4oCzqrUnHUb3Nrk+DkRPwK2KqVkZSQhgqX6H5iDGyfYF79Wl2aXGNDBykgjCY= 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=hjsZElK6; 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="hjsZElK6" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-452f9735424so13149195e9.3 for ; Tue, 10 Jun 2025 05:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558805; x=1750163605; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KaZhNfmNZvFczCK3uYFfm4lqI7dzagVSWDi4ZRPJnwI=; b=hjsZElK6LiepTawFD3/tkgssRztwV6biBmiDYWztzsJxY3QtEdycyVuvYScds5v+TE i4//7hRSH6pu1o7P7hj6NgQS2grPVYpLfbIuj17xzKmkM9fAjl3chDGv10etYfrNz+IK /g4qgMwL6b1DIgfbSrqR34vYL+Fmwd9xjfQaS38cIDQSlcmixZe/EyBeygGe3J+LcL9f l+/djRuGSIQ1n4ekO2/Eyaj7Yblx7nhUIwsPsfovmR8dyN9I0eUlndIo31ZKPqrBg3hT SmPB48cY9i5JCsjg9cNjmpcsneSkNBcGZqNjkWAX4N2yVO6xwFWQrY/zkdlBJdnePJEW k2Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558805; x=1750163605; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KaZhNfmNZvFczCK3uYFfm4lqI7dzagVSWDi4ZRPJnwI=; b=ala4xBqz6qOak3EmGA9tHA9+3la4hn4dnYIUYdowZ/0KB3C7O8pxp0MT90unGyFhKR KjE3Y07lFi0l9YfsoHE+hRshGxAfdSfSX322Zo2TqwMCZ0aKTPXCUR7TfaoQuPjVBpWg gKGA8hMc/5HBBVwNneBE/h6LRh15cD0w2dx/Hm58bN2afcRyeMt6v2ZxJfcKrcEs8al5 X0+IE4XNXbQ2lqfDNoIVAbYqiOYL/N8GGfC/hXZwSWlYsxP3YPrbz5sYbPkHt9/zGrNz GTym21Uh5rs5CH+zcm5p+JlCKss3rIZ4aPrvUtMbuJDmFH6/eiTKGKt1pp0MdxU5hptV j+FQ== X-Gm-Message-State: AOJu0Yy4teBb4TN3HNXcas1pL8GwGAzgcqRG81+MXEo/cdVmjKcGqQLb F2fF1d1ryUfJOdVVMuJKstBa0mR+q742rdN3Fm96JpF+wrMnwP9fjPvfz24zyOA2ibsBeNVBRJv ymnPT X-Gm-Gg: ASbGncsbNujNbyjueKbR0PBO4R7XwDBIM4R3t420bTpkWY1ZgtX0PSTqb6IVQ95ls21 LDM/xvt4Chls2Bx4L3gOY6LM2NiINc/Fa8w0xlFo9N6gFjkeoHf8zXhR8CjsOd1E0XQZs4a3laT 2K+8z92wQtk+4jHUkGzzCSME8ko+xOrNsYLKkkeM6ARB+yurhQForO9xA7AZxjispQbBeQwCRXg KQyGE29NZso3uKythGl2xN7USlqc5Jh+dptRfxrvXoBM+fog5Dk7YBuD2ARpC6RAJ/2630lwqiN 0CN5lke965ZD02AlmC15wHlEZR01ZJ5JB0k6gdi/AiKn5Z18Qp/pkQ== X-Google-Smtp-Source: AGHT+IFSBusLtZEhcB35bdsLhsIDJKEdI0B2x6nuBuQEbHF1Ukz5MK6AfplwzfpXypgWmTNJf64szw== X-Received: by 2002:a05:6000:2283:b0:3a4:ef2c:2e03 with SMTP id ffacd0b85a97d-3a5318a90cbmr15138062f8f.33.1749558804571; Tue, 10 Jun 2025 05:33:24 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:24 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:12 +0200 Subject: [PATCH 02/12] gpio: mm-lantiq: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-2-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1909; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=h//lpMqxpm+YSvksV4b6ru3A6OjJcjH0LPneHhPANFI=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYOyVxQ6f3OBK/aG05w0mHNnvJLnDT+orDrz CyfWJIjJ4KJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDgAKCRARpy6gFHHX ciHSEACbAaLEpy3rIEg/INTnqZRSZcKjIFtdWlKQuLFDeybOyeiSxsXh2wVCKE9HyLBM4Pe4aOe VeJn1Gr92epXjzFOgr9ljMI5XuvfDKiUaJ+rYkq7/Zs0doHxU2JdVUOZ56W/ksVaQRwyC8wCRBr 1Wli4N7JwPdD4t/y88MkdyHuplV05Azu8GK/HebhanaJmAdKsKGHxR/A4RYuWfrffEarVVAQ688 yj7fctEZEtajQVjw+qCP5GBjsONGyfRiTciEzFZk2Eo6IIQCZEYQq3wc8Gd6b/7f7x1mHHGRecY DySlDOvl/blSxGU/19Rk59Ji7N0jIHlFGoRdOlEfDYsyxYcQ1YGhBm/EWbwy7C7TVwwmYmhRHjQ 6U0crUDECD+RHZf8ESHp1fzD0gQD6M87Z2n5Qqj/iXDfT7F3+/E0NCfX2MGjJEoG9D+gFkzNSqN ovpcvq/yrRt4BiP+N/+81NwzARAgmNtA4arZxeyh5i4OqTMZtaMMgDsKwlZxHweLeCJzeHU2c01 Gd0uc8Rd+iWf1vbf/mnnIHTHyTaSYWwYmVxa/FJSj98NsXYkeE2f9VoTVKzBj/b4ltLuEiTBWHq cm2Kz0AGsiu4qJ7PmhkesDqXdEvXX8g0I9jum1a/5pvlAwYSlfyl1w9eyBKPjCur8y1vx+5atSV t1BHqk4gNTPA4rA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mm-lantiq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-mm-lantiq.c b/drivers/gpio/gpio-mm-lantiq.c index 14ae257834381186faba94446ea326cb3be99ca2..897a1e004681c085217bcf295bd971f3424011b1 100644 --- a/drivers/gpio/gpio-mm-lantiq.c +++ b/drivers/gpio/gpio-mm-lantiq.c @@ -55,9 +55,9 @@ static void ltq_mm_apply(struct ltq_mm *chip) * @gpio: GPIO signal number. * @val: Value to be written to specified signal. * - * Set the shadow value and call ltq_mm_apply. + * Set the shadow value and call ltq_mm_apply. Always returns 0. */ -static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value) +static int ltq_mm_set(struct gpio_chip *gc, unsigned int offset, int value) { struct ltq_mm *chip = gpiochip_get_data(gc); @@ -66,6 +66,8 @@ static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value) else chip->shadow &= ~(1 << offset); ltq_mm_apply(chip); + + return 0; } /** @@ -78,9 +80,7 @@ static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value) */ static int ltq_mm_dir_out(struct gpio_chip *gc, unsigned offset, int value) { - ltq_mm_set(gc, offset, value); - - return 0; + return ltq_mm_set(gc, offset, value); } /** @@ -111,7 +111,7 @@ static int ltq_mm_probe(struct platform_device *pdev) chip->mmchip.gc.ngpio = 16; chip->mmchip.gc.direction_output = ltq_mm_dir_out; - chip->mmchip.gc.set = ltq_mm_set; + chip->mmchip.gc.set_rv = ltq_mm_set; chip->mmchip.save_regs = ltq_mm_save_regs; /* store the shadow value if one was passed by the devicetree */ From patchwork Tue Jun 10 12:33:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 895382 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.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 C9E4929550C for ; Tue, 10 Jun 2025 12:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558809; cv=none; b=V8NbwYYkk0Mbt69FTVYeie4lG++qE4CjIIMgNI5ug/wfz5PzW0pqB69X1cf/5MBW8ypKqQNDsIWF3WQ7qCRHg9I1lTdOAS6rJcfyiwaamYtIhfRTMFUwySX352QvIajbcC3hmf6DCxOyxcZkiqu/cAJsm9YXP9Su+x0t/iLPNac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558809; c=relaxed/simple; bh=6BpgFh0LqV1277QiqqV3R/j3rXXsCtZx4vsfZiGtS2A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rhj2UFTj5f/1BbZZANXEHsAj7dCHkw2j2Nt4aNBxvqRxNEAwjFnrlnxCxxORjsV+0TI7OssAGofWMyQ/J2q+bTA93vxgbQnCMtXrglwH628jnuMuNf9UN+FVtKHVnO02A7rIyUpCTuhDI8BbR9lvKuwQ7Qe80z/JiEnzCRRAkBE= 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=y0XpqieW; arc=none smtp.client-ip=209.85.221.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="y0XpqieW" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3a503d9ef59so4517469f8f.3 for ; Tue, 10 Jun 2025 05:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558806; x=1750163606; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rKbs3ygxvSdMhEMPUeqpo77fDElOIDrrqF0rfeM3cmM=; b=y0XpqieWv2yl49aNAzbnAc6MNZ86KTpkeE/vD9s5uGFOBDxdH6xxfds6AEyI1PRcaA YQpnZa0EYYCrlEuD674mdBz9zmZxQcNOl5U2got+wS3xw892V3636kPZm6QL7c0HH20f TY2P1GAIZ/FKsw5keGqvLgqc8+S8Pdekewv6QeMorHj7yvgx9oVzzr6/a/0Cjj4F3t1q l0E7zTf2G/s454mkfM2tuJ6hvNXULUZaR3gemnWer/is/8cOwQCUwP3plnpIRy9mr/ok st19dHzmJRGUQCBrpjKHrYdd1MNjvKlkwojaXr0doIOo2bXegidBAnxttRF2orOX2qdc ftEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558806; x=1750163606; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rKbs3ygxvSdMhEMPUeqpo77fDElOIDrrqF0rfeM3cmM=; b=krfToJSYx66LVos5RbY17fJAQFnTaoMffsra/YDXwrPvyc6qp2coCpqBeqEKw9F+1s G1kRuhcwcr7dwnvtgOxZVxogzyGdhcQcD5Ms+59Q5ZWRQ6T+dAZ4VtzO99NtAMfPYR3r PxTsEmTpfQ37q3vQPAnCt7MCiIkK0qHYsyBVS0ni5UFXL68oXjMvqGT90zafh2w/T/Lu 5F4e8l+YCTa1KGSPV4JMwRvKxMIZdb+Wh30sjZpuzaZvIO91f3UmvoertK2WYyHyYaiO UybUT4J2RidPST5EfKt+UDptATM4NvQL4sgbho0AJSPZ7DbscIW/fVJAFMh2KuPBWEqc N+4w== X-Gm-Message-State: AOJu0YyGyk78NuVL0xC56BZ8hf1uFV+CymuS4No36iEqd7QvCNEs8GBL rr4v4dPBumkCaysp8PPzuIbiPEdL/FWW0+LY4TLIwqOOy+nF1lB/Jy0eMfRYQwWrh2Uq9j+k7jh 9yxNb X-Gm-Gg: ASbGnctCdwTAQS5ojjdbDXfStC67N3QjxAVW58vfAqnrgKarjVc1tKWa893t7lUJyPY eZ1IzHOZZ85BfltcLGrerAe334Q8rSifR4+X2oK93hL3ek79Z8GyH9hwMcJGT53n4LwxWrlkJeX 5hF8jZlHAHYbEkpZOd8r384Ih+uNqeYU7O5GSKjhMI/P2XjsL+90xVkozQKIS1UNhi6OAlUgD8m HK+2+tSdH3917nR1uo5cfyfr00JV9IUMNgojO7/2umTYgLxpdBQuFgsWJYHfg6PULoEu7n3LQAK nlcqYt9YocydQPP5hD/P6X8O4i45yAyUUc9vQ4m6VVCUro6GKFxoxw== X-Google-Smtp-Source: AGHT+IG10zG//yZ1b7GgucOGjVy/SV3P0HD9SPfMOme6APoyX0obpAM9Jiyhiw0LZzEqu8UJWmYDxg== X-Received: by 2002:a05:6000:220d:b0:3a4:ef70:e0e1 with SMTP id ffacd0b85a97d-3a531ce74b9mr14483221f8f.55.1749558805718; Tue, 10 Jun 2025 05:33:25 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:25 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:13 +0200 Subject: [PATCH 03/12] gpio: moxtet: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-3-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2337; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=cJsz4ZGd9pC00Thnt+wIQZLp3beAzLcJOBBw0b6Px/s=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYO3xnpUc/3u6ssQztvReVrCU8Qq6iiPbgtP Z3BmL+TVB2JAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDgAKCRARpy6gFHHX cgezEADSssm46y31itfRn2QsV4tDRq/1Gvqk5nge7CWtX/usrhs/bK6sOyunBzV2g22yTs/iS3R /jcDfbiyCX0hofwExZyBaO6DbsNNGjbsHC8Y9E/WgfQoP808ECbR5jwqWJrOxoDZVIyJNzc6hK5 olsmhMMw3rIUyfj9aKq5yv4XPuDmSk4ej/ZU1QrqEW0HqEcusEtYAVPi8b/f20VqWqhPsmxv/M+ ybJk5xp+Q7PkxVKqrK8HwGRzVWlK7cAJUdGO3sRoN+BRPxG3x7XlfUMQHTdddkZGn4OfJf3Nihp x9FXOs4fh7m2+AbBNMRNtpLvNa3OuwWuqb8yx1m1ccM7OMpKokqDQiVap9+6bI9y8/CCg5MXOaF zf9VR/ogGqpBWtbCiRcOMHo+tMymgF2DsMNHobIwyukBOTY/dg9mok5PIBarL7DrEjmYtSuSMmi cR8DEjx8jynKaZuxFTxBQ3ta0s2sUk/h8dmx4KcaVMFAJLzGhm1E0sWKtS/Nos6JjmmjP0KMR1y Bbej6eKROTskkW5Fg2F4qL6qf5JfU5C+hpwYN3OEnSgAf54LKIBW0uTweVwGYju5nUEh4Tf8Yiz et0rvViK6DvnwoqFOtj5/Fg8i2xE3EpT6OYe9eBqxrkMe/ynuQyCXUbnFLXn45a8ZsWshT4g4FP 1RApJSs+DO1jHdA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-moxtet.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-moxtet.c b/drivers/gpio/gpio-moxtet.c index 61f9efd6c64fb4babef5551fb2541659bf5a542b..27dd9c3e7b7717d43cad3d4c6de019c9401d05c7 100644 --- a/drivers/gpio/gpio-moxtet.c +++ b/drivers/gpio/gpio-moxtet.c @@ -52,15 +52,15 @@ static int moxtet_gpio_get_value(struct gpio_chip *gc, unsigned int offset) return !!(ret & BIT(offset)); } -static void moxtet_gpio_set_value(struct gpio_chip *gc, unsigned int offset, - int val) +static int moxtet_gpio_set_value(struct gpio_chip *gc, unsigned int offset, + int val) { struct moxtet_gpio_chip *chip = gpiochip_get_data(gc); int state; state = moxtet_device_written(chip->dev); if (state < 0) - return; + return state; offset -= MOXTET_GPIO_INPUTS; @@ -69,7 +69,7 @@ static void moxtet_gpio_set_value(struct gpio_chip *gc, unsigned int offset, else state &= ~BIT(offset); - moxtet_device_write(chip->dev, state); + return moxtet_device_write(chip->dev, state); } static int moxtet_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) @@ -104,13 +104,11 @@ static int moxtet_gpio_direction_output(struct gpio_chip *gc, struct moxtet_gpio_chip *chip = gpiochip_get_data(gc); if (chip->desc->out_mask & BIT(offset)) - moxtet_gpio_set_value(gc, offset, val); + return moxtet_gpio_set_value(gc, offset, val); else if (chip->desc->in_mask & BIT(offset)) return -ENOTSUPP; - else - return -EINVAL; - return 0; + return -EINVAL; } static int moxtet_gpio_probe(struct device *dev) @@ -142,7 +140,7 @@ static int moxtet_gpio_probe(struct device *dev) chip->gpio_chip.direction_input = moxtet_gpio_direction_input; chip->gpio_chip.direction_output = moxtet_gpio_direction_output; chip->gpio_chip.get = moxtet_gpio_get_value; - chip->gpio_chip.set = moxtet_gpio_set_value; + chip->gpio_chip.set_rv = moxtet_gpio_set_value; chip->gpio_chip.base = -1; chip->gpio_chip.ngpio = MOXTET_GPIO_NGPIOS; From patchwork Tue Jun 10 12:33:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 896418 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.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 EFF2E294A06 for ; Tue, 10 Jun 2025 12:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558811; cv=none; b=hw2/UWGnThg0p/11asQxXu60+1RpQ3KfoNd813yhX/WhSFrGeYxSXy7Nd+Y53+nsm9Z05h3Irn175QJmoIie6/+S1HO4A6ckFy5WCEmdNcvfdLrY4bsM4tiAMv32ktE9HBcbbu4+oe09XZHNb+AZ6SmDEE3NN/IYg6AAgXJmwgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558811; c=relaxed/simple; bh=+bezkCQDk9Fjy2lBXrNyfPFPBRevDeE7ACPep1dR+ig=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n4ZbBnPv+DOZcwHLiLmPCdRglR2eQP43+XNXgUZ+7YmvrLJB/vCMcIq8dJGQY6myEUSwxB8/rhUWXGrmjfsDqMXBDBuF+ocx+anC++ZorLu6rMy9mScjYNxMIo/YLuuuU0g26IeNFQxrdvDHoe/voVC0qJlrWxMEjO7qYsyQ+x4= 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=BOzdJiGN; arc=none smtp.client-ip=209.85.221.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="BOzdJiGN" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3a510432236so4224351f8f.0 for ; Tue, 10 Jun 2025 05:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558807; x=1750163607; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nnifVKNx6vZMoi8BKrChG7bpgI/OQHUHoxljl9BN6O4=; b=BOzdJiGNNo46+fqsw2p5w4t+IYzxELt7b1VuKMq7IC0oUixZB8rIFqa7G/aaeDe7Nw 4vrBnqk2oU3cAcV9GJutUR5C46JMYyDCvGbVP9grHUHZ2lnlQDRIYHGv5yoYGxuF2mbu syInQSGqnVWGYjaeDJ68OVuJCwB1OfKhxKSeOHGT2VNNzbVfPdBpVtVbj+Glx88PdI6h oHJEB20xPXId+s9eRtW7fNZEI+WV6vZZqlJx+p/XPNNccnTm0kUI0NGGmO1cCs/0QOJC +2VT+Tfyzn2qbRW5dc+HFze3BnX11uzZ6WQijwTedzh1SVdXF57e83AVphu2NUBjO+hT iwHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558807; x=1750163607; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nnifVKNx6vZMoi8BKrChG7bpgI/OQHUHoxljl9BN6O4=; b=LUWNT7VhlmRuSqV+ZzqOLONqU3j9JqX/QCk7O3GhcNTbzUTyzEpbQAd/ok6g4wjAl6 +A8anZ36GMOL/0CJk7zbQIvIQlH5682PA43jT6Fmu2ZeY1l+vxUADWx6qYbJUZ+uR2gq C4gW/vIVy4FmZMWHJ0FW6zgwwskrFkrL/b3M8PWm+7RXat55PFBkNV7glsv0vzvl0wxo av9un38Tr4WVuP0+DjgW1W8ru5WTmk+wN8YRO+eCUj1rC7kLyX/DZ6f4ioGh1YjE134Q TloqMmwFXLph/8Z3Z1DXPnCTYDY5+NbP3UoAuPNQlcUt0s0Iq3Ecqov/Pn4S+Uc/CH68 9wCg== X-Gm-Message-State: AOJu0Yxat3/eUOxgvZY5+ia5WWNTt+rt/aQb+2G/TyP6sNUwzMOJLhxb NSFFoODf/wB7FGj+Aic5wNc3kSym2bMDZHzzC/Fc4nsQi9v+vgNf7gthW+FLajxk2mONDBmHiv7 6POYp X-Gm-Gg: ASbGncv/7i4TVbcwJO0esYcBdRlfsakul9mFQ3uuA42/5Qos9iBRNN+69xTf6OL3Pmo GyliFcMru5XFdgjvQ1bA/o3Q4qx29V0vyL224KlHWPn18+coIqgvd2RpvMp3VWp96LwVTnk/aaS E45mZeCvhh2ssOoBbiA9WhH4Hoh8OOe69Rv2Yjmo1yu1mIQE7yUm714UIwWyBtOspnKL5uvh8Ob SNcZQSPeiebtV235Z/lpqZ/Bgf+i2G4z9mB7hRMq4pc51Q76m+IqzNyXoZDlzdGKQsHFpIg0xUn V8WMLOFKlAJOSNHJrd8ns68vr5+X3ju8YZF70LfXP60TQveFQurcEQ== X-Google-Smtp-Source: AGHT+IEhHGnha6NVSEl35o0rcxk3G2qeby289KOBjHmyRRKU5aBeCt1UnijYGnoa4QSN8RfsoiCifA== X-Received: by 2002:a05:6000:18a9:b0:3a3:6595:921f with SMTP id ffacd0b85a97d-3a531cdd3e7mr11294329f8f.41.1749558806845; Tue, 10 Jun 2025 05:33:26 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:26 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:14 +0200 Subject: [PATCH 04/12] gpio: mpc5200: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-4-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2628; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=90+8j4aZT4JRMp0EAthBl2BT59DR0EH3kEZp8VxRIWQ=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYPjrlNqxPQXfktePA9fMZKYXcc5Gcy3lEpY DiBORdvdEaJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDwAKCRARpy6gFHHX cis/D/oDqQbp1iJ/pMrCws3WboSyUKCzDK6Dz2mNVa9MCgOCF8w2qEn77E5kO3REG58Iy8rBevx M+rxL411dBx+ddz6YfndpV+vRX8eo+xmA9GhmW+ZYP0QL/6LVN4U81PwhG/h3iXUS7i5XJZn2h2 aJ70PUm/8zQWSgA2WTs9k92eWe8PaU5791laRMJaZUS+h1tjqQxPywAnfYf0XCHRtPmJ4nXDrPu W2NtUQ0DFUxaKw7vs+WkjRRUHWCfKbyguo4jCedPSMQl2nxxTlX1WhFlNQRNUvqLLn4zk6lRfLq GbxmNkhls3uxeoFAB2rtvpoD2ti0oeT6dNbmi7Pptx5o3NZ4HCwBEidKmfUghK7L+Q0XPv+f7Dc xOOo2HyNAyc8OGoSRG1tEBELuh0ngmvNjU7ad5jlOxts2Kh4l5VuhylUyGCrqsRfY+1EEvWMP3a Ns3DoU/3KBau2OAHispj2VLP8s5w3Zbbqf9JC5EBfW946W4x6609uYvF0VX1sjSxkCaq89hLZSF Zv2Qm8n5VEeYOHl6sAN7+dY4UB0M+dNgwcVV+Exta6JSnaoAkZSolRXj0z+G3z/5tB1rjuXwUFv nb2okeSy3qeLWCX/LEwjSPEtgSGH/EXRfvakYUCD1aUpMjEJT5jrDXFC+BomXspRo+F+w1rOlaN n3rbpR6MDIGhl5g== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mpc5200.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-mpc5200.c b/drivers/gpio/gpio-mpc5200.c index 091d96f2d682941378d251e95eed88ff16bd39c2..40d587176a754a6277b87b760f562ed5304b6eef 100644 --- a/drivers/gpio/gpio-mpc5200.c +++ b/drivers/gpio/gpio-mpc5200.c @@ -69,7 +69,7 @@ __mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) out_8(®s->wkup_dvo, chip->shadow_dvo); } -static void +static int mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { unsigned long flags; @@ -81,6 +81,8 @@ mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) spin_unlock_irqrestore(&gpio_lock, flags); pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); + + return 0; } static int mpc52xx_wkup_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) @@ -151,7 +153,7 @@ static int mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev) gc->direction_input = mpc52xx_wkup_gpio_dir_in; gc->direction_output = mpc52xx_wkup_gpio_dir_out; gc->get = mpc52xx_wkup_gpio_get; - gc->set = mpc52xx_wkup_gpio_set; + gc->set_rv = mpc52xx_wkup_gpio_set; ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip); if (ret) @@ -228,7 +230,7 @@ __mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) out_be32(®s->simple_dvo, chip->shadow_dvo); } -static void +static int mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { unsigned long flags; @@ -240,6 +242,8 @@ mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) spin_unlock_irqrestore(&gpio_lock, flags); pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); + + return 0; } static int mpc52xx_simple_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) @@ -311,7 +315,7 @@ static int mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev) gc->direction_input = mpc52xx_simple_gpio_dir_in; gc->direction_output = mpc52xx_simple_gpio_dir_out; gc->get = mpc52xx_simple_gpio_get; - gc->set = mpc52xx_simple_gpio_set; + gc->set_rv = mpc52xx_simple_gpio_set; ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip); if (ret) From patchwork Tue Jun 10 12:33:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 895381 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 51993295D87 for ; Tue, 10 Jun 2025 12:33:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558812; cv=none; b=bZ8OFKV4Tv2Om5p7eP2ctiGnBKzLDO5Ms2qdcpyZpsjb4srcK4eko9WlWX+OPtYWpK6xSXkAonl/NY+csMUSfrL7YQS0CfknAcftTHVYhISKYnwDe4kKHExBzaayPwOgqEakQlWP9Zmo6QOHCXQaZiD5HVqFzv/1/i4v4N9wc94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558812; c=relaxed/simple; bh=tX2qQdRFlMfuL1OJoRvpsye2urs+/ARQOKQBkoHsuug=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zm53bcneXHoQpI9NHJnvO7Uk0XnsrymuWvLpjoLohOGwU4WFmkyHr3rZhEc+lczmrjVjebbH9c7CgUkPE7cVsHZBsneOPAMAAaOzuhS8DULGSNTNCR2hy/Fo8bFSyiLCZ26Ptdo4B4g9q8ksqJA8X9lSO+c82RG9MCFDYjEdVrY= 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=mHfDmKFq; arc=none smtp.client-ip=209.85.221.46 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="mHfDmKFq" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3a361b8a664so4442738f8f.3 for ; Tue, 10 Jun 2025 05:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558808; x=1750163608; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nEf5Gc8OIB6seM5Xwo8qWzla3rwazzwe65/yd6IeVS0=; b=mHfDmKFqEO51EIkFgA79Y+1jmK4QkdE9vW5SmXFA08nBYnQ2SMMVNLb88FuEnwP8ga UZqvB99PVvOTu5F7LGAX8YGaGXrrm8r0rLLF5S1Ft13XRMwbF5K3NGYxxBOyNdKoKTNt EMIqNibMRfUJam/U4ZZyyo4+t1pog1K8VNHTQhBtYet4AL69ThApV43Y6K2e14UNCk/w MR37zne7Fgwn6LgTbjIBvbsXIZAbCG43QHEL8HJoq4w3B6jst35EYCdXzrsphsZuvMsJ fapccbtbhFC5+edaRMSDoAK/s8uZnwYFUotJ1quj0LP1OSi+F6v17gzKVg/8D9ESK+r8 OhAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558808; x=1750163608; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nEf5Gc8OIB6seM5Xwo8qWzla3rwazzwe65/yd6IeVS0=; b=Nrx6N5/UDx5E6/h4VwfGLX7ZObIc+tuTik1k1+KomhKeHrrLmEpvhBcOLHX/i0/RZv dWSWBY1ETV/WjJXqXmSQAj85YNeYZlpAskYZQ8uXztTfwxWEOCgubclq9LeCzSrj5RA1 EOP68VNNEvd7U0cyQVnXo/scPLt+tEd6ba0KtFpIYiL/HME5JNXAmuzhvsHRfA4m6Qjo xmQA6wg3KsyiiQFqW0jFWte9NAF4bRAkCeUOBGOTaiuz1V8Vk/MBzWxZDI3yHXokwRsM CX95l2lAwDkhFCawa47uPnpN0zPyuCUSOfGcP8Pp/irx6do56YrlQUes5sCnlZ9sCNTo pb9w== X-Gm-Message-State: AOJu0YxmT2UbDSmOrBgIErydtALi6pRiBUC8ctMp/toKFpTnflj/rJtP LiNzHvXTNNqtJ6PDJyyrs+a8xkjNhHwEjhjMMikIAD98aL5/Sw05uX1OFo3BqBS2zn5RE0v8b0G Y0cIE X-Gm-Gg: ASbGnctAinYPrd35iVGrUD6w6EtdfM2BP1tcmwk//e/EDm2dZlHDbZtexvZlhjXWzLl 8ymFBjblsUMBwcX+g5PdWaVlUiq4EU9Pn3M8RRF6EsMU98iXSLgpoOomDnW8so3MTSYHzQGc9mk e/pe608xxfsYlJ902k7H1XZaKiO8w/VvQq/FJQt0bWifTR1zlWMjyzM4DqbpqizsFeBeWgoJLfi 3qqyJkT3x23JkXLAV9e7h6QhXXZl+NhnSi8xp4fDqTXsspHAJknqlkYD/4GNwIDyV61EGCHqeRX PiyygTEsPuAFcmJuLurKJpNMnODCx2YqQe4bUacyFTIGgJo+JHmCyQ== X-Google-Smtp-Source: AGHT+IETHAD7DnXMxmzo7SdLmc5/WglgRFKEzRxI0iE9dDNUlCk/3LFXQSCUEAkPp5r5aRCIVtcMtw== X-Received: by 2002:a05:6000:438a:b0:3a4:f7af:db9c with SMTP id ffacd0b85a97d-3a5522e58c0mr2096741f8f.59.1749558808061; Tue, 10 Jun 2025 05:33:28 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:27 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:15 +0200 Subject: [PATCH 05/12] gpio: mpfs: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-5-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1809; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=LJhyLcUOS+h5b7rEBajAPZSVOUjvkwn05DngH8alAwc=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYPZEloPYVfxzVAviTn9YklxaSXEOfJeOwsL R7IvzJurSaJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDwAKCRARpy6gFHHX csXgD/9eTtN8ZefGVcyBA5Sqi0yLe+7DSboB4eiFeuPn1Qp2CZK7sZczomtfCljg4IDGEXmyp67 tQyoMRkwYZ+BniUdTs89iZTV15o7YlLkxkkfWLJb6s6ida4C2LK7ci6BOTlpZPvg/+ruCWG+q0c vgaodzo4cHgZ0x/5gtXR3LNkiFX8xUCuoBDakmGGtUdc7V1vpDNR87G5AYtMAKfv5YAHZLmVtgX FYUczRur90WLzpocuHTLl17SXcAiDO7pNKlDy6wtdx0YDcivwE+jgNSSZqWBgjZEtLD5UoN6UiQ dAV6nc3d6i+AH8WVEBfuQpq6wAVz2xL5YwR1PZ2O33tpPXIZnii4pKhpY8wfB1i78dvSvztHDMo w7WWsv5B3IR6QDHHV97atmPnmKDED8QMXf6/Upb0uRLixEDhx2Cx/n4/kbXbkHtNsPJm2x4C1KN 3kWUQef3cQ2FywZtTnDGj9PSnyXozlf0erTFQVv0V+J8psfu5icbuey2A+twL9kkFUnNeZmBSXo DYVkosbRnq5IKLzdn+KgvkJrevZDRL6FNqyQS60w3Bytlf7mpPTDAzjet68U8nXsETXBvyRHgyQ CEfZhGnIObe+eUzf2Np6b96R7syeqYaTChuKpOhp72wOm4IkIkTlzyEKfwnTHXs7gOkxrFiDMT4 dp+YIWOY5u+7n3A== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mpfs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-mpfs.c b/drivers/gpio/gpio-mpfs.c index 561a961c97a69f64c21d31c0d924f930c985f131..3415cb7ebb0f1dbe291bfa41b02ae41c18488ff6 100644 --- a/drivers/gpio/gpio-mpfs.c +++ b/drivers/gpio/gpio-mpfs.c @@ -99,16 +99,19 @@ static int mpfs_gpio_get(struct gpio_chip *gc, unsigned int gpio_index) return regmap_test_bits(mpfs_gpio->regs, mpfs_gpio->offsets->inp, BIT(gpio_index)); } -static void mpfs_gpio_set(struct gpio_chip *gc, unsigned int gpio_index, int value) +static int mpfs_gpio_set(struct gpio_chip *gc, unsigned int gpio_index, int value) { struct mpfs_gpio_chip *mpfs_gpio = gpiochip_get_data(gc); + int ret; mpfs_gpio_get(gc, gpio_index); - regmap_update_bits(mpfs_gpio->regs, mpfs_gpio->offsets->outp, BIT(gpio_index), - value << gpio_index); + ret = regmap_update_bits(mpfs_gpio->regs, mpfs_gpio->offsets->outp, + BIT(gpio_index), value << gpio_index); mpfs_gpio_get(gc, gpio_index); + + return ret; } static int mpfs_gpio_probe(struct platform_device *pdev) @@ -147,7 +150,7 @@ static int mpfs_gpio_probe(struct platform_device *pdev) mpfs_gpio->gc.direction_output = mpfs_gpio_direction_output; mpfs_gpio->gc.get_direction = mpfs_gpio_get_direction; mpfs_gpio->gc.get = mpfs_gpio_get; - mpfs_gpio->gc.set = mpfs_gpio_set; + mpfs_gpio->gc.set_rv = mpfs_gpio_set; mpfs_gpio->gc.base = -1; mpfs_gpio->gc.ngpio = ngpios; mpfs_gpio->gc.label = dev_name(dev); From patchwork Tue Jun 10 12:33:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 896417 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 23345295DB4 for ; Tue, 10 Jun 2025 12:33:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558813; cv=none; b=IWYMBJJR+xGr9d/vaUpOwHRzXAO0PRboDQ9AC9Y92gn13LAtsfMDDjaEwRA4Jgz1Y/BZdzrhkzLbcVAh3FrqPrHwSF5kMbXGHVTSk1xNxunnFwhnlrJWab4ZC/gl1viudgZI4kjQo+b0Xwl3nQzC3OSqKfvc1nn2MA3uo0jrc1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558813; c=relaxed/simple; bh=fwfQg190abE0E91/VWzBk3aED/FxotuW4ck3Px0zeW8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PV8POM9qiJ5FzjESCvbk7c4njYHndWs6QBa4D3scejrW6gSONwQb0NU+TtqXzZdKEAGigncQX0RlIFiKGse393V0tQJWpzsq1l60qPils3AqQz+JQCRogJdTX5oi+2WiEXyNIS+cAgsWeTBEcpC5tOBYreSPojGtBqXZZEDlLjg= 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=zDhzkMez; arc=none smtp.client-ip=209.85.128.51 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="zDhzkMez" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-45024721cbdso46892465e9.2 for ; Tue, 10 Jun 2025 05:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558809; x=1750163609; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3F+4kh8HnzcTAXwMgO05FwI7b8fR5vWj+INTIOT0oXg=; b=zDhzkMezvDmCjkfyPixWhtPPn0fRvUBw2KFnbtnh0SicjGA02/MNx3znhD/XUZE+w6 l2KStlmsm5WijgwDnNZL0ZR+asaKp3jEweuQ1DPAHoLK10uYinNLv9D+C+/JULR+Evmm d2pYVNjIu48DyvBTVH3yGHVDgri9ljgwruSxJxyjexMPVIj5W8cIDMByB6cXPKDPjoJg p8ohdw+f6uAK9aIKtotxPN+CFMOk4DdFBW802rm6+HDSXRz9/dtFx23pSIa496eOhmVT JkMGLJglWOmm3IYftdSNIh8GfOhVAQjAh6/4v0Rq2bY3ZbOAerNFsVP+lAi93xSVUwV1 XKDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558809; x=1750163609; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3F+4kh8HnzcTAXwMgO05FwI7b8fR5vWj+INTIOT0oXg=; b=kozIGqqZFS0whnancb/mt4rwjqENR8BPl01DZS+mYcIq+N9FbTRMwEUhlb/B7AM8hj xDG4TGxP+4+dvl+S1cPkluu2NQ+JVDtT60TtgCB1nn/uf2jhs8kPTSp/6YU6N+MlBpEN 0pMCEM6puvhYHacAlU17pwBr3NIOp45x6ZKZF1TlnnGXbMtZKzj6DwUdggBEkCOmOiej +2bix0hV225JNReyTVXekgPka9GmkYRdzdXl762fshEMe3kKO6LRUqJWYtjx/uo064Ap svvWdJ2iS5PQbTsFuYzeBokwbQUtiWSITV26e+pOm8za8ZRZdYI0XMQFq0Ek16CQ6h7E ZNNw== X-Gm-Message-State: AOJu0Yx5apMKwyTJ3jMrwpSprZgi/CMi4R70fnZ9l27NOs47qIeP9RyA 0r7cBraEPWwVFEZUEBU4p/z6vGy05xNPAR8m+tzsY/izXgsPMOPjTH+Ls6F9u4OibaXgU1dimn9 otJBD X-Gm-Gg: ASbGncsqA+WIWrlOGiMcCs1QVSqflNgBPfZmzo/ogUIS/rm+Fbi7mBog8TEHk4QGBB+ WOYxdS8vd2A7OzKUS1quKIkY5kjl7Y/R45n0sY+RLnDdPfMHH0zg3wym0WCSe1HYhDATw8fcRck BZFSWrU+x30+3ZNtRWqk6H2q3AFCrKwMyAeezNm5DSDnwLKem9Lds3ipHm9Rr2F308hsnz5Btry Zf4vw1R3+DOoNexs9LQSxjHuUPXZZLqvNbsodv6/IuQCo27UMJ9/qL+zOcmK4BTGt2yyjfbxoPv 78ygCl8fdAllUZnAGzPwi3H9DZYZ1kYgWx7AW1vA4Oq4u9Lf2oc1c8I8TO3HgL1P X-Google-Smtp-Source: AGHT+IFTYvxx+yPM6Fsk1C7fqSFoF6VLwEGT1tv11cW8KGpzuidERKwWdXVAfe2jAdVBle4RMS66FA== X-Received: by 2002:adf:a342:0:b0:3a5:5299:3ae2 with SMTP id ffacd0b85a97d-3a552993bbamr1564362f8f.3.1749558809156; Tue, 10 Jun 2025 05:33:29 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:28 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:16 +0200 Subject: [PATCH 06/12] gpio: mpsse: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-6-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2989; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=TMx8xoTgcbqz3Qqy5NSYm5JAQDdrcON6VQI7QNVNO/w=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYPCFfXkFBozviHjnoa/3QfnofqJwkCL0YGi UwKuobyQmyJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDwAKCRARpy6gFHHX cibjD/93BIE6A13TiKE9ysPDcrvPFrMv37iv7QXsvm0Lmv6wlgcG1+dairOOfUdjPMav8dlioDH 8HTVlXxB0bqzKYrcS3mMMtkC0Q4qk+AhHImuFtNEKTIBl0+pBdYkrtisnh04673bsig5p6E+mlx JZijDEApCXAyE6O0CTrkgHRAb7i4AYOnDpnA1QohI0S/3WAQVPHJz09AmYsiqHLOcKbfT33n6lM tvD7LNztj6gvgddKar6MiiGD0Q/Ak+9crMBkju3I/FX2F7M2nOC8TKyVwk32eeIsvIczMIwnAnF v8O60v3shWlZ3IeiheyA7oiShU0F2/gUokAkpw9C5j/jY7mAB6zr8Fo21I6CMBjJgPG74UuyDlu GtGi5/jpDloLA8HOKSmNveS9WXC6IBcN6E5O1v8mXcjGTPr/1dbngoICJLlXXR5CPwEV2Cdb7aS +DYdfjcEIoA1olpZVfmqJtn+VC4VupcMQQnurxBHJa5cfDLRnKNvoJmSH+YnUXSxlnOo+8idA5e CMA8uth49bFCKuH+LjcK0+Atd2lYC8UDt+Zr9gOavzjr3DVEqp119wb0A+BOCHgtmO8KpHgr0nO 0x/TjKxvqy6vM0e5hyVCvN7WbJSAsiw9m2LS+jMsU9hRHbm/PeAn7d8RD73HDqVCfA7JlvGSO8S vgw27DKUKWSkanw== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mpsse.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpio/gpio-mpsse.c b/drivers/gpio/gpio-mpsse.c index 3ea32c5e33d1a445dec02996744429f17ec61af7..b17de08e9e03c5ce05ca5c1bbbb8a0f83fc2ba03 100644 --- a/drivers/gpio/gpio-mpsse.c +++ b/drivers/gpio/gpio-mpsse.c @@ -160,8 +160,8 @@ static int gpio_mpsse_get_bank(struct mpsse_priv *priv, u8 bank) return buf; } -static void gpio_mpsse_set_multiple(struct gpio_chip *chip, unsigned long *mask, - unsigned long *bits) +static int gpio_mpsse_set_multiple(struct gpio_chip *chip, unsigned long *mask, + unsigned long *bits) { unsigned long i, bank, bank_mask, bank_bits; int ret; @@ -180,11 +180,11 @@ static void gpio_mpsse_set_multiple(struct gpio_chip *chip, unsigned long *mask, ret = gpio_mpsse_set_bank(priv, bank); if (ret) - dev_err(&priv->intf->dev, - "Couldn't set values for bank %ld!", - bank); + return ret; } } + + return 0; } static int gpio_mpsse_get_multiple(struct gpio_chip *chip, unsigned long *mask, @@ -227,7 +227,7 @@ static int gpio_mpsse_gpio_get(struct gpio_chip *chip, unsigned int offset) return 0; } -static void gpio_mpsse_gpio_set(struct gpio_chip *chip, unsigned int offset, +static int gpio_mpsse_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) { unsigned long mask = 0, bits = 0; @@ -236,7 +236,7 @@ static void gpio_mpsse_gpio_set(struct gpio_chip *chip, unsigned int offset, if (value) __set_bit(offset, &bits); - gpio_mpsse_set_multiple(chip, &mask, &bits); + return gpio_mpsse_set_multiple(chip, &mask, &bits); } static int gpio_mpsse_direction_output(struct gpio_chip *chip, @@ -249,9 +249,7 @@ static int gpio_mpsse_direction_output(struct gpio_chip *chip, scoped_guard(mutex, &priv->io_mutex) priv->gpio_dir[bank] |= BIT(bank_offset); - gpio_mpsse_gpio_set(chip, offset, value); - - return 0; + return gpio_mpsse_gpio_set(chip, offset, value); } static int gpio_mpsse_direction_input(struct gpio_chip *chip, @@ -450,9 +448,9 @@ static int gpio_mpsse_probe(struct usb_interface *interface, priv->gpio.direction_input = gpio_mpsse_direction_input; priv->gpio.direction_output = gpio_mpsse_direction_output; priv->gpio.get = gpio_mpsse_gpio_get; - priv->gpio.set = gpio_mpsse_gpio_set; + priv->gpio.set_rv = gpio_mpsse_gpio_set; priv->gpio.get_multiple = gpio_mpsse_get_multiple; - priv->gpio.set_multiple = gpio_mpsse_set_multiple; + priv->gpio.set_multiple_rv = gpio_mpsse_set_multiple; priv->gpio.base = -1; priv->gpio.ngpio = 16; priv->gpio.offset = priv->intf_id * priv->gpio.ngpio; From patchwork Tue Jun 10 12:33:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 895380 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 3C458296174 for ; Tue, 10 Jun 2025 12:33:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558814; cv=none; b=pMrdUAMcQOBYImMgajzq+M765pe7oiJ9FdD7EQ/yboeKvgeJuUMX4tSK6yfMhFkHk3P6M230Kk/kRo0P1UjrK6bRAxYSROOlhBFUYJdGrT6KCcCxq8eTnpDnmwK3QtjDs+LdkVObaaC05hgPdNUJ8/O2Zp4a78QbYxx0rxZip80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558814; c=relaxed/simple; bh=0Q/v23KkvgGRE/jqhFxsdYJoykX4nfP6MLHY3t3sq1s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VpirofW+nMxJH7bM9wxah943m+GR0+yjQ54eKY5eMFbwLCmg8y+3UCuxVEG9k61MbMzsoxEWfzXlb1TkBs7H18zmyrKm74cU4f3XjkXhr7T5Zr1lg0VyRRt1isGaSqAtnMY9IWabXRZUMuj2jOAOrwDe1wY0xsX8Av9/If3L39c= 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=ETQA6UWi; arc=none smtp.client-ip=209.85.221.53 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="ETQA6UWi" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3a5123c1533so3053028f8f.2 for ; Tue, 10 Jun 2025 05:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558810; x=1750163610; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qxLzYZOTSdUIwG/dDdz19oBo7jupe4wC7PnSCC6qO4k=; b=ETQA6UWiKQEXG9Z+/FiRbYonJbwJ6P39Qm1fk+FCdfyRFmmIzNMLdSLFDRpVWEL2uM exQgN8W2UnqdUgBaN4Cuhou16qdcMuXfPuN1widJxYbeIHgSaYglMo9sHPW5FgazhUbv Gl7hJevfTuzpMjPVWuli8/zxmsNYQ1opGSG2W9SrtyGmUyVP/fWkQr1tA7MpVLHqA2TA BJhYGipMKvl0DZebSIV2GH/7S0ea0+pZFPFyrU+cIid/CxV8fEjd4Fd+sI/Zqu1YkRAd ygAFPvYmTdhZlLOMpvXKz9nmZmT+L2bSNVr87UBwlz5K38N17VZVGvAbXdrKyr85c8cm jkog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558810; x=1750163610; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qxLzYZOTSdUIwG/dDdz19oBo7jupe4wC7PnSCC6qO4k=; b=RIWljuT4qgnlCA+hjt/U541AJHGdosiOlbBMHvBx0SZM1ltLz2Gtmn5vFytf1DXAb1 0PaY3YtBbYzrx/mFr4bGxCaBXxDPtVHF7PeGNbytPQssJsErI8n42z9RB9C6IBsxG9ie cRTRXrWIZSJWbe/Izg66hP77PlOluutRD+Ky8L/eY4wPYwIiNsjFf5zYLaiZB2517LLr FnQZ0G8yxDVL4+bH4IOUdb2wz3txvF59dzPwOYQXLRSw1akUSLmE9xFNqTOP1QVImczl VRjfI0WmT3GyCs8qwYVx3MC/r1IE6cxPvkinmM+PTIuyXVC+pDJXAbVpXqHqGoJkHRLd sAxw== X-Gm-Message-State: AOJu0YwvAW7hg6VPNN7b2qRhxeajk4puSZEPuXPXW6oVLBbIuJhgjOeN Uh0x0Jpiq7BDDWWTIxXMpSGPTF6BmlWUihWUgZwQR4u3K8QU87DsYH6OufK1+JLXNx33Dp+GSSW t1Rg5 X-Gm-Gg: ASbGncsMK4dtAuS9Sth4OUi+sc5oDtv3Io5Ce2ciXirRgPpDPLeNs+a3K3EU8FPG1Mq 6sfaGFrMHHao3yOasVYnIYLtaaKE/sIf3D5qFydWxuar1RQU1CSU9+bTk6QJq+sletXOv4kAyJI u0DDnvrN10o1PEq4eIEFYozOrHnzgyiuNnmzv9LlY5gkUof16uIwi551vgb6OYuKFuxyce5i8sG qANV8tPvE8nO0TotlMbFvc13o7cnYSfBuVCBVhjsRUBaGyozQ1EYzy/ziYMr86HNP1QvKf8hLuJ 8qGgaejAJVC+del83ceCr+lBb2MUoudN+NN72oQTgDIEFIERk397tQ== X-Google-Smtp-Source: AGHT+IGf24xBNhS/K1ZbKglpgFrm46LA9T2wVtmfcyS7odITVr/pCroc70/4xTfamtgoFjylllZKEA== X-Received: by 2002:a05:6000:4205:b0:3a3:7987:945f with SMTP id ffacd0b85a97d-3a531ced4e1mr13192942f8f.57.1749558810273; Tue, 10 Jun 2025 05:33:30 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:29 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:17 +0200 Subject: [PATCH 07/12] gpio: msc313: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-7-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1676; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=ZmOs9Rn2Ofc7KtPnQgf3fHbIJejOw5G9OgMOgcVcOTU=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYPS6rMr9JHakl/jEzS6gu3nnJM5OwNcNdkw pcSFpc7hKKJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDwAKCRARpy6gFHHX cvrUD/9GpMmudRkoErJ8Jc3wJWG5D7s/6ppxZ4bAKfLPHuIf3cullW2xXMdGEisXFnYba5VEHpt VlXc3SJRZDpOEvM0F3v/+jUIZiuOD6pvawQnW/qxtq/Ozv1UfpKrpuN1fRrh7pL2XMWCAwwRnUw aBDKVyyJlBxP2MtvGqRaa982whCS2SZd6kG22Dddodz3o3nAzrh2kTO1S+fWFysy1uyhRTTIlpQ cXCVQ1wQMGQQOX44beuLfNlLd9SEPnqHDgf0Lj3MudgUqT22IGiNR10kwDiB3wQ1raD/uYBJnzl 8vxKAn3c0fCywJcvMFP6K8S2ZAHGytispiNwpf8Pa9l06WV5vZCyzZswFKsDYk8zO45sEPi2IYK skKkUVLEkgJycvjqe9Z0PM21t3y0NVWKx5KjMcH6+hefemyBEzaHcFyl5ARdxki12GE3lCixf8f RHBvPI0sed+6K74ffsqTELAk4EffI6LaNvWOSEG6F6OvP91+rEkaHy/kCIJFTo7DMnnu+SKtCLB ghIRIU0nZmltloZYikzkZfcgB8uYVjw5f42C9UGksap9z2d2juN4inFBf0R8psL7OAHQB7occ8w nuAi7PvG6Lmjmnv+Hq6TmLCI75PEi8A9HehvhBXXbFG1lUF0a3ELPJqeFHbc8O3ZLGrwJsZY5KR oWc3lgWCenglKuA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski Reviewed-by: Daniel Palmer --- drivers/gpio/gpio-msc313.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-msc313.c b/drivers/gpio/gpio-msc313.c index 6db9e469e0dc254e791d497b89a4c6d329d0add4..992339a89d19840fc03ccf849972a83cb86415ae 100644 --- a/drivers/gpio/gpio-msc313.c +++ b/drivers/gpio/gpio-msc313.c @@ -486,7 +486,7 @@ struct msc313_gpio { u8 *saved; }; -static void msc313_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) +static int msc313_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) { struct msc313_gpio *gpio = gpiochip_get_data(chip); u8 gpioreg = readb_relaxed(gpio->base + gpio->gpio_data->offsets[offset]); @@ -497,6 +497,8 @@ static void msc313_gpio_set(struct gpio_chip *chip, unsigned int offset, int val gpioreg &= ~MSC313_GPIO_OUT; writeb_relaxed(gpioreg, gpio->base + gpio->gpio_data->offsets[offset]); + + return 0; } static int msc313_gpio_get(struct gpio_chip *chip, unsigned int offset) @@ -656,7 +658,7 @@ static int msc313_gpio_probe(struct platform_device *pdev) gpiochip->direction_input = msc313_gpio_direction_input; gpiochip->direction_output = msc313_gpio_direction_output; gpiochip->get = msc313_gpio_get; - gpiochip->set = msc313_gpio_set; + gpiochip->set_rv = msc313_gpio_set; gpiochip->base = -1; gpiochip->ngpio = gpio->gpio_data->num; gpiochip->names = gpio->gpio_data->names; From patchwork Tue Jun 10 12:33:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 896416 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 6CCB6293B5E for ; Tue, 10 Jun 2025 12:33:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558815; cv=none; b=ZDoKp5TiJ+j649vwNv2iz+SMDaTQwSdErPYpurp7+mpdI48J2ISamVSKxiPexukyZ5kZaN1V9rCUbkM/Uv1pL6Y9PvW/e/naaSpbjayogrtID7hzivvXmJlaMl+92h4rFcY1ere5McirhkYGNYof6lknmtgzgsfBgHLwETdt/fo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558815; c=relaxed/simple; bh=Lm78y8CFPM8ZaJ+Z4IY455wU/Cs/n37OItmLKqf9FjE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SFjBTOvDB+DJTHb9crkheLlsHGgw3VTpWFMsJDql07dtFgQs8QE2wHQ2/T34jTnFazXfgHSkkc8s91C3zQ63nQ0GWklftBfDbMhOgUGRdE2anA849ghZ+mCVcyinRt6K71KVuPCjOiiSQfwt6rvBvbJIgph4smKsEmHHCTghJQo= 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=X9POp9IX; arc=none smtp.client-ip=209.85.221.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="X9POp9IX" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3a4f71831abso5075319f8f.3 for ; Tue, 10 Jun 2025 05:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558811; x=1750163611; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nL73BX48X8AKgopehjQyiYACuD4u/nSLpuXvgAof4w8=; b=X9POp9IX/rRhrd1W3QcH3B24uJLBLs4kbUIQ8Euskt4i0QPyIE2rngdaT5bqLW3ufh klaRpCEP3l4Ma8L66qEoiUrjOvDSi/uOt0ysPB7ZXmUOhhGDcpIVyKxTaHnJK8GD0uoQ e+1JdAEC/+mW4kJ+AGxgCFtfDz5ujNWkZtnd+2B6o94R1uESABM22FV7AR3VdLFHHAxH Z2tNJRmf1ZEn96yeXSZ/MuasSA88XINdedbAyFkziTLZRSH+kBp5uMZnxT+HnfPum2Ln /C5RRdLGRzDS38Y4vOE3Kkbne60+N1wlA8T4y8mk9qLc9++NIJ93Wk1f+JK6XaQonI07 PV7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558811; x=1750163611; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nL73BX48X8AKgopehjQyiYACuD4u/nSLpuXvgAof4w8=; b=RNtoBagABMAo7s/DLn6Z9zxQlTNUkv1+MYDeq6pg/0zi+nI43mVngjDjxkOCLzgd/I r+tH0cd6D4LVbczCUafCUfk8Rp6TLsCLIAULTBVtJHBKV9XaZJokqaEBqSrFkOCW0pVd TDO7UWENkb0khuXv0YH2ixVni+S9gjH2ljZ+fr1U8C7B1VeJ/b2c0GDsw20gD6FvkG8E NnJH2ZxDxkJ4G5Mja4alRjKqU8rFK1LEfiPI6ETzRxiiqU2/lLfP6j476ZopEGZ0bK0D nPEdSiH5v84b5c3cjGue215UZL6bvXg59NLgJOJWgTQ34BWoNIRDSWQn+JjHFjNxCbbQ gW6A== X-Gm-Message-State: AOJu0Yw/fvCQZZMvi8YLq5S/6C7k2P+dxDt/bGvwSQZiu70m9/uAmQPM wlqJw9TbFnb+1hZ34MRbQBbrWlZ5ZCIM7stdetDCIQb6uRbxsO3HcMU+kjVZFAAWrnkuZRhFTwz NDTDY X-Gm-Gg: ASbGncvF4gxH2TzjggjbhAjnyPbNhK9iulWaW8loH0KnKKXIaMqb3ETIHr1pkGnmmS6 hG9+//YXvISxQlzgnc6IP3heh31AIuT0REFWn9EnexJIGNfXXx0lp7gsN6S7XS3QsIKPqBN8Vhl Kec+anyY1Z+XHgQcD9FLkLj0Kd9z4XR8Tm5kYF/loEJ3G/Wx8YBgu7VaaPUz+s5324qOML3rVen I+OXBy5ZK7T0gDWkksx/gl6kozNmI7LHEuJRV2hmiE7ufBrVIBLHnG21Eb5jbX/lOndJ6rqTW++ i5O+H6dOqizG7XBWv6kUEYHJT3XSDk+YtHCKNXToUnptI2nfQ8sGMA== X-Google-Smtp-Source: AGHT+IEiNibcNMiVsbQHF+47L41QAAVONmrgvcTQ9HOwW+eRgKNTCeQ/gU2brhJ6L5+0fDStZI1sQg== X-Received: by 2002:a05:6000:240e:b0:3a5:1c3c:8d8d with SMTP id ffacd0b85a97d-3a531cb237emr14618808f8f.55.1749558811315; Tue, 10 Jun 2025 05:33:31 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:31 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:18 +0200 Subject: [PATCH 08/12] gpio: nomadik: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-8-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1622; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=8SMFcEMP/yadOAddKphU2LRj+bMl3thvtyJ4brm1q7k=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYPNZX7SmF68qJHpheQB5Bvy2U+bFuaYHRkk DPVGcTa+SWJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmDwAKCRARpy6gFHHX coOIEACRhw6kCcmI6Qk5Uj1hqmX0byLLYekHcBjVu6C0ctu5rgUkddKMjGT6YzbWLvwnGp/o+az B7cu6TULK+CGHrcSoGO/JBAtpG0vLkNjQIDPjUr0j75ifLhmeuE0jvgszHFIFyVSHSOdthyj9w2 rsEmzCLFLsSXCDgBh2oFj2EhfJhxZI8rkjn3ox02VOjRjDrtAt/aEljk/mSrvKj4Tq9biIjCIgo o53nCEEkmYf6kgeNtBRKqfNg0ddAaneqdwzZ7Sh25b72vVSBWwaBVZ6d6S/RsrYndL3woYZ87Xm /dePA8YZOs3Ectoylv+V7MZcEGuIZro5nVhzeMBOYZiBUXedMjRsm87FW9+ltwQUiAeZfQz+6zI nNOeWzApu4vwd0hMs9rtxT3GRXGaQKpXx+mGZBn1Yq80KptRmM/VUbh9rfGHjmet99x9gtRchCh 2ACbns1aWtM+B5mgT7GFsDeG46pOv50D5+6uuGsTdssLU10ve6GAQpD6S3ks30fY9kQY8/FsvE2 RKDd5G0DJ4BmukghAk+CEvLjouL/qWS+JDyjagXehsDB16fWjwSmxOKHF+TmaOC2M1uS9qiz5wS /6f3WIunj+fATUaxSl5bQdqcPthCVIh7B8BN296a5zC1QRO20KkJF/m6PNIGSKzstuOJNOLhYE0 d6QPrHLcpkEmVsw== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-nomadik.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index fa19a44943fd7ae167079b34a48f669a38ec4ae7..296d13845b3009a52068ecacd8d2d6a25eede9d6 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -347,8 +347,8 @@ static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned int offset) return value; } -static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned int offset, - int val) +static int nmk_gpio_set_output(struct gpio_chip *chip, unsigned int offset, + int val) { struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); @@ -357,6 +357,8 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned int offset, __nmk_gpio_set_output(nmk_chip, offset, val); clk_disable(nmk_chip->clk); + + return 0; } static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned int offset, @@ -672,7 +674,7 @@ static int nmk_gpio_probe(struct platform_device *pdev) chip->direction_input = nmk_gpio_make_input; chip->get = nmk_gpio_get_input; chip->direction_output = nmk_gpio_make_output; - chip->set = nmk_gpio_set_output; + chip->set_rv = nmk_gpio_set_output; chip->dbg_show = nmk_gpio_dbg_show; chip->can_sleep = false; chip->owner = THIS_MODULE; From patchwork Tue Jun 10 12:33:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 895379 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 9F67D293B78 for ; Tue, 10 Jun 2025 12:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558816; cv=none; b=oMUuz7s8xdWghGmi//+81yfItHRRo2afDL11CbSlF3lyh72RRHUdTKrQIDSqvTUru8/IMqbbIzKn9JhHbdjJBA7AAS1r8/Xj/f8RTtb7aucQWjr5mnfJd8gInc3z1eBsek+gZS/V56tvZvZQcF7xXazP8BiGDGvGl3nhiDbHFi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558816; c=relaxed/simple; bh=PZhBn1xIuX3piPV0sigQffEqzYcuLXEK3ObYbTHxcOI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HrdvSrqqlv0ThIB8DpAw0PCNAskGmG3OKHhInKL3VmH1t+Ji6WHOobSxZXgoR/M3xxufZpI3zeomepa7qbt+5hZqiY4aTFhrela31umZmSNLK2bRXTSeNVBg3YeDkICHsUUSlfQVWbyJrSsQOp/oioEp7oR+uduXdUnT+CNTpAs= 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=xmAZ5KL0; arc=none smtp.client-ip=209.85.221.52 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="xmAZ5KL0" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-3a375e72473so2741997f8f.0 for ; Tue, 10 Jun 2025 05:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558812; x=1750163612; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4aASIZHuidOjhLiw96O1OXVywQzoanXq7WKY8AyplZE=; b=xmAZ5KL0sslxXJJ7bHglKZMrqn/XEBUs0pcj7LzLr1nupVAmuNY593Ft2qVM//fM4z 7DK/lMwi4ezdm9qdMQWIyYwf0vDQ2cTe3lLCwfvmbkJaOhX8ZWyD8Rzgf/x+tJ/RbfwB uYJMwl94xwCScQv8EU/lMkHAmTD5nLcLiyyjX/hcqHYu+PRLakCiThCTb3ZanLWQ/zRl C+N+DbFKY7jJ23YDMpX4gqHzYYeGWqdHvzSj1hNCJne8EyJOejNbV4m+NBHJTfAZ53qj LA4zdVEotChLol+fnQ5SFH9a55rUpyVD63KJeqi9Cw7BKWlbV/UKwUpEIhhBwd8BIxbF LfAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558812; x=1750163612; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4aASIZHuidOjhLiw96O1OXVywQzoanXq7WKY8AyplZE=; b=K9N5iz4SCaKtz4S5G9N/pBH+deTnxrcQr3vcAk6NZY2EktS8udgAwGs3gnUjWsDydZ IIIhocJcDfH04G7UgznyXCBz0FoFa42VasNXY41hbykgsGzz0Sf82bhcD9V9X90GgL/i t6BRXuv6tlEUEqdqN9ZRpXsE8xFpSo2xL7ngzWcTqCAVJdApsH/nu70jTooJObA70rB0 CPmzXh8SwtUo6GU9/iyjoszIn/q34db5zYoejr5HfdNyu5ShEG7jmlW8l18mvO8eAxXk 5F9kw5ufVYvB6oJsy3i+ZfIvhGhrX6rxWmXL1xqxIAAeAZQJryjmqL3ou+ic0tNJN55q c/sQ== X-Gm-Message-State: AOJu0YyxANVRNBrImOs3tbJoiNv7XitctTiEIj0wP9/txYt6qIN4mQKP QsS0OqNBQWrEFopOM5GZbzFlzAL7LwRHjJM//7vYf5MI/2yPUZxttuEjqlPFh+6z+hTUUAZlA5h G3cGD X-Gm-Gg: ASbGncv0h622dHL4LjdTDAw9AppOW5EVjS0isogN5TGyZqskSj+rEZa6iAFAMSwi8p7 EcO+hF+Rk6osW4/zCOCJBHOhuM+Ge3axBUcE0EbOUntonCII6wZQTvxfsAOT0E4Cf5GxX+qJP4H cngPDzV6oh2rt88AC31olRvfQsTRsvKJ4Le1QcGa/RbVx+g/p+TdmWEKupxQFop1+gQfi8cc9ug iX+ptrrcqUO/p1Uee7w1RS5NT0RNYlph9UTS50jpqOS3aCvXeZgQtMC1M7bnLHoaSsa4A5F9cAR zHZMvyKIAbH4/ReL3IiJllIahcRJxQRNp4E46EbY0NxB1A6lTaRyPg== X-Google-Smtp-Source: AGHT+IEbu/ISHzm391WeAgpZgQpxCQMU7l5sRhpe0Dp2uNZQ9BZI4WIWzmuf7o2/3fpe+9gfV/kFtg== X-Received: by 2002:a05:6000:40de:b0:3a5:26eb:b4af with SMTP id ffacd0b85a97d-3a53189b56fmr12109336f8f.18.1749558812389; Tue, 10 Jun 2025 05:33:32 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:32 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:19 +0200 Subject: [PATCH 09/12] gpio: npcm-sgpio: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-9-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1639; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=i/xwhpR2l/6SdoE5H3/TW1iFI1pUsif0v71k7JJeqSc=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYQx97BIIpnbWW8Jl0scOnlXA7m5aZIgz1E2 ednyGv/bMaJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmEAAKCRARpy6gFHHX cq0GEACXL/OUOB5vGKp6qF7twwq2LopBjxJ+a5zMR6wQvdYfBG9QBDMmaPSjuf2kmkUtUbYu7HA Z1FBKLRGSyx1X3/aaozewD1qjyFA6BkSTZNtKnHHfFciGdkPfYwzAX9dewnRrjYmGX2RAk9ab4e VC9jF4zGQI+ngGuFjOCR9B0GScsixBBssQZWPx/+mzwukpk5PSJhpPvOSlfJzvaG3S7/9LenY3i pIK9rDUEeMNityyi7CSMetFo905zRiQvyOHu42Wn4GMCKaJgXg/wVA2eFw3JOFTg1S9deQKieKa LE2ed9MQ9rCTGm11TRojU7n44J9uERZp2a3XOuVBWzzyL7woBfFsFkzlB4IGf0whMN72a8zT18k wvRyZKhQPTk9EDwIQrqjDA+BhifztuHVUog4jPZq4XzFYBhGmE3SjABwmAdeoJxLCO/vbmNhLPk 843qnKqNHnzQaryTQggkzqEB+E7vcapL8cNvyCLhIP3Tu7PPt0ucxtKA/gTsjLQ5BCoy7qvv6md 4ZAH+iSl/g/8OCXIpZ8susfIxxvVBcI+FtWCvNWRFB3GwFz/GVm0eZC4SYWn+8kzCc2tvzN7mHq f4OvLY1WFa2WQtksGlajI7JxVWIJlosIN7MPl/2Fh1XVD9Zl+evDL2mc6wIWcMGBUyCJql3EvIK KZdOoABhp/23yRA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-npcm-sgpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-npcm-sgpio.c b/drivers/gpio/gpio-npcm-sgpio.c index 26057061454348d383129267e8bb0b8c506ea5c1..b3953d1ae8af45f4bce9b799434547cd8770d9df 100644 --- a/drivers/gpio/gpio-npcm-sgpio.c +++ b/drivers/gpio/gpio-npcm-sgpio.c @@ -226,7 +226,7 @@ static int npcm_sgpio_get_direction(struct gpio_chip *gc, unsigned int offset) return GPIO_LINE_DIRECTION_IN; } -static void npcm_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val) +static int npcm_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val) { struct npcm_sgpio *gpio = gpiochip_get_data(gc); const struct npcm_sgpio_bank *bank = offset_to_bank(offset); @@ -242,6 +242,8 @@ static void npcm_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val) reg &= ~BIT(GPIO_BIT(offset)); iowrite8(reg, addr); + + return 0; } static int npcm_sgpio_get(struct gpio_chip *gc, unsigned int offset) @@ -546,7 +548,7 @@ static int npcm_sgpio_probe(struct platform_device *pdev) gpio->chip.direction_output = npcm_sgpio_dir_out; gpio->chip.get_direction = npcm_sgpio_get_direction; gpio->chip.get = npcm_sgpio_get; - gpio->chip.set = npcm_sgpio_set; + gpio->chip.set_rv = npcm_sgpio_set; gpio->chip.label = dev_name(&pdev->dev); gpio->chip.base = -1; From patchwork Tue Jun 10 12:33:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 896415 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 63186298265 for ; Tue, 10 Jun 2025 12:33:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558817; cv=none; b=gtPpF8pFCRcffE84isGqjcpG38esUd5P4OL6mScXjx/6wNCgtsOYm9utbPjwlLvhQa5QTjNQQNZWHILOO8Zwvrt1QaEVEnx5WEp4A6xfstTUCRc2BiavPfS+IJAN6TCMlgMz+uodmn6ZP8nPGn2EVQR1c4WyzT9FkdDSwe+NBZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558817; c=relaxed/simple; bh=UCl60XA5zybIlle3UgD6Tp3LRDopzHcyoITVtLoPMAI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MPCQAQWvzJcQIL5/t7VQ1WXlFrSszClTxIkOFM8td8gYuJBlR/mVusNCEQ6U0X1tp+TCZpeKEyXooSjLqUiz4VyXZspWfQXofUaVHPY7n50tbQVNWiK7AvhZLHYiDATI2Tm9EoMfupXUE8FVvCPeTKH2ex7j9UeRTaUx93Wmgo4= 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=UuFfONuG; arc=none smtp.client-ip=209.85.221.53 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="UuFfONuG" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3a53359dea5so2245844f8f.0 for ; Tue, 10 Jun 2025 05:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558813; x=1750163613; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5efislHrp/JRAcyS3DpceL6NreL8VPyCFAzfIt/z8uY=; b=UuFfONuGYfAmEl+pfrIiAjBLsfvBNV5T3w3ILNO1YOZd4J6cxihUc2wN2P7E167voH HwiDbSYjsyVPIGcRGb1FJ627bZ1ln2Nv+rnMOPPnBKcx/h2P7Mad8a7BhK+JJrvuwfP5 c9ZqiTHMiRBgpz6895+p1JBfag+CpaTIkrn0haNC59HSAdpoLIQeagJ0cOqz/P/BJcKy Tl1BV1MjCpkGaGtPr+XmcbwdNQe3tJoXkY4d5rnxOawkGZSmiF+D70BxcHavx++pQ4wO uIERCUG2afnqof9UlOz+HcGfldI6YBvqHFJmAzm328eP+EsvWY3OCy7z+3LMpbVLMgfv ejKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558813; x=1750163613; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5efislHrp/JRAcyS3DpceL6NreL8VPyCFAzfIt/z8uY=; b=qqDYICYC6RbPnx4YFmALRMwDFK6fcZkovK5qjvDZ9+pjfplGYeWRp97DReHg4sj+31 29qHiyGQgjyOLXdcJXd/tIriRbpTUfD0n7TKx/bH964kfXg1qT+3iEhuQlAjdIkby6Po tf0G2V09IowBHNZck61s0Yo4vn1sITsvdT5cy5RBhdH7cJ8QHsIqe6xsqx2CsxfuNObU z694T0PGBPfMO+0TAHXLcCCRY5xCcMYOM/0WRqUeJHPEeV/gyjfXfA3xdJUz67BQfKqj dDbE98bNfCkXDdujQwfpgWFJm0P3p6ZglyrgSYsabcxr0bMMnk1bmkSELbMGJCvEPeTq msKg== X-Gm-Message-State: AOJu0YyRtx4LQXHjhBgDePP6WooRoXeTNV51crt/zkW8nL7t3C0OJ4Cb zi93t0jvfdWib+xwAIUiiiJliH7LEe3Ve3OdlXoPgI4gWCzVVpLwN1zI6LlcjN+gCpc0y5vViPA WnXQ1 X-Gm-Gg: ASbGncurPICxtL68YkNqupoYGUTX8SHr2cy/bSH3TdBfsxPFBu2yjvTkHVzRqbLY04S 6cP7HopCzOunUVzoZj1S0w9XQBzugDof+ogOrebNXOJ+w0vSwTY/IaNkdBmrhRC+HuBvZAB5zYN PT++s5M9acMDTAeKmcdmzIXLGzBp5N5KvfZEjO7i0tG2Ck7bHbh8rDLx7I+tjBRu/NCh2iefAzf d2ig/LFittFQPnfjkIeUOkUct9WAik8nXbDdkaQjfAFuONj0lWsK58J5e5AmFv06ALJ3nO/ROT4 rn5JoP1MpSumgedzSyQW6kBVqMIc/k2YbNmDc5SUKTejZMnvpp8p0A== X-Google-Smtp-Source: AGHT+IFgyML87FC7sXwU9H5OuYAASfbZLFGVxDzw97GzCafTQDbHfQzd+kDvtAb5xiwbEFxqnYxW+Q== X-Received: by 2002:a05:6000:250f:b0:3a4:d02e:84af with SMTP id ffacd0b85a97d-3a5319b5ca5mr13136061f8f.58.1749558813586; Tue, 10 Jun 2025 05:33:33 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:33 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:20 +0200 Subject: [PATCH 10/12] gpio: octeon: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-10-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1497; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=inYE0B+JIbFcYN8GhgAuP7ekd2fsyKlPqwAEHBeRQ6M=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYQkSSfeELcCg3oaC15IzD7nqU50aRHnj20R 3Vt+fMHWlqJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmEAAKCRARpy6gFHHX cqyAD/96GLYr1WlD8IQwvSvdKxhhNMNdPLuDvV+muwAcy6JTo0yVwtFi29APezY85UQRA1fBdH8 tBj9XT9r93hwmuW1csYQjI0Y+hbNfmuqJcmQBr6Dzc+ADZk0/dhgqr5t3VHtV/Ur5QvhQGvn+k0 2lsUOiGUQvMHc8A04WFfw6ek64gegW0vBC+68qMehtMzvgGAwtsk3D9VnjQ0GjZmqeVb/r9sGrz Eu41NcHjU6rXmgqDfSm2H1qMh+Ak5Dp49H9cDZbQ0wM2ODNFF3rLCiuZSdMco7jGPXJhK+BIvQ4 hi7fC69+1/XtsXP59x7xhKZjX5bYObsb9oC6CwW5BaOxMmXKR7Pt47oshFdfYmzRxaJDNYTPcdu gSxBr29xktm4DI9JI+25hY4hJQpSsrQOKCBxGiU+55W8miBMG8h9pe71LysUt8Fr8AR8LbZG5sa Iqj+eIMUujT95lGnffsd7RwYWfvennBwTykRmBumWcA1HNt7m/gzgU8Ktm6ZF8fkNzEtgu5yWrk ijJFq/SPI2UnsQcs5HEbTJe7Ujvsck3MfkGILvNmjHgK9NVsdY+Kla3dGFC0oqKxRSxxlo19Vvq mg3UGgaOALMKfIcTu1FOeAv+aBJudryS+uU0V2ore5yflhFusBi8OdDuO+BF/7pbSoZ7qOIkPV3 QRPFnoLRMWGdKnw== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-octeon.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-octeon.c b/drivers/gpio/gpio-octeon.c index afb0e8a791e5a8f1b3029c4ca890a5eb9b8efe44..24966161742a96082baeb850f124c71b894e9057 100644 --- a/drivers/gpio/gpio-octeon.c +++ b/drivers/gpio/gpio-octeon.c @@ -47,12 +47,15 @@ static int octeon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) return 0; } -static void octeon_gpio_set(struct gpio_chip *chip, unsigned offset, int value) +static int octeon_gpio_set(struct gpio_chip *chip, unsigned int offset, + int value) { struct octeon_gpio *gpio = gpiochip_get_data(chip); u64 mask = 1ull << offset; u64 reg = gpio->register_base + (value ? TX_SET : TX_CLEAR); cvmx_write_csr(reg, mask); + + return 0; } static int octeon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, @@ -105,7 +108,7 @@ static int octeon_gpio_probe(struct platform_device *pdev) chip->direction_input = octeon_gpio_dir_in; chip->get = octeon_gpio_get; chip->direction_output = octeon_gpio_dir_out; - chip->set = octeon_gpio_set; + chip->set_rv = octeon_gpio_set; err = devm_gpiochip_add_data(&pdev->dev, chip, gpio); if (err) return err; From patchwork Tue Jun 10 12:33:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 895378 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 AB063298989 for ; Tue, 10 Jun 2025 12:33:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558818; cv=none; b=pQjuUnf7cCxvLHa9H0enzvbZof2CZbgBileNBj0kIsfWLk5zMuECV5IQwnAVgJb1UqsGLgwEzBNKWDril0c7Tu7VSmpUDvmDO7A5IBQEDLWP2aj8O+7ADT+6Y2Fg9/IRAzRugBWTap7IyYECqz51DS5pZbZJmozsTdVT0T9U4eo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558818; c=relaxed/simple; bh=uthcbW/WugGsTwB04iDzdxOtDJLGhQBk2AOOfRbDexo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QZzXgsUoqA85IQ+jF81h/SG8LL228sZv2IWcvSZLMKMQsSAvLGVrixiX01vObAznxpIwTzTu0IiCfImvX9L4GrGGHkjwtoJKzbgBqPN+cCBY1amTl/FEqRD8SrR/7NTdZfM6dG0K20+BHpvAZIpEq/Tvb4s0zksXIl6hyT0zGPM= 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=04pGALaB; arc=none smtp.client-ip=209.85.221.47 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="04pGALaB" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a3798794d3so4623292f8f.1 for ; Tue, 10 Jun 2025 05:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558815; x=1750163615; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gWwWjRL2sG1kaP1KpOhM8tb9lVTY5ImgVviMKu9J/kw=; b=04pGALaB8P6EWD7G92F9bhDEIKSjITGKDYzUar7La0dHp27yoCwZC4Pv5VQ/miCWwJ 1h2HJNCmgd22Bc5yf1ledbueU4J33dDvs8jEAbnA1KU5AY3mL63k5bVTrOgfq9bOEDqf xE4vpSqGTIACrMUMtgb4UnYop8arAeIrcFYN+iZZmelo7OR34NP2/8MNUWUweCJMaqpQ b5GGR3n6JpcxobG698hRQEDhuTYJQrkvt4EBT6eaduly7QZHUC4knk8TgwhwnDZONCUe AbN5uoGq08tX4sXSaJWbtzR6AZATX1cCjOzdAmmIqYUW2WCvC1sTG0oHa98J0kpEEvh9 bzEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558815; x=1750163615; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gWwWjRL2sG1kaP1KpOhM8tb9lVTY5ImgVviMKu9J/kw=; b=udTixHshDMgkke0pLrCQEiIkRmJyx4rE8CHF/cu39OiYglJfosZeSlDpXpfyPrUPh2 J11YBdrqTiMN7x7T70H/XE5Lq3ghKxbR0jQ7Mg/GEwAF4qwSI18ruuassJZeLw1I4GjX NRiCaKiKtTCWOb9XODbxSw4Rd75y71xZWU1bY7Wrb0Ldl8516Y/PXgi/MrQIoI082qPm vTaFnkwO0BT6HZXnM+XPkzssEsDke97hgBPAwAHPXS/A4mlmCKS2ll9b5IvPXrHJrQ9L NIJJW2rI0D/E2NmfpVHbD12KOohyvtJ5QABntmbKjXmIUv/pEqSSaYZXTV8GgYJv5VNq YlrA== X-Gm-Message-State: AOJu0YxwvxTcxKVdn47Idh+rHJye4hUzziYQE4maA+ITk9J5B+QFqLe+ ViW3fJ3PCZj6Gzv7uahcCUY/Gfj12c1jcUivyhWFbRulvURA3LUpYc4RBeNijYgSeQ+iSRfAmg1 RC86D X-Gm-Gg: ASbGncvg98V2eYsUJHMlTtK3TdS94t90X0S1VZSdchctPS1/kf/5WXrYp/4yUmUA4Jr ACtxkTIDyhu06XyDrmw5Q4r+hw5rnPmoP2BMqVrJXzByelIe4KZ1kCsXeFUbSosYgpwlS+l0I/+ wTltWpcRlikJq1UkKCKqjH+O4lfnl5+HAc+tmOchanWiAjI+pWXv2fOdgekLorVoRMXOOEecait kmO2F+23rhzKlfXb8LuGy21lSsJB8NlmUOUJVjrT1ZnvFrQ9rDiWp5A8sWrIAvPAkpYH+1QC7JK SFx3rX0y+I395dx79K2J3q9sfRFu6v95LCUfJHs0P5z1CKwBbdJBSg== X-Google-Smtp-Source: AGHT+IG1enS1XXO5MOMxHtGmC2A0TWdm1D38HYK+u7jLnOQJgSRjc8Tt9JvPkZ2QOIrOTK0nknN0Zg== X-Received: by 2002:a05:6000:2389:b0:3a5:215a:39d7 with SMTP id ffacd0b85a97d-3a531ab525dmr12050338f8f.22.1749558814690; Tue, 10 Jun 2025 05:33:34 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:34 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:21 +0200 Subject: [PATCH 11/12] gpio: omap: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-11-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2332; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=yxpS9O8VyBwfb+1xhv8Bj1RrUY/8b3PCfbF1mQmw8vo=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYQMAyZ2DFFK2uTaeqWWkqsZrltQtYiNFD+/ MelCJUiekWJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmEAAKCRARpy6gFHHX cvAID/0SZN2Wd89qaQKgmmxwQk154LwwnFEUma6TiDSVFl0DYCIyoSmt+4ywy6/N7uybzS3xzR8 wryJoLAuEDE8ndyVqjxweeVzP7/rSL0157QD86uNoS9RgjehI6GFWJY7jqIc6nzQRqQfjd4fA3y X51hb1N2boKXviFHtrMXrT7QsCH1/kB48RoFDmsxczMlCRDLNmLHEIBMoB8uexb7RkNv+ez4VgT 4NqTADOXTj5kyXLTw5qABxy+OwvryoTQ0Phb90w9APCydzyQczAe+9qHW3XRuLHAXxMBVbPU3Hx czk2B4JWmnEmFMRSA0SthrZJk6pkl2RKeEPPxYXLvKA66IX1VmySqrHMqjEIlkje8vMYXi6HKdc OJx9I2c1uADeWrv/LWfubC5dlHXIe/Yz1MXY7PhBRom/bSOw114vQPADo4f1w6P0VhrS+IJGhgF lP1JWjYKSlGAJOlR4Bdan7uk5QXtcrn3bltIR9x1vJCMlmuZYZrNQzl27offS1w06rUuUK9uvwx IZRnZ6UAUfXoIAB0gbyqa+sORMJ4MXo5x5NShZmGLERhonmyI39orc4HEcm7a9p/qtiuD17AJTf U4MrqzutczKRKwe3qRSf3UFrc5gGSxR4yPGEGthaKAg1WdSyA7jHkMNgTpemGF7psGH7iDZk02R AGAbHK/H1WBZtCg== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-omap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 54c4bfdccf56812b5f79435a97b6eb90904ca59c..ed5c88a5c5207063e1269763e6239441a42e0c3d 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -953,7 +953,7 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset, return ret; } -static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value) +static int omap_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) { struct gpio_bank *bank; unsigned long flags; @@ -962,10 +962,12 @@ static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value) raw_spin_lock_irqsave(&bank->lock, flags); bank->set_dataout(bank, offset, value); raw_spin_unlock_irqrestore(&bank->lock, flags); + + return 0; } -static void omap_gpio_set_multiple(struct gpio_chip *chip, unsigned long *mask, - unsigned long *bits) +static int omap_gpio_set_multiple(struct gpio_chip *chip, unsigned long *mask, + unsigned long *bits) { struct gpio_bank *bank = gpiochip_get_data(chip); void __iomem *reg = bank->base + bank->regs->dataout; @@ -977,6 +979,8 @@ static void omap_gpio_set_multiple(struct gpio_chip *chip, unsigned long *mask, writel_relaxed(l, reg); bank->context.dataout = l; raw_spin_unlock_irqrestore(&bank->lock, flags); + + return 0; } /*---------------------------------------------------------------------*/ @@ -1042,8 +1046,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct device *pm_dev) bank->chip.get_multiple = omap_gpio_get_multiple; bank->chip.direction_output = omap_gpio_output; bank->chip.set_config = omap_gpio_set_config; - bank->chip.set = omap_gpio_set; - bank->chip.set_multiple = omap_gpio_set_multiple; + bank->chip.set_rv = omap_gpio_set; + bank->chip.set_multiple_rv = omap_gpio_set_multiple; if (bank->is_mpuio) { bank->chip.label = "mpuio"; if (bank->regs->wkup_en) From patchwork Tue Jun 10 12:33:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 896414 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 103B1298265 for ; Tue, 10 Jun 2025 12:33:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558820; cv=none; b=ACKtyr+/K4OhYx5uO03761YW4fDpKnmXBWqbb6s9BL+QuKOzHsayxSMFkCn0dUGelUdLqy1PPVqyFGuDPe1R2hSlIgQdGcN3h9gqDvJKp2mSjEE24/DCg+ELW/weVqM3lmqS7waFhd155D2Fv0S9ARN4zpU25k4lqtGzy6c4VJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749558820; c=relaxed/simple; bh=4QCGnoq1bJCjjIi9V2/83E22w1djp2GNx3m7VM1JT4w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RfvhRnBMylDntJmUTuDq1fQRCnUvYel+16fkAMjRMyN8a4llpcfedPiA3oSzBA+AjHYsdZfOOwnkU8CQKnRgh0d+b30NuiwDM6tLq/kF4npMk+oILxMTx+B25oQpF3qSH6UrnaYIT1Y4jpyjHeufMHYim8iAR7eusRmyUhrWcqY= 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=js9xeNw6; arc=none smtp.client-ip=209.85.128.48 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="js9xeNw6" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-451e2f0d9c2so42020785e9.1 for ; Tue, 10 Jun 2025 05:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1749558816; x=1750163616; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=v8UnWEBUMwJQl9FRSZdvSbH7HNUPtGYFMHksq5VfCCE=; b=js9xeNw6AtNzjm/DI4DYkU/s34MWcIrjX6MjFW0iM3YMdx5sUa4ZKV7AsORG693Ua0 wvj/iRhlsx0ke2nPiI5KVHW0nSYT5y54TEYzCxhkk1m1DjM5boHC7/3NTdoidhsnLWL6 yfkrx0VyWANYQMwLrhD060ZZxtX3sc9lxLAM5Ktk5b+/6ae07o07cinxypjyKWU2uu8d 2dAlC7jE2i+H7u/qFlYpoNO+tObQs0ehtqOFQypDv2JOy+jMMB4MhYMLoCzgsiU9HJ18 kSp5nhOaZIdKqr4+TV+JYIIqZffDmmWdAHleoDbpi17SwQuQ6Mf57xEKA05RFWWq3dm1 zxYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749558816; x=1750163616; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v8UnWEBUMwJQl9FRSZdvSbH7HNUPtGYFMHksq5VfCCE=; b=hta+Aq2tfZN0gr/HrGOzCIibaRToRRXwZj8L4/SmOvUBLkIYSNox1sz00xehk47VYF tzxetRc6lY65vtZGohRuJlyyuLnNnsru3/h3yyj3GoHXon1t9nq4sbDv5XY3aEHshcz5 sxO3bQnXtx3uhF1en+HNH4py+n2JtQl4c5vxLs5pAZr4Y8WUc3SAURsv8Uu6VpiJaVLF rGKCKhzz946r+p+rzrn4kuNgLDexkIDZcAjIHr3AJM5g5eGp1hD4zDYAafc49ipMrHeK h7dGum4KEGVXYHbHMcZrG9u9V7I4RAn1ftllVEUTdXJA9cBtqcHjWODwxGKvFp2eZBo7 +ySA== X-Gm-Message-State: AOJu0YyG7YjRT0fg/WpbCFSRJwlHX3shOcK7NJtu+R9Zf6IAPgCh37xG 67Z3XkV2VTWZLF9lEOzZ5CS5atlxI72zYHcdYmMZmF08cheEymI7mFioaOR4CeESg3n/Ya1yLrh klVet X-Gm-Gg: ASbGncuoZJmCI/pBvWCbaHyZfjFWpiBfu14wA4+nNxjNVuN8OWwwQ50Luju72vMovsv yycNojBuirwtoHulYnyZekzTo7KhcOg8dEEV5xcUMqZo/DDYJxEDMwWf5puR8T82YCTxgAtZpx7 vYSWZDhb+miWzc+qCTnSAcYNFgrnIMLb8QH5FsA2Im/QR/280cYkeO95bV0B6coRVLgHv8x89LG uWBuTRxKPLujpklXhpfp0NKN8y+vPobaU/vMzjkF46UEn/TB/9fnhY6WGEXN5REKxCHZysmpLe2 X1nQ1ymfSrBFc3vfrcfwIDhAJygg4j4QT5Mvf8J1anwPNWLuEuXlUA== X-Google-Smtp-Source: AGHT+IGEb945pctd/19j/70DlEklbdpCSjS0SXNKlhgiB1IZnKkMVBIGu/KwhCfcg7w0J6nsDegN4g== X-Received: by 2002:a05:600c:354a:b0:453:aca:4d08 with SMTP id 5b1f17b1804b1-4531ceb5f3bmr32427015e9.1.1749558815837; Tue, 10 Jun 2025 05:33:35 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4d:e52b:812d:eb7c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a53243661csm12290668f8f.53.2025.06.10.05.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 05:33:35 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 10 Jun 2025 14:33:22 +0200 Subject: [PATCH 12/12] gpio: palmas: use new GPIO line value setter callbacks Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250610-gpiochip-set-rv-gpio-v1-12-3a9a3c1472ff@linaro.org> References: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> In-Reply-To: <20250610-gpiochip-set-rv-gpio-v1-0-3a9a3c1472ff@linaro.org> To: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Marek_Beh=C3=BAn?= , Conor Dooley , Daire McNamara , Daniel Palmer , Romain Perier , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, linux-omap@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2364; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=EJnUqbYdFsX+B+uS77CC3tICbyCNOST1Ifh9i66zy3o=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBoSCYQH0s51YOk3kPi1uWti8T4ohdUn/yx53NBp EPSYm2TbnuJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaEgmEAAKCRARpy6gFHHX cl6HEADDb/gC8UYIxfieGcIPlCLMVRxpN6B1QvZbRdjguBGn2V1R4KRaQVA4VHY6bdnfwHfmTEs PyBGCdOw5W7KfEBvAHi1BPRg3jZ3AhPL1MBtsbCUu3wkmJaME0MAZRi/9kTVnBd/90m4ady4fob ZiVpTNRYaxU5/agaxspedLUZ8yS4ru+4nvF6UhNZ6xCbzJJ098pcxmRPwL4nP3Kk1aFacQAXgoI RlFmAUUCPGcr+/1hQ44LYPBhD9CFSxqmk0/peAbcioUE+37xiupVSMPVtmphojgLgRG39WdsAW6 wHLIbw8YDioA5qjexp3hLxB9k//QX08V8iDF9H4FALJgdECvDhjcNfqx8yoMW+M1koIJkBDfnZX ng84ih0EIA0Wh6fqeKTsbJ4JOE6/eR2EdcuY3FxX2k4O2JDELoEnc/UERh5Y4DHuNtG520m7uyt D2MG4nZJAZjiBZ4wZ1bDW0t09L+XCI8V/1vpwCxDVmhkEeUduyWT9w1zTgWQ7at0NdbYAgZ+nG/ jmrJ7UptwMJ4P1yZmWdfEYXlSODp6TjS+tPzWIXQcLoS3eRRpTav7CIm+nr6xe3tNiOPBqNb1H1 ZqpzpL7iVd8AuUaR4K75BWnU1tcbiTDFsuLnE8/CZ51sfmEAj0VyEK/pDJgoZj7ekTL7Yr/ve8p M8J1VvOFz+l99wA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-palmas.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c index 28dba7048509a3ef9c7972c1be53ea30adddabb0..a076daee00658a9e423a0d78f14ad48d61956d7a 100644 --- a/drivers/gpio/gpio-palmas.c +++ b/drivers/gpio/gpio-palmas.c @@ -54,12 +54,11 @@ static int palmas_gpio_get(struct gpio_chip *gc, unsigned offset) return !!(val & BIT(offset)); } -static void palmas_gpio_set(struct gpio_chip *gc, unsigned offset, - int value) +static int palmas_gpio_set(struct gpio_chip *gc, unsigned int offset, + int value) { struct palmas_gpio *pg = gpiochip_get_data(gc); struct palmas *palmas = pg->palmas; - int ret; unsigned int reg; int gpio16 = (offset/8); @@ -71,9 +70,7 @@ static void palmas_gpio_set(struct gpio_chip *gc, unsigned offset, reg = (value) ? PALMAS_GPIO_SET_DATA_OUT : PALMAS_GPIO_CLEAR_DATA_OUT; - ret = palmas_write(palmas, PALMAS_GPIO_BASE, reg, BIT(offset)); - if (ret < 0) - dev_err(gc->parent, "Reg 0x%02x write failed, %d\n", reg, ret); + return palmas_write(palmas, PALMAS_GPIO_BASE, reg, BIT(offset)); } static int palmas_gpio_output(struct gpio_chip *gc, unsigned offset, @@ -89,7 +86,9 @@ static int palmas_gpio_output(struct gpio_chip *gc, unsigned offset, reg = (gpio16) ? PALMAS_GPIO_DATA_DIR2 : PALMAS_GPIO_DATA_DIR; /* Set the initial value */ - palmas_gpio_set(gc, offset, value); + ret = palmas_gpio_set(gc, offset, value); + if (ret) + return ret; ret = palmas_update_bits(palmas, PALMAS_GPIO_BASE, reg, BIT(offset), BIT(offset)); @@ -166,7 +165,7 @@ static int palmas_gpio_probe(struct platform_device *pdev) palmas_gpio->gpio_chip.direction_input = palmas_gpio_input; palmas_gpio->gpio_chip.direction_output = palmas_gpio_output; palmas_gpio->gpio_chip.to_irq = palmas_gpio_to_irq; - palmas_gpio->gpio_chip.set = palmas_gpio_set; + palmas_gpio->gpio_chip.set_rv = palmas_gpio_set; palmas_gpio->gpio_chip.get = palmas_gpio_get; palmas_gpio->gpio_chip.parent = &pdev->dev;