Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752130AbdG1O3h (ORCPT ); Fri, 28 Jul 2017 10:29:37 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:35497 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751761AbdG1O3f (ORCPT ); Fri, 28 Jul 2017 10:29:35 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170728131826.180483-1-arnd@arndb.de> <6C9C978F-447D-42A5-9245-894577F2944D@gmail.com> From: Arnd Bergmann Date: Fri, 28 Jul 2017 16:29:34 +0200 X-Google-Sender-Auth: evQBr-69_l9kZtAW6486Rj7D14Y Message-ID: Subject: Re: [PATCH] HID: wacom: add USB_HID dependency To: Jason Gerecke Cc: Jiri Kosina , Jason Gerecke , Benjamin Tissoires , "open list:HID CORE LAYER" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1096 Lines: 30 On Fri, Jul 28, 2017 at 4:24 PM, Jason Gerecke wrote: > On Fri, Jul 28, 2017 at 7:18 AM, Arnd Bergmann wrote: >> On Fri, Jul 28, 2017 at 4:07 PM, Jason Gerecke wrote: >> #ifdef CONFIG_USB_HID >> extern bool hid_is_using_usb_driver(struct hid_device *hdev) >> #else >> static inline bool hid_is_using_usb_driver(struct hid_device *hdev) >> { >> return false; >> } >> #endif >> >> but is it worth it to avoid the dependency? >> >> Arnd > > I was thinking something more along the lines of the following since > the idea of per-transport helper functions was dismissed earlier: > > #ifdef CONFIG_USB_HID > if (hid_is_using_ll_driver(wacom->hdev, &usb_hid_driver)) { I would consider that rather ugly, a driver shouldn't really use #ifdef like this, but you can hide stuff like this in a header. The method I proposed also has the advantage of avoiding exporting the usb_hid_driver object. Drivers shouldn't really need to access this, and wacom_sys.c is the only remaining user of the export. Arnd