Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp710623rwj; Thu, 22 Dec 2022 13:44:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXtkprhqZPJjU5fKGbjMSp9FxLUIu6rlXV79J1KQtaarbif+UluTtA9Dd2b8tJGXRstKeb2W X-Received: by 2002:a17:907:a08b:b0:7c0:9b4a:76a with SMTP id hu11-20020a170907a08b00b007c09b4a076amr5306197ejc.28.1671745472303; Thu, 22 Dec 2022 13:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671745472; cv=none; d=google.com; s=arc-20160816; b=e0p8bs6XCk5pHvlUq/LAl0QuPvzmiPtwwQvjAmQwNW8rrpa92WaIG08xloj4v34FST B5K3vlYIiL8tg17DS6z+ttFw9PfvgR4StWGJklDMVey6fFSj1h4k5Xb6Bu8U93r07nZY JBKusliajR8XsI5JQSq70Xm5I92tjyvDDmKofQ9xBzTBbQFUFmXaYHx2AVe7v4Uom0zi 604KCU+DiTPdFusx1E+O//S5hMhzfN2BSze3RWFYSiEDeL7JhclJtyQPnBGX6SC06jIL gaaFt0tUDKqM54LZa0JEs7ssFca3ql21pm6Q7hSuGZLZNLjVnwj7PXE3BTt8WLPjV+OF qjRg== 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:subject :references:in-reply-to:message-id:cc:to:from:dkim-signature:date; bh=taNf+JuA+NAMhycQCNzWXEG5n+O4upNWA9xFd9MUSiU=; b=WSJdpGKpYFfp50x+gH+U3Ip8v3BUOZPEzkDs1iRkPnrm63cEfmcXtHltlSA5cDVfX4 27AXVemwnj0wAWd2m8a5LvdaImN/Dbx/6cyCGuWwMMBrEdRAwyCdKbEK4NyL8eLlu4mr VWkMoCWTH0Ujz5M1NhMu8HhKmZLtAbFLY+oWVcoICKAsU7nc7JYKT8QBUrVRcoXciY4o VHZe3X6m0xwPE/M/QUAZmZ0QSO1mK/4v9EYDIPWMhohIQT8XzMhgFaCernHFRmy3Hgnd SGzZXWZQanxQ5KMrsAKpsp2HEWk9outbLKYuNqqYwtj/XAAcltEYJ+Lz8yeGuSNE+4S3 xBew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@t-8ch.de header.s=mail header.b=cZ9SMaJM; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id un2-20020a170907cb8200b007ae2dfe020bsi992113ejc.783.2022.12.22.13.43.35; Thu, 22 Dec 2022 13:44:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@t-8ch.de header.s=mail header.b=cZ9SMaJM; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbiLVVhj (ORCPT + 99 others); Thu, 22 Dec 2022 16:37:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbiLVVhi (ORCPT ); Thu, 22 Dec 2022 16:37:38 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2059023307; Thu, 22 Dec 2022 13:37:36 -0800 (PST) Date: Thu, 22 Dec 2022 16:37:21 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=t-8ch.de; s=mail; t=1671745054; bh=taNf+JuA+NAMhycQCNzWXEG5n+O4upNWA9xFd9MUSiU=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=cZ9SMaJMjee/jh8Z3sJJPaJy1Es9jq25h0S9RFBgt3MtxIo6FXWx1OmpvhrCeb0q0 ozCZINowrizahr0OY7i8872tpZrBihliRxFepbQb+ppUSTu49yqQW7jRs5mcKhGmuF GJ71lbAXU6F64GGQUN+GtpfTY16XDjuca6z3ja+o= From: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh_?= To: Benjamin Tissoires Cc: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Hans de Goede , Jiri Kosina , David Rheinsberg , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Message-ID: <4d42a44d-e0f3-4d01-8564-267d0f3f061a@t-8ch.de> In-Reply-To: References: <20221222-hid-v1-0-f4a6c35487a5@weissschuh.net> <20221222-hid-v1-2-f4a6c35487a5@weissschuh.net> Subject: Re: [PATCH 2/8] HID: usbhid: Make hid_is_usb() non-inline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: <4d42a44d-e0f3-4d01-8564-267d0f3f061a@t-8ch.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Dec 22, 2022 16:13:06 Benjamin Tissoires : > On Thu, Dec 22, 2022 at 6:16 AM Thomas Wei=C3=9Fschuh wrote: >> >> By making hid_is_usb() a non-inline function the lowlevel usbhid driver >> does not have to be exported anymore. >> >> Also mark the argument as const as it is not modified. >> >> Signed-off-by: Thomas Wei=C3=9Fschuh >> --- >> drivers/hid/usbhid/hid-core.c | 6 ++++++ >> include/linux/hid.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 | 5 +---- >> 2 files changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core= .c >> index be4c731aaa65..54b0280d0073 100644 >> --- a/drivers/hid/usbhid/hid-core.c >> +++ b/drivers/hid/usbhid/hid-core.c >> @@ -1334,6 +1334,12 @@ struct hid_ll_driver usb_hid_driver =3D { >> }; >> EXPORT_SYMBOL_GPL(usb_hid_driver); >> >> +bool hid_is_usb(const struct hid_device *hdev) >> +{ >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return hdev->ll_driver =3D=3D &usb= _hid_driver; >> +} >> +EXPORT_SYMBOL_GPL(hid_is_usb); >> + >> static int usbhid_probe(struct usb_interface *intf, const struct usb_dev= ice_id *id) >> { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct usb_host_interface *in= terface =3D intf->cur_altsetting; >> diff --git a/include/linux/hid.h b/include/linux/hid.h >> index 8677ae38599e..e8400aa78522 100644 >> --- a/include/linux/hid.h >> +++ b/include/linux/hid.h >> @@ -864,10 +864,7 @@ static inline bool hid_is_using_ll_driver(struct hi= d_device *hdev, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return hdev->ll_driver =3D=3D= driver; >> } >> >> -static inline bool hid_is_usb(struct hid_device *hdev) >> -{ >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return hid_is_using_ll_driver(hdev= , &usb_hid_driver); >> -} >> +extern bool hid_is_usb(const struct hid_device *hdev); > > The problem here is that CONFIG_USB_HID can be set to either m or n. > In the n case, you'll end up with an undefined symbol, in the m case, > it won't link too if CONFIG_HID is set to Y (and it'll be quite a mess > to call it if the module is not loaded yet). Shouldn't we already have the same problem with the symbol usb_hid_driver itself that is defined right next to the new hid_is_usb()? Thomas >> >> #define=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PM_HINT_FULLON=C2=A0 1= <<5 >> #define PM_HINT_NORMAL 1<<1 >> >> -- >> 2.39.0 >>