Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4178472ybe; Mon, 9 Sep 2019 05:36:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLZjx0hejW2SoIQ45dSBjf0uVdRMuKNYCT6NIXxMMp0xy0jaChvx3TnvuOzrCIPWXUNNXK X-Received: by 2002:a50:a0e2:: with SMTP id 89mr23707544edo.118.1568032612172; Mon, 09 Sep 2019 05:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568032612; cv=none; d=google.com; s=arc-20160816; b=ywahaDEg2Cc5K83IwYJyktJlXZsPR4gqOE4wpZCqvpPDcBtaqvp3fY6bGJ6aOR9K8r zRAl+ytiXmlRaGzeL38ofc9odm6B4K62adrxZamgkkwPDjgzp9U8FcLbayzqbbl5iD28 2nTYlLItzZR5awOdwWvLISesZdY5zSBhl88ze4siS81NkQDL7WZMroIx4zkgrYsPx9Ns 3Z0qDuwEFyP1eG9LGcEVFw2IVrwukULKS1TY7haGgsdVO8/6D/lMEn/kihLndwYVerIa MBCv6PBUlRnueh/ZVaDC1Cai38qMMe3lfPwq0pCsVJxqegjIJa3oEj8z5mbDOS4ABO9N zBXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=66qyQfbNvJUGJ5v2B3vWQobzbj9JMUO+s00w0yTEXgw=; b=FAwfZnclBmqMAShuUdwzZ4Y1/kVQCT3rsaJVN/IHmtZEMWaTQlbR8dO4mpdLREGGpR wEXkNEzcjwRM+40g750aq/GUewQR9t05sMkCTElflt9cSJsvL7OBV/THZVNAAMd4bi48 /G/TbhSoX/Jay3VrVAPFbsJ7JyPpyCdoO2c1U9766Gj/3K8o8LaHX1mx3vwh7tTl/uub Tzg66AwCvt/EWhHOoymJzwCziu21bJr1zhZwCHFBfGxYuNF9S13e1TqxzPW3N89M1QgZ 48PbbElNjW/GfHhAi4h1eRA7r9Zn+nTRMTi679o/P8+jI0dRI5Pf7kQM1cP1H5kAHAjC STzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xWAtzf2k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13si7480460ejr.281.2019.09.09.05.36.28; Mon, 09 Sep 2019 05:36:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xWAtzf2k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727629AbfIHNHt (ORCPT + 99 others); Sun, 8 Sep 2019 09:07:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:55030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727568AbfIHNHt (ORCPT ); Sun, 8 Sep 2019 09:07:49 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C23E218AC; Sun, 8 Sep 2019 13:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567948068; bh=cJcWacuGpD9PlZiTdR8FoX6vaAsWzW3r2Kl0j0eqRxU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xWAtzf2kDaiiJFlr85BNUsKFh1drlh7nCxHzJKtp+K+ib2cv9CGRLahQ4QIbI3jr0 K6LXwkUmHL0gRIwXapJB5eheuOvDb9a1ytkB4XFkoe/V+f4HSBNIF1p5EsrqBp8eUA oAJqVe9Kf6zhaj3Ic4XkFt/T1KF/VL2rIAeNx7X4= Date: Sun, 8 Sep 2019 14:07:46 +0100 From: Greg Kroah-Hartman To: Akinobu Mita Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Jacek Anaszewski , Pavel Machek , Dan Murphy Subject: Re: [PATCH 2/5] leds: make sure leds_class is initialized before triggers are registered Message-ID: <20190908130746.GA9466@kroah.com> References: <1567946472-10075-1-git-send-email-akinobu.mita@gmail.com> <1567946472-10075-3-git-send-email-akinobu.mita@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1567946472-10075-3-git-send-email-akinobu.mita@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 08, 2019 at 09:41:09PM +0900, Akinobu Mita wrote: > If the led-class and usb-common modules are built into the kernel, the > usb-common module could be initialized earlier than the led-class module. > > So when the ledtrig_usb_gadget and ledtrig_usb_host LED triggers are > registered by usb-common module, the leds_class could not be initialized > yet. > > We are going to populate sub-directories, each representing an LED > trigger in /sys/class/triggers/, so leds_class needs to be initialized > before any LED triggers is registered. > > This makes led-class initialize earlier then usb-common by changing > initcall group. > > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: Jacek Anaszewski > Cc: Pavel Machek > Cc: Dan Murphy > Signed-off-by: Akinobu Mita > --- > drivers/leds/led-class.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c > index 8b5a1d1..7d85181 100644 > --- a/drivers/leds/led-class.c > +++ b/drivers/leds/led-class.c > @@ -424,7 +424,7 @@ static void __exit leds_exit(void) > class_destroy(leds_class); > } > > -subsys_initcall(leds_init); > +postcore_initcall(leds_init); This is a case of "whack a mole". Why not just initialize everything the first time the function is called? That way you don't have to mess with any of the link order stuff and everything will always continue to work if things ever change in the future? thanks, greg k-h