Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1234809ybh; Thu, 16 Jul 2020 06:56:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJh1TBWBs1NNTSDQKH/xNVo1CQJ5RdoLUl5lBxWLoFN4VkNFz5qV/sXR3pNVjkEjY8ckOC X-Received: by 2002:a17:906:5e0b:: with SMTP id n11mr3914933eju.15.1594907796700; Thu, 16 Jul 2020 06:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594907796; cv=none; d=google.com; s=arc-20160816; b=wRivZUALNZqNQO6Z4WpgLN62h8eWZsPKYDGZ1kja8K4BIqftLmNDFt+z4fwaUZBmKn JzRmhbSo5zNQvjEoW1Cuo1bth/E5y+TFOVnCZSOfoF3tmkuiDDVznAB6j0WsPd5zV3aR Ak+EckFS+RyVYSs8OR4UMHq6sqYEPDamibkwZlmpBWxbcBS7Kw8+pNUTzvXTp+2QnLO3 eaHKtkCqyKRNip8DYHJgBowtT3CH5iE6pcjRtPMuunxmtqQQWbNZAVicOrHgiRsWQZz5 BxKjEqUFG4Z5vzUsq1OyXiPwvTEJiBIxGRhqNsR8qIpeBqwFNsC6HRmebQlVFwBTVys5 qaVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fSYl+obZVE+fUKznzfN+YjGdJqq6f8RfiQS+28i+3lU=; b=cdPq5vkfEnvQHIawGqDNjC6t49qBOvd0bU3LQA3+8nRXd9JtnEH7o6sy9BePhTj18H n2kcBAhxhBFzf9QAUK7EVWIFAMZJrctHvlQWeppM8Cmyk+oajWB415PLVCkLRHKdmImg EieUo2V5/90duzWmnjFI8kdxsDYW1QgCioflVqvJLMauKLxYvpjuH92JSHle1w1d5ZnS Md7+FOxqAbzeL3B7Of9rykU4vjTayPYv+OxeLsLVcgTN56GPGHWFDQMXJ9e+A/l97WSd 06XFdiDlID0ouLY9l599bSjWVAWhrZOZefbGiuSHC+7PEJwVi2PISXLuY7dwnpyupR7V hLpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yW0TqbV2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u23si3212958eds.479.2020.07.16.06.56.14; Thu, 16 Jul 2020 06:56:36 -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; dkim=pass header.i=@linaro.org header.s=google header.b=yW0TqbV2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728983AbgGPNzM (ORCPT + 99 others); Thu, 16 Jul 2020 09:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728929AbgGPNzI (ORCPT ); Thu, 16 Jul 2020 09:55:08 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B86BC061755 for ; Thu, 16 Jul 2020 06:55:08 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id b11so907565lfe.10 for ; Thu, 16 Jul 2020 06:55:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fSYl+obZVE+fUKznzfN+YjGdJqq6f8RfiQS+28i+3lU=; b=yW0TqbV2Cmn34g+off5Xzod+BSQ8M1Xw4VxORpFRWUx+wIaEXJJhwqCsu+hmjEWM3V PPGCXyWxy+R+W2N+bI0gtgOCetsz7Z1owadn47BzqxHpW9p53Ifhqefkn9j5GEfIVKq5 fOxjHE3rHiAeMdcJKce8rB8zIiKvTuuGTx67ld8xXchrZVzXBSWAGnbYPold/YYUaAto i7EFg+cxceta14JfCDJZ5tHMznT+lsvoaLzdBaO1/+uPiyw92qJ0FxVswVSvg+ZJ9MyQ /836A7RemmSD/r7Dt/coNl6VqvR67ATuNOirwQOyk3OYgq/k94bVCxNguezzutd+sM52 ZEFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fSYl+obZVE+fUKznzfN+YjGdJqq6f8RfiQS+28i+3lU=; b=qCfSNbZ3MFBKQ+OPUpAEYTP38l8u8gRusfAcT14iCBUozuNLKHFlqZXLSj7lBaVXXa mLUPK0vXM38+2y0yONLPHayIjDixRnNVjrJXY+65iX3CbdOPRhprRKGihkocvVOGYr/2 2AqwkM1mNU8kyTaASVlCV6FbJzgXNQN10ckH/YxHyS57sOaWpRLOgQdPhRnkyWVktOdD H4kdDsz6sItycb+Aozgd2lOhTP3JFhM7TXWvTaGDpq7es4R6y64bTtXQ16fgHQUsLTsU ycExc4A7K/mqG/POA9PTX4RDPvmBqIj8C+NhqhygFU7dQPULLpYAUxg6gCYUxgMTVWvs zgVA== X-Gm-Message-State: AOAM530nbUQgAQusa2oLr7B1IiUmdtspgPWZDhEA5BXJ9Dr6B763QaSj eyJ2hN3IonCNJzSDjqlDsYjD1HSV1yKBqXAAyxByCw== X-Received: by 2002:a19:f20a:: with SMTP id q10mr2210486lfh.89.1594907706496; Thu, 16 Jul 2020 06:55:06 -0700 (PDT) MIME-Version: 1.0 References: <1594164323-14920-1-git-send-email-Anson.Huang@nxp.com> In-Reply-To: From: Linus Walleij Date: Thu, 16 Jul 2020 15:54:55 +0200 Message-ID: Subject: Re: [PATCH 1/3] gpio: mxc: Support module build To: Anson Huang Cc: Russell King , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , Catalin Marinas , Will Deacon , Bartosz Golaszewski , "oleksandr.suvorov@toradex.com" , Adam Ford , Andreas Kemnade , "hverkuil-cisco@xs4all.nl" , Bjorn Andersson , Leo Li , Vinod Koul , Geert Uytterhoeven , Olof Johansson , Linux ARM , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" , dl-linux-imx Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 4:44 AM Anson Huang wrote: > > Subject: RE: [PATCH 1/3] gpio: mxc: Support module build > > > > Hi, Linus > > > > > Subject: Re: [PATCH 1/3] gpio: mxc: Support module build > > > > > > On Wed, Jul 8, 2020 at 1:28 AM Anson Huang > > > wrote: > > > > > > > subsys_initcall(gpio_mxc_init); > > > > + > > > > +MODULE_AUTHOR("Shawn Guo "); > > > > +MODULE_DESCRIPTION("i.MX GPIO Driver"); MODULE_LICENSE("GPL"); > > > > > > You are making this modualrizable but keeping the subsys_initcall(), > > > which doesn't make very much sense. It is obviously not necessary to > > > do this probe at subsys_initcall() time, right? > > > > > > > If building it as module, the subsys_initcall() will be equal to module_init(), I > > keep it unchanged is because I try to make it identical when built-in, since > > most of the config will still have it built-in, except the Android GKI support. > > Does it make sense? > > > > > Take this opportunity to convert the driver to use > > > module_platform_driver() as well. > > > > If you think it has to be or it is better to use module_platform_driver(), I will do > > it in V2. > > I tried to replace the subsys_initcall() with module_platform_driver(), but met issue > about " register_syscore_ops(&mxc_gpio_syscore_ops);" which is called in gpio_mxc_init() > function, this function should be called ONLY once, moving it to .probe function is NOT > working, so we may need to keep the gpio_mxc_init(), that is another reason that we may > need to keep subsys_initcall()? This looks a bit dangerous to keep like this while allowing this code to be used from a module. What happens if you insmod and rmmod this a few times, really? How is this tested? This is not really modularized if that isn't working, just that modprobing once works isn't real modularization IMO, it seems more like a quick and dirty way to get Androids GKI somewhat working with the module while not properly making the module a module. You need input from the driver maintainers on how to handle this. Yours, Linus Walleij