Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp227749rwj; Fri, 23 Dec 2022 00:02:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXuKsFYtcVkCHd+NFM4r3CEL7dinzqPvQN+Nv3Wk75DwkUEUgAkGWXoUw1mKvkiK2BCinLob X-Received: by 2002:a05:6a20:b044:b0:ac:ab16:442 with SMTP id dx4-20020a056a20b04400b000acab160442mr8670051pzb.4.1671782577138; Fri, 23 Dec 2022 00:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671782577; cv=none; d=google.com; s=arc-20160816; b=bMz6xKfwlTF4SEFz64S5E+2h0VuDTOrgH/HvX3fDh5QyGzak/ZP/Eo7J8BO+itrzoj GSHX7y+B7juvUtfYsvK34D3Qjj77IxIN8ZkFqzV99l/uP81WMy91JewnsvgMEgGr3f8N +7gCAX9+Aj6eoCc2zJVQBDkXPlV0XHvDwUSYA2MT/5/kRswItjr5Hwbf1sAuis1jNzfg D3Ecjb+BLNgudiGIV7hb72xauQkThnXAE+28OMmieh+IjUhyFEbZkvaWVW/rw68Aieng Z/QeziQpYdX2aqhj0SBK4S3TQxmevVaFY7SO1cU0sg+AYren9OCHpv2+vRlX+f6JJgPz E/+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=h6JPSOz29jTwJ0YryUTZktETnZ1Pej5C93Cx+9Ku8p8=; b=yOLpJvy/MP72njYDGV9G0XOZeWfHPZIWEdx2xob0hIq0pN5vKtZyH4IGp/ElShf0oC u+DTEABObu0iGNsSBl2sDeUuZaJWBRliVPIQ0YlPIx08+XKlMJ0d9XY79o9KDGXhSYHJ +MiARL8VA0rUyfWW8EJIm0oCIEbYa8oY1nLmr/9dQhacdD8Mx9vW708wnNDsmwVwLPLv W0Z3EXlgbAh1+MJ6cmksNwI/JoyXNmmAzmsDhVD2Mxy4CKSlzJ69IfTgaxwtLjOYrr6c 3vpB5UXZr3MSaerMTgjGo+8JCuqlevkr7u2U96hzYE5AO99XquMQM60a8YEOAfugHjE3 Ojpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e4KHlAtN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m20-20020a63ed54000000b00477bdc1d5desi2843623pgk.330.2022.12.23.00.02.32; Fri, 23 Dec 2022 00:02:57 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e4KHlAtN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235993AbiLWH57 (ORCPT + 99 others); Fri, 23 Dec 2022 02:57:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbiLWH56 (ORCPT ); Fri, 23 Dec 2022 02:57:58 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56AED31342 for ; Thu, 22 Dec 2022 23:57:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671782229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h6JPSOz29jTwJ0YryUTZktETnZ1Pej5C93Cx+9Ku8p8=; b=e4KHlAtNfPiRtIGhoyHK1ZhV1yaz2Pk+y53NDwmW7ysVN3+5lQYQ1eRFcT2M7KAT8l40Md ADxMngyJyOQWAw/cUM3N3OpFizQpYtrFFU+abtVhQHpH5jnMcKN4BHSDEMGyMxjE3sKMJV XSIa5lMH1AFgG2tz8xJjLGM/tLYin3s= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-258-bhREZtyFMmuVgP_dD8c5FA-1; Fri, 23 Dec 2022 02:57:07 -0500 X-MC-Unique: bhREZtyFMmuVgP_dD8c5FA-1 Received: by mail-io1-f72.google.com with SMTP id g11-20020a6be60b000000b006e2c707e565so1651382ioh.14 for ; Thu, 22 Dec 2022 23:57:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h6JPSOz29jTwJ0YryUTZktETnZ1Pej5C93Cx+9Ku8p8=; b=ba5duFRT3evDhV27XTdk0UgPmU2ToEAy16Y8NhKy4Lr1fjiTB8IHU84vxCR58+xm42 G88HUoO8aLzMHZsrhychzEhtdjVpy7hSWv5HICUs3ENLJv6pcb31IZSotecYJrIAVVEG Y0rYcSc/CxH1IrHnFhOMLPonA8kmVCZ5M0rUWtpqha7etQGDBPJd8/J9YlKtDn8e1Xx4 Bgn0WrTOKiIh9rlMg/i2VXbAyr7hndvjpKALxzyK57Sccq6pAezPT/MRjrsKZIuHEELj 3j7Mle2KDW/kFWfhcHGV+u6faoqkSLFm3Fffc/t6zBKA7guYg6Sk2KS7ckjc54SQw+54 WBMQ== X-Gm-Message-State: AFqh2krxU9lILc0dxnpICsM8ihJwUIli6sbl3wcmcE27YcMnwE7yf2zq /u8Sybk4rLlJ28jWs41EPOFhEiTQlSbyhzmjkPgEClnrHOMAgEaRn+F/WoSAM35Eb19CjsUiqjb dTmI8OLIwa+pMJCvRzR9JMnGagVS3qHbeSMjVtdxXbedi X-Received: by 2002:a05:6602:449:b0:6df:bfeb:f15d with SMTP id e9-20020a056602044900b006dfbfebf15dmr601720iov.122.1671782226859; Thu, 22 Dec 2022 23:57:06 -0800 (PST) X-Received: by 2002:a05:6602:449:b0:6df:bfeb:f15d with SMTP id e9-20020a056602044900b006dfbfebf15dmr601713iov.122.1671782226592; Thu, 22 Dec 2022 23:57:06 -0800 (PST) MIME-Version: 1.0 References: <20221222-hid-v1-0-f4a6c35487a5@weissschuh.net> <20221222-hid-v1-2-f4a6c35487a5@weissschuh.net> <4d42a44d-e0f3-4d01-8564-267d0f3f061a@t-8ch.de> In-Reply-To: <4d42a44d-e0f3-4d01-8564-267d0f3f061a@t-8ch.de> From: Benjamin Tissoires Date: Fri, 23 Dec 2022 08:56:55 +0100 Message-ID: Subject: Re: [PATCH 2/8] HID: usbhid: Make hid_is_usb() non-inline To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 On Thu, Dec 22, 2022 at 10:46 PM Thomas Wei=C3=9Fschuh wr= ote: > > > 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 drive= r > >> 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 | 5 +---- > >> 2 files changed, 7 insertions(+), 4 deletions(-) > >> > >> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-co= re.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) > >> +{ > >> + 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_d= evice_id *id) > >> { > >> struct usb_host_interface *interface =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 = hid_device *hdev, > >> return hdev->ll_driver =3D=3D driver; > >> } > >> > >> -static inline bool hid_is_usb(struct hid_device *hdev) > >> -{ > >> - 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()? Yeah, sorry, my bad. All of the callers of this function are modules which depend on CONFIG_USB_HID in the Kconfig, so we should be good. Sorry for the noise. I shouldn't do reviews at 10pm :( Cheers, Benjamin > > Thomas > > >> > >> #define PM_HINT_FULLON 1<<5 > >> #define PM_HINT_NORMAL 1<<1 > >> > >> -- > >> 2.39.0 > >> >