From nobody Sun Nov 24 18:37:45 2024 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (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 2DC7D1C9DC8 for ; Mon, 4 Nov 2024 11:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730718862; cv=none; b=tWfZEiscR51u+d6cNr/659nuBMiDP55LbFIkvmpdKqvSKIhbylXtkvnSESPq8oHbxv1XJnbTzZXESFzB3x07+QdoUjLMcLKUAVmCQlfmPIWS9jhy3M6q4f5p4HuZNG+M1PrBAIyq8x6QYoK9TaMKmN9ofrgFE+NvTg5T6iarU0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730718862; c=relaxed/simple; bh=4tAzpegFAYNwAozXl43wpkwjaMrrBw7LLt69rd9Qeo4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h8CgAfSDAgEQHBzRMCQyL7w5ogGGcweNPZLp35Z4qVY2lDWDP590yZ50AVIQH6Kt3F53Q752G7WJThZrVDRmVCvyBnezJIKEywVOepQ2qh9jDuzlgHjpgEE9x+sqntEdInAnyGZNNFsR9PL43esucYhYngyutYdEQxd33wtcKfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=KQsKn14h; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=jIQ2LJiI reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="KQsKn14h"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="jIQ2LJiI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1730718860; x=1762254860; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Eep/aycY0RWUrLmTc5EgqAHEe/apPKt39IMJFtx8pLk=; b=KQsKn14hTyvrMBfROzWlrgGUYfYjZD2PRlk6kFOQygdV20IqdA8P3g1t lXmGtwSfdLzq2/jJ5ot3wBd2WqScYkq5h6MWzusZJSleuVXYq5DeLctc1 QMOxyj70F185w9tEHwVkmuaxzMrqZUjBvZURk7JYfI4lMK/1LwshlY7HW 4yL2jkWrEKeHRDBrtFJvaacjzDMQ+gl93wM529GlfjtTHF5skRkkzI53Q 36ph4kENfMVGVX1/+MnkR0Cq48jI2pG7gyVAl9+hwdtxeoIIZj2wGjaGu EL4pyHcgvSAWp1TJqfme9000QpYHXsId2qzzS3aCUgYl7kRBqn0N3W7Pi Q==; X-CSE-ConnectionGUID: HAQ7sPJWTB+8S6XmNY0g/w== X-CSE-MsgGUID: ZB9RrZL3Sb2TC8/NFVBGBg== X-Ironport-Invalid-End-Of-Message: True X-IronPort-AV: E=Sophos;i="6.11,256,1725314400"; d="scan'208";a="39829947" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 04 Nov 2024 12:14:19 +0100 X-CheckPoint: {6728AC8B-15-D31EDE1A-D52D6119} X-MAIL-CPID: C96BA6B3B13A4728FC28B61E41D80E5C_5 X-Control-Analysis: str=0001.0A682F15.6728AC8B.0094,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C02C916A08E; Mon, 4 Nov 2024 12:14:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1730718855; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Eep/aycY0RWUrLmTc5EgqAHEe/apPKt39IMJFtx8pLk=; b=jIQ2LJiId5YPLBkX1+yR/cbaWP1PtuFOAiiUTdUfo6ftkfPv0x0/AjDG1bHVJA5/Ey/Nmu z9m52gWwX0EVxfmM335a5H7jWrvZDBRy4BDHjdfOJMRH+RnLvyHcvnA60Ks4t1HYVHsNJ8 N7cPFl1dR9i9WEnFvv7w0Pu1rdHA9GXzB0t+SO5jYrVZ+I6iZimkq/gs64rerLalfHC+Ea QuFPQIX9qKs1R1nB2jjwc8U6KZ3rjkLVKxNivPOXUCSMNfMB/yHOO05NpzRT6zVZje4hZA KYd8Vw5m5s+xIFaH4HMZnoCy+QcbTdt6dAMok4lBO4YcwOtCR1FIaxIiLCL51w== From: Matthias Schiffer To: Lee Jones Cc: linux@ew.tq-group.com, linux-kernel@vger.kernel.org, Matthias Schiffer Subject: [PATCH v6 4/5] mfd: tqmx86: make IRQ setup errors non-fatal Date: Mon, 4 Nov 2024 12:13:32 +0100 Message-ID: <812ca50b33766b1b528a02a8d5226f21822b2851.1730717841.git.matthias.schiffer@ew.tq-group.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 GPIO IRQ setup can fail either because an invalid IRQ was passed as a parameter, or because the GPIO controller does not support interrupts. Neither is severe enough to stop the whole probe; simply disable IRQ support in the GPIO resource when setup fails. The code is made a bit more robust by introduing a define for the index of the IRQ resource in the resource list instead of assuming that it is at index 0. Signed-off-by: Matthias Schiffer --- v2: no changes (was patch 3/4) v3: replace IRQ 0 resource with an empty placeholder to simplify error hand= ling v4: no changes v5: move placeholder to the end of the resource array, use define for index v6: no changes drivers/mfd/tqmx86.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c index 8aa448a67c9a5..1fd2212bf492c 100644 --- a/drivers/mfd/tqmx86.c +++ b/drivers/mfd/tqmx86.c @@ -60,6 +60,9 @@ static uint gpio_irq; module_param(gpio_irq, uint, 0); MODULE_PARM_DESC(gpio_irq, "GPIO IRQ number (valid parameters: 7, 9, 12)"); =20 +/* Index of IRQ placeholder in resource list */ +#define TQMX86_IRQ_GPIO 1 + static const struct resource tqmx_i2c_soft_resources[] =3D { DEFINE_RES_IO(TQMX86_IOBASE_I2C, TQMX86_IOSIZE_I2C), }; @@ -68,13 +71,10 @@ static const struct resource tqmx_watchdog_resources[] = =3D { DEFINE_RES_IO(TQMX86_IOBASE_WATCHDOG, TQMX86_IOSIZE_WATCHDOG), }; =20 -/* - * The IRQ resource must be first, since it is updated with the - * configured IRQ in the probe function. - */ static struct resource tqmx_gpio_resources[] =3D { - DEFINE_RES_IRQ(0), DEFINE_RES_IO(TQMX86_IOBASE_GPIO, TQMX86_IOSIZE_GPIO), + /* Placeholder for IRQ resource - filled in by the probe function */ + [TQMX86_IRQ_GPIO] =3D {}, }; =20 static struct i2c_board_info tqmx86_i2c_devices[] =3D { @@ -255,13 +255,8 @@ static int tqmx86_probe(struct platform_device *pdev) if (gpio_irq) { err =3D tqmx86_setup_irq(dev, "GPIO", gpio_irq, io_base, TQMX86_REG_IO_EXT_INT_GPIO_SHIFT); - if (err) - return err; - - /* Assumes the IRQ resource is first. */ - tqmx_gpio_resources[0].start =3D gpio_irq; - } else { - tqmx_gpio_resources[0].flags =3D 0; + if (!err) + tqmx_gpio_resources[TQMX86_IRQ_GPIO] =3D DEFINE_RES_IRQ(gpio_irq); } =20 ocores_platform_data.clock_khz =3D tqmx86_board_id_to_clk_rate(dev, board= _id); --=20 TQ-Systems GmbH | M=C3=BChlstra=C3=9Fe 2, Gut Delling | 82229 Seefeld, Germ= any Amtsgericht M=C3=BCnchen, HRB 105018 Gesch=C3=A4ftsf=C3=BChrer: Detlef Schneider, R=C3=BCdiger Stahl, Stefan Sch= neider https://www.tq-group.com/