X86 platform drivers
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 4/5] intel_scu_ipc: switch to use module_pci_driver() macro
Date: Sat, 10 Oct 2015 21:39:17 -0700	[thread overview]
Message-ID: <20151011043917.GD2958@malice.jf.intel.com> (raw)
In-Reply-To: <1444399896-78599-4-git-send-email-andriy.shevchenko@linux.intel.com>

On Fri, Oct 09, 2015 at 05:11:35PM +0300, Andy Shevchenko wrote:
> The use of macro cleans up the code a bit.

Thanks Andriy,

Minor point of feedback: it helps review to state specifics of how something is
cleaned up, etc. That way I am not assuming anything and can verify your
intentions with what I'm reading. This is a trivial example, but illustrative.

For this patch, you might have said:

  Eliminate some boilerplate code by using module_pci_driver() instead of
  init/exit, moving the salient bits from init into probe.

This provides more context for the reviewer and makes the intent explicit from
the commit message.

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/platform/x86/intel_scu_ipc.c | 25 +++++++------------------
>  1 file changed, 7 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
> index 69e39cb..9de2029 100644
> --- a/drivers/platform/x86/intel_scu_ipc.c
> +++ b/drivers/platform/x86/intel_scu_ipc.c
> @@ -567,10 +567,15 @@ static irqreturn_t ioc(int irq, void *dev_id)
>   */
>  static int ipc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  {
> +	int platform;		/* Platform type */
>  	int err;
>  	struct intel_scu_ipc_dev *scu = &ipcdev;
>  	struct intel_scu_ipc_pdata_t *pdata;
>  
> +	platform = intel_mid_identify_cpu();
> +	if (platform == 0)
> +		return -ENODEV;
> +
>  	if (scu->dev)		/* We support only one SCU */
>  		return -EBUSY;
>  
> @@ -589,7 +594,7 @@ static int ipc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	init_completion(&scu->cmd_complete);
>  
> -	err = devm_request_irq(&pdev->dev, dev->irq, ioc, 0, "intel_scu_ipc",
> +	err = devm_request_irq(&pdev->dev, pdev->irq, ioc, 0, "intel_scu_ipc",
>  			       scu);
>  	if (err)
>  		return err;
> @@ -651,24 +656,8 @@ static struct pci_driver ipc_driver = {
>  	.remove = ipc_remove,
>  };
>  
> -static int __init intel_scu_ipc_init(void)
> -{
> -	int platform;		/* Platform type */
> -
> -	platform = intel_mid_identify_cpu();
> -	if (platform == 0)
> -		return -ENODEV;
> -	return  pci_register_driver(&ipc_driver);
> -}
> -
> -static void __exit intel_scu_ipc_exit(void)
> -{
> -	pci_unregister_driver(&ipc_driver);
> -}
> +module_pci_driver(ipc_driver);
>  
>  MODULE_AUTHOR("Sreedhara DS <sreedhara.ds@intel.com>");
>  MODULE_DESCRIPTION("Intel SCU IPC driver");
>  MODULE_LICENSE("GPL");
> -
> -module_init(intel_scu_ipc_init);
> -module_exit(intel_scu_ipc_exit);
> -- 
> 2.5.3
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

  reply	other threads:[~2015-10-11  4:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 14:11 [PATCH 1/5] intel_scu_ipc: fix error path by turning to devm_* / pcim_* Andy Shevchenko
2015-10-09 14:11 ` [PATCH 2/5] intel_scu_ipc: propagate struct intel_scu_ipc_dev Andy Shevchenko
2015-10-09 14:11 ` [PATCH 3/5] intel_scu_ipc: convert to use struct device * Andy Shevchenko
2015-10-09 14:11 ` [PATCH 4/5] intel_scu_ipc: switch to use module_pci_driver() macro Andy Shevchenko
2015-10-11  4:39   ` Darren Hart [this message]
2015-10-09 14:11 ` [PATCH 5/5] intel_scu_ipc: move ipclock to struct intel_scu_ipc_dev Andy Shevchenko
2015-10-09 15:21   ` Andy Shevchenko
2015-10-11  4:43     ` Darren Hart
2015-10-12  8:02       ` Andy Shevchenko
2015-10-11  4:21 ` [PATCH 1/5] intel_scu_ipc: fix error path by turning to devm_* / pcim_* Darren Hart
2015-10-12  8:00   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151011043917.GD2958@malice.jf.intel.com \
    --to=dvhart@infradead.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox