Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2829538pxb; Mon, 19 Apr 2021 15:21:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHebxCd8GYli59tu7LW67yaCDLq2tTPl9GqRUdtWXgpybJXY0aCx5VLHQlZA2kSdWohdYa X-Received: by 2002:a63:190b:: with SMTP id z11mr13584093pgl.314.1618870897996; Mon, 19 Apr 2021 15:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618870897; cv=none; d=google.com; s=arc-20160816; b=shr4tNkmZ2QMvzlvyfG5hxco9oka9Bh3GJs3c7yn3K+HTXTYbcYqj8k8m4WbA2VbLC P2FG5hmSWE24fYVPj3YsDc3Ohmf7rjbFFUAtMmw9kE4+VRiW+o4/cAxZKHG1psVvIQwJ LstNt3xXCvCVbI8DDbZWIQywvxaalkBLT0D8yUmpxoojft4iiYFRF+Hor9eNlsHtGdDT qj4bb25UAPzzZBNaXXINKtglfrQIEHcO3AFF/gbG8EUx9X0cPAaZBMYDIfuNcmPtmavt WgS4zOJ3NH/VOINrZAhzZGCJWRBO8Fm2GQB5Ctw+oBDKtVRRBpe0aIuR5a4RwZKNpo3R UvuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1BalltYjN3lAfZS2uVHKI2cXTJW+EI6HkrOajatyNlo=; b=dsBWETEM6sIaYTnS9NMIBxAb9ohHrCrevlN6+NsGLn8ksfjG0/x0jOtjfi3KyHLJpW aBKZF2R9QS/GGRVbp2ySKgFvSoF/c4QSQ9iJTybdMZyYG3kSFlhs3Wms/INywT2qD87M KhgXCnkunXJno4mfikMBXw652o95UrO29JT1RZDthCR/rtUM5/zyz7/czkAQX/WRGkC5 5j7mr1lD0j1zqrXf75QKV5q/ugucV1VY55mBVMCh6DmAW2G0a1wWAms0BVgFkf/BBDAU 7mEwIVYfXafAu0NCaIyslp+586v18s9D8jzRXALeQRQwMKdUiWXEXkWcz0SuDm9CwjfW v07A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K9ImTJ7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si18058582pgp.265.2021.04.19.15.21.25; Mon, 19 Apr 2021 15:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K9ImTJ7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242336AbhDSUo2 (ORCPT + 99 others); Mon, 19 Apr 2021 16:44:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:53726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242229AbhDSUoU (ORCPT ); Mon, 19 Apr 2021 16:44:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4ECFD613AF; Mon, 19 Apr 2021 20:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618865030; bh=oBHJLs4kHIy0N6NBAmjtqZO0DXqcU4GPNhTLHYX1rWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9ImTJ7n0MydRaNn4ks+yguXu5JXNgHoqFy8pUl6L17CTXciNcLGbtP/Dz/Kbjn+R 69CS32d7hty0/KRIEHSi7QLg4sxH9EOPhdoY6hTBUcjseFlv0B2g1/Y6V9gn24Xbu3 UFD5ZJBr3WSWrbuxAjz6ebApo/oq3vVZRXqJ4pdG24CD6vnVI56ZbRmqrQlWoZoYC9 dONf33s3NQ6Hq7RUgcvl8SKOIRvu24FxHk56kT27zM5kX9mRmy+F9DXULCv7FSrKoH YrySk+HCvngfqmqSAsUQtZJWpP21UEg/aNUdhc1zVR9mzb4NokH2Ss/N2wnJvyBir1 VqM7NX2+xyLgA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Douglas Gilbert , Jiri Kosina , Sasha Levin , linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 5.11 04/23] HID cp2112: fix support for multiple gpiochips Date: Mon, 19 Apr 2021 16:43:23 -0400 Message-Id: <20210419204343.6134-4-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419204343.6134-1-sashal@kernel.org> References: <20210419204343.6134-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Gilbert [ Upstream commit 2a2b09c867fdac63f430a45051e7bd0c46edc381 ] In lk 5.11.0-rc2 connecting a USB based Silicon Labs HID to I2C bridge evaluation board (CP2112EK) causes this warning: gpio gpiochip0: (cp2112_gpio): detected irqchip that is shared with multiple gpiochips: please fix the driver Simply copy what other gpio related drivers do to fix this particular warning: replicate the struct irq_chip object in each device instance rather than have a static object which makes that object (incorrectly) shared by each device. Signed-off-by: Douglas Gilbert Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-cp2112.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 21e15627a461..477baa30889c 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -161,6 +161,7 @@ struct cp2112_device { atomic_t read_avail; atomic_t xfer_avail; struct gpio_chip gc; + struct irq_chip irq; u8 *in_out_buffer; struct mutex lock; @@ -1175,16 +1176,6 @@ static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type) return 0; } -static struct irq_chip cp2112_gpio_irqchip = { - .name = "cp2112-gpio", - .irq_startup = cp2112_gpio_irq_startup, - .irq_shutdown = cp2112_gpio_irq_shutdown, - .irq_ack = cp2112_gpio_irq_ack, - .irq_mask = cp2112_gpio_irq_mask, - .irq_unmask = cp2112_gpio_irq_unmask, - .irq_set_type = cp2112_gpio_irq_type, -}; - static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev, int pin) { @@ -1339,8 +1330,17 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) dev->gc.can_sleep = 1; dev->gc.parent = &hdev->dev; + dev->irq.name = "cp2112-gpio"; + dev->irq.irq_startup = cp2112_gpio_irq_startup; + dev->irq.irq_shutdown = cp2112_gpio_irq_shutdown; + dev->irq.irq_ack = cp2112_gpio_irq_ack; + dev->irq.irq_mask = cp2112_gpio_irq_mask; + dev->irq.irq_unmask = cp2112_gpio_irq_unmask; + dev->irq.irq_set_type = cp2112_gpio_irq_type; + dev->irq.flags = IRQCHIP_MASK_ON_SUSPEND; + girq = &dev->gc.irq; - girq->chip = &cp2112_gpio_irqchip; + girq->chip = &dev->irq; /* The event comes from the outside so no parent handler */ girq->parent_handler = NULL; girq->num_parents = 0; -- 2.30.2