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 <[email protected]>
> ---
>  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 <[email protected]>");
>  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
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to