From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DED4E38333A for ; Wed, 29 Jul 2026 09:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785319040; cv=none; b=nYYvPznpQx1kKy1IArDV6M7wzZHz0/C1JQDz4fTnnLfHYy1MrNZENrmhvMTNyUBjNyyKSQ8ZVEebGIGbald2/1K4TtsDND3pc7TiVSBrTSzr3XWXuj2fTeg+U+Fz68WsjEXk2L1p8ea48zCSpM3Kd2xElqR5voRrkeOGHBeQIbU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785319040; c=relaxed/simple; bh=tbXO2VXfcH91jor7uUwyNzWZt/ACys/Pj/NV7aQ8Cbk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=U+ksaOvltIJSnxLpu8uX5deXd9e3eCPXoZNVBQRgbxS8Wvw11ne00vgJTLNB7YY8gCEygWCLQg75PP2HJt5GpqHXyjNsK9YQUcSZIyoxFV+RqdoxCbUoGU7SUEdsKsuKVj/0FHqEqBGJgrh6ODytZpufPe3TLA/khXg4RYayspM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l8wfuk+3; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l8wfuk+3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 064301F00A3A; Wed, 29 Jul 2026 09:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785319038; bh=7lwwiIRP2jwng9cjmpEW8mwDj0gYjaoBAD8MijL5Ty4=; h=From:To:Cc:Subject:Date; b=l8wfuk+339JlTVxfHy3GEQJ2F3GIVuCsfNXVB41SJhoIHLVB5yof5n/rjuOv/Ce42 uAuAMZW5p3od7GZ5I6Nx3VjSY245Q2UJ54VOyRb6CERmu58oGijVaTEXGbK1ua5qv2 83iNVJ/TXO6TpXtrqO1JS6uptG0KYk79m5vnx5PdhioK5rwqxOYkGl2t3ut7X7F+NA zzOeD+Fq56l2h1IjqMC9rm0/dfrHIvaLoiMjT4oLESQr+WVkN81+W9FcIbtGt7ozPJ CzTWMFXg+egNTvROk5QU1oI27eLxBuZfSyJ8sQX7+TvhssS+aF1zGXH4Z0/eqC36jD amOtyEKu06hJg== From: "Christophe Leroy (CS GROUP)" To: RAGUENES Jean Noel , Michael Ellerman , Nicholas Piggin , Madhavan Srinivasan Cc: "Christophe Leroy (CS GROUP)" , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] gpio: max730x: implement get_direction() Date: Wed, 29 Jul 2026 11:56:47 +0200 Message-ID: <2565e33e629d16d9e33086570834146bb1c962db.1785318831.git.chleroy@kernel.org> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1616; i=chleroy@kernel.org; h=from:subject:message-id; bh=tbXO2VXfcH91jor7uUwyNzWZt/ACys/Pj/NV7aQ8Cbk=; b=owGbwMvMwCV2d0KB2p7V54MZT6slMWRlnis6IvWrYW3ie9cNi848uTjrzdF+/7JLLw7lhS69z bT7RtfVmR2lLAxiXAyyYoosx/9z75rR9SU1f+oufZg5rEwgQxi4OAVgIjNMGRkamxaeF2y1OnZe quzoOwubu6liib/1F4d0ds/5k7C17GEPI8OJ9KM7rm7nurEgfftVhaDCTXb7rtWLfmaeOWtSF0N 2+FxGAA== X-Developer-Key: i=chleroy@kernel.org; a=openpgp; fpr=10FFE6F8B390DE17ACC2632368A92FEB01B8DD78 Content-Transfer-Encoding: 8bit The lack of get_direction() callback in this driver causes GPIOLIB to emit a warning. Implement it. Fixes: e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()") Signed-off-by: Christophe Leroy (CS GROUP) --- drivers/gpio/gpio-max730x.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpio/gpio-max730x.c b/drivers/gpio/gpio-max730x.c index 84c7c2dca822..117a9dbff9c0 100644 --- a/drivers/gpio/gpio-max730x.c +++ b/drivers/gpio/gpio-max730x.c @@ -160,6 +160,31 @@ static int max7301_set(struct gpio_chip *chip, unsigned int offset, int value) return ret; } +static int max7301_get_direction(struct gpio_chip *chip, unsigned offset) +{ + struct max7301 *ts = container_of(chip, struct max7301, chip); + u8 *config; + u8 offset_bits; + int ret; + + /* First 4 pins are unused in the controller */ + offset += 4; + offset_bits = (offset & 3) << 1; + + config = &ts->port_config[offset >> 2]; + + mutex_lock(&ts->lock); + + if (*config & (PIN_CONFIG_OUT << offset_bits)) + ret = GPIO_LINE_DIRECTION_OUT; + else + ret = GPIO_LINE_DIRECTION_IN; + + mutex_unlock(&ts->lock); + + return ret; +} + int __max730x_probe(struct max7301 *ts) { struct device *dev = ts->dev; @@ -189,6 +214,7 @@ int __max730x_probe(struct max7301 *ts) ts->chip.get = max7301_get; ts->chip.direction_output = max7301_direction_output; ts->chip.set = max7301_set; + ts->chip.get_direction = max7301_get_direction; ts->chip.ngpio = PIN_NUMBER; ts->chip.can_sleep = true; -- 2.54.0