Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp705589ybh; Wed, 15 Jul 2020 12:56:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMl69ezPvdiaGph2cCUsX37z7e3CvoOaN1ba78YetgmK9wgoWu+MwlBWy47xg7rZFcgZry X-Received: by 2002:aa7:c1d8:: with SMTP id d24mr1272788edp.178.1594843003130; Wed, 15 Jul 2020 12:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594843003; cv=none; d=google.com; s=arc-20160816; b=vtWCzbUnvKN8BchyeH9lj9Wl0kywxVMMSwB29GeYLjLBi5UVfxhksUIXOQ8gVrE4uu GRuFaNQ0VdDqzRFdkB2UValKo9zY3MJxqz18uJUx0AKJAMVjl+Elxcibnj46VKNu4rFw Aiv2hUhBxOPSGR2wuOYrmFUV9GkTVPuqVTtnNhRT1+YCKDZK5tHVB7R7sKFuKaG2oVvd ywV/GyIKveP5T6Psvkf6cfhSF5l4crRf3EO2p3fyBQPgWB7jJiDEuqXlGt7esmbKNIv1 z/niZ4ZrFF6T9kjEPCM3I0xdVtoPbbPuI6xQuDMxUUYVOIkoIVEu+A52YnJPNXa1ZkGq CDrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bbkNcaJ6JdE+9AyYl0stMVnRyeIXxlFXhad3NwvEInc=; b=GFckJkUhImE/Fm+tzfFsmzohoEpm0dU2wS4CguHyshqXiP+3ehz3DQhsOZc3NrrjZY Uvlhhot68j5w4hIKdx7qjuditxT8Yyeykwk8eLC5foK93UUg7HK8+YM0GL1iHRfonuF/ /MjlSoVGluZ0L/n7hzhDSQzO8DVa1Fy17Navvo0hLvMx/UWs9w8HXa//VjdzUAl+nzA/ q/IaGZJ+QlI6tHf9sULJlf6w5aNJOfPd8JDpngtM6NWKBWJ+AITGrrlqi67GPODdeacJ L3xrRP5ihmtcKVt1rq9gmmTZHKlAc6lfIuZDzzCiFgwBj+ej3cMWc/bzFYWpW9zNxhmg AJMA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gw16si1840484ejb.274.2020.07.15.12.56.16; Wed, 15 Jul 2020 12:56:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726986AbgGOTzl (ORCPT + 99 others); Wed, 15 Jul 2020 15:55:41 -0400 Received: from ms-10.1blu.de ([178.254.4.101]:44990 "EHLO ms-10.1blu.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbgGOTzk (ORCPT ); Wed, 15 Jul 2020 15:55:40 -0400 Received: from [78.43.71.214] (helo=marius.localnet) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvnVA-00020h-RU; Wed, 15 Jul 2020 21:55:36 +0200 From: Marius Zachmann To: Guenter Roeck Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] hwmon: corsair-cpro: Change to HID driver Date: Wed, 15 Jul 2020 21:55:36 +0200 Message-ID: <3864498.z6qT3ff8q6@marius> In-Reply-To: <9fc09eec-7921-68ab-b3c7-1d83d3e09817@roeck-us.net> References: <20200715151419.43134-1-mail@mariuszachmann.de> <51449356.7lugSRDzgr@marius> <9fc09eec-7921-68ab-b3c7-1d83d3e09817@roeck-us.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Con-Id: 241080 X-Con-U: 0-mail X-Originating-IP: 78.43.71.214 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.07.20 at 21:49:59 CEST, Guenter Roeck wrote > On 7/15/20 12:12 PM, Marius Zachmann wrote: > > On 15.07.20 at 17:35:08 CEST, Guenter Roeck wrote > >> On 7/15/20 8:14 AM, Marius Zachmann wrote: > >>> This changes corsair-cpro to a hid driver using hid reports. > >>> > >>> Signed-off-by: Marius Zachmann > >>> > >>> --- > >> > > ... > >>> -module_usb_driver(ccp_driver); > >>> +static int __init ccp_init(void) > >>> +{ > >>> + return hid_register_driver(&ccp_driver); > >>> +} > >>> + > >>> +static void __exit ccp_exit(void) > >>> +{ > >>> + hid_unregister_driver(&ccp_driver); > >>> +} > >>> + > >>> +/* make sure it is loaded after hid */ > >>> +late_initcall(ccp_init); > >>> +module_exit(ccp_exit); > >> > >> Sorry for not noticing before, but can you use module_hid_driver() ? > >> That seems to work for other hid drivers. > >> > >> Thanks, > >> Guenter > >> > > > > When using module_hid_driver() and compiling the driver as built-in > > the driver init function will get called before hid and fail registering > > the driver. late_initcall forces it to be loaded after hid. > > > > That seems odd. Why does no other hid driver have that problem ? > Your argument is pretty much that module_hid_driver() would not work, > which seems unlikely. > > Thanks, > Guenter > The order of initcalls is determined by the build order. Hwmon subsystem gets build before hid subsystem and therefore the initcalls are earlier than hid. But hid_register_driver needs the hid driver to be there. Greetings Marius