From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 8A4C233D4E9; Tue, 14 Jul 2026 08:46:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784018777; cv=none; b=SCCR/BmpkIr84ULxgDOU8Khfo/1lsrZcCpf1vP64qLlOYZRO2O5F7XZLlFS7UXGnPJnTZOiI1fyMKb4hpAN/85qQvq8tFqNzqvxdxrDA7EZmUXZVX+UIwSds+lej1+1VsQyF35n5poluwBjjJMK+HCVN/atf7v9GSP+M7TPAjys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784018777; c=relaxed/simple; bh=xxJuEvZ2G5Kbr3szIgk1JdoMkjjna6X5BPLRDG4VrrU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t0wPaqIM6UNcm0RQo+9HZRN6FvorvQcO73S30MylaqUnUOv6krY/l0WhzVr6Mf5L6dAvokQhRc5NsOfLwQK7cHrlkf23M//LrqrsvfUGKMBMpUdFmo9u8ZG1AhRHPpmzDPA+6L+nPs10XHOVhSEFLf07BZC4LPaLZDrSn0mbO5Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SWxNvCB8; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SWxNvCB8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784018766; x=1815554766; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xxJuEvZ2G5Kbr3szIgk1JdoMkjjna6X5BPLRDG4VrrU=; b=SWxNvCB8NlI3GaweaAE2iNFCVGLmYkOTI2niYqqpCvAogMdn1XrfY9eB U6njcMM8P9nRhf4va6YHFdPMm2UeVZCEqlP3KGfXE5cGEmPBmqkZgRxdI eO4vCdbCel7RLNaWAyjUdC0wgCKJcgLYaZ0uick+we5t5eqxryzWNd8jZ xaw+fY+CZekss59tICy6FEaj5f1e7aAdMsb2ZnEdDdKK9Zi6nYE90hcY1 V6aN/ps50HVLdiZslQ/BeA84UZGBsDY4PyLjRBfN0Um39QC/WCikhPjEG 6LPkuU88YTtxxrD6QaruS4cLLm/yDjPHuIcPoHY1HTYQZVorPGiIX7Rsz A==; X-CSE-ConnectionGUID: 3mZ2wnGRTSWox8y3MJcWNQ== X-CSE-MsgGUID: 2bXhfC15Sd+rTzDN1scP6g== X-IronPort-AV: E=McAfee;i="6800,10657,11846"; a="88458776" X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="88458776" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 01:45:55 -0700 X-CSE-ConnectionGUID: qtQ7RAR0TAGtJe+16mkeLA== X-CSE-MsgGUID: yJiBbxipTXeGeysSoUXSEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,163,1779174000"; d="scan'208";a="259370157" Received: from kniemiec-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.189]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2026 01:45:52 -0700 Date: Tue, 14 Jul 2026 11:45:48 +0300 From: Andy Shevchenko To: Daniel Golle Cc: Linus Walleij , Bartosz Golaszewski , Matthias Brugger , AngeloGioacchino Del Regno , Frank Wunderlich , Mika Westerberg , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] gpiolib: tolerate gpio-hogs lacking a hogging state Message-ID: References: <4c67cf0839ccf57db35a826df6d8fc779531509a.1783974733.git.daniel@makrotopia.org> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4c67cf0839ccf57db35a826df6d8fc779531509a.1783974733.git.daniel@makrotopia.org> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Tue, Jul 14, 2026 at 12:30:53AM +0100, Daniel Golle wrote: > Commit d1d564ec4992 ("gpio: move hogs into GPIO core") made > gpiochip_add_hog() return -EINVAL for hog nodes lacking any of the > 'input', 'output-low' or 'output-high' properties. The error is > propagated by gpiochip_hog_lines() and fails registration of the > whole GPIO chip. > > The previous OF-specific implementation tolerated such nodes: > of_parse_own_gpio() warned "no hogging state specified, bailing out" > and of_gpiochip_add_hog() stopped processing the node without failing > chip registration. > > Some boards deliberately ship hog nodes without a hogging state in > their base devicetree and supply the state via overlay, e.g. the PCIe > slot key selection hogs on the BananaPi R4 Pro added in > commit e309fa232d12 ("arm64: dts: mediatek: mt7988a-bpi-r4pro: rework > pcie gpio-hog handling"), as the polarity set in the base devicetree > could not be overridden from an overlay. > > Booting such a board without an overlay applied now fails to register > the gpiochip. On the BananaPi R4 Pro this means the MT7988A pinctrl > device fails to probe, all peripherals including the console UART > defer forever, and the board finally hangs when clk_disable_unused() > gates the clocks of the UART still in use by earlycon: > > gpiochip_add_data_with_key: GPIOs 512..595 (pinctrl_moore) failed to register, -22 > mt7988-pinctrl 1001f000.pinctrl: error -EINVAL: Failed to add gpio_chip > ... > clk: Disabling unused clocks > (hangs) > > Restore the previous behaviour by warning about hog nodes lacking a > hogging state and skipping them instead of failing the registration > of the whole GPIO chip. Reviewed-by: Andy Shevchenko ... > - if (fwnode_property_present(fwnode, "input")) > + if (fwnode_property_present(fwnode, "input")) { > dflags |= GPIOD_IN; > - else if (fwnode_property_present(fwnode, "output-low")) > + } else if (fwnode_property_present(fwnode, "output-low")) { > dflags |= GPIOD_OUT_LOW; > - else if (fwnode_property_present(fwnode, "output-high")) > + } else if (fwnode_property_present(fwnode, "output-high")) { > dflags |= GPIOD_OUT_HIGH; For a fix I would make it less invasive and yes, break the style, by just replacing > - else > - return -EINVAL; with else { gpiochip_warn(gc, "%pfwP: no hogging state specified, bailing out\n", fwnode); return 0; } > + } else { > + gpiochip_warn(gc, "%pfwP: no hogging state specified, bailing out\n", > + fwnode); > + return 0; > + } This leads patch directly to the point. The style can be modified later on. -- With Best Regards, Andy Shevchenko