mei: simplify error handling via devres function.
Subsystems (2)
PATCH v3 1/1 mei: simplify error handling via devres function.
Use devm_ and pcim_ functions to make error handling simpler and code smaller and tidier.
Based on original patch by
mei: me: use managed functions pcim_* and devm_*
https://lkml.org/lkml/2016/2/1/339
---
V2: Thanks Andy for review, integratd changes:
1. Rename devm_mei_me_init back to mei_me_dev_init they don't really belong to devm_ namespace.
2. Revert pcim irq reservation change.
3. Drop setting driver data to NULL on exit.
4. Use directly mmio pointer received from pcim_iomap_table
V3: Remove pci_disable_msi, it is also handled by the system.
drivers/misc/mei/hw-me.c | 6 ++-- drivers/misc/mei/hw-txe.c | 4 +-- drivers/misc/mei/hw-txe.h | 2 +- drivers/misc/mei/pci-me.c | 50 +++++++-------------------------- drivers/misc/mei/pci-txe.c | 69 +++++++--------------------------------------- 5 files changed, 26 insertions(+), 105 deletions(-)
drivers/misc/mei/hw-me.c +3 -3
@@ -1389,7 +1389,7 @@ const struct mei_cfg mei_me_pch8_sps_cfg = {* @pdev: The pci device structure * @cfg: per device generation config * -* Return: The mei_device_device pointer on success, NULL on failure. +* Return: The mei_device pointer on success, NULL on failure. */ struct mei_device *mei_me_dev_init (struct pci_dev *pdev,const struct mei_cfg *cfg)
@@ -1397,8 +1397,8 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev,struct mei_device *dev;struct mei_me_hw *hw; - dev =kzalloc (sizeof (struct mei_device ) + -sizeof (struct mei_me_hw ),GFP_KERNEL ); + dev =devm_kzalloc (&pdev->dev,sizeof (struct mei_device ) + +sizeof (struct mei_me_hw ),GFP_KERNEL );if (!dev)return NULL ; hw =to_me_hw (dev);
drivers/misc/mei/hw-txe.c +2 -2
@@ -1207,8 +1207,8 @@ struct mei_device *mei_txe_dev_init(struct pci_dev *pdev)struct mei_device *dev;struct mei_txe_hw *hw; - dev =kzalloc (sizeof (struct mei_device ) + -sizeof (struct mei_txe_hw ),GFP_KERNEL ); + dev =devm_kzalloc (&pdev->dev,sizeof (struct mei_device ) + +sizeof (struct mei_txe_hw ),GFP_KERNEL );if (!dev)return NULL ;
drivers/misc/mei/hw-txe.h +1 -1
@@ -45,7 +45,7 @@* @intr_cause: translated interrupt cause */ struct mei_txe_hw { -void __iomem *mem_addr[NUM_OF_MEM_BARS ]; +void __iomem *const *mem_addr;u32 aliveness;u32 readiness;u32 slots;
drivers/misc/mei/pci-me.c +10 -40
114 lines not on this page · raw message
drivers/misc/mei/pci-txe.c +10 -59
144 lines not on this page · raw message
Signature · 1 line
2.7.4
Greg Kroah-Hartman
maintainerQuoted 10 lines · Tomas Winkler
Use
devm_andpcim_functions to make error handling simpler and code smaller and tidier.Based on original patch by
mei: me: use managed functions pcim_* and devm_*
https://lkml.org/lkml/2016/2/1/339Signed-off-by Tomas Winkler <[email protected]>Signed-off-by Alexander Usyskin <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Quoted 8 lines
---
V2: Thanks Andy for review, integratd changes:
1. Renamedevm_mei_me_initback tomei_me_dev_initthey don't really belong todevm_namespace.
2. Revert pcim irq reservation change.
3. Drop setting driver data to NULL on exit.
4. Use directly mmio pointer received frompcim_iomap_table
V3: Removepci_disable_msi, it is also handled by the system.
Andy, any objection to this version?
thanks,
greg k-h
Quoted 20 lines · Greg Kroah-Hartman
Quoted 10 lines · Tomas Winkler
Use
devm_andpcim_functions to make error handling simpler and code smaller and tidier.Based on original patch by
mei: me: use managed functions pcim_* and devm_*
https://lkml.org/lkml/2016/2/1/339Signed-off-by Tomas Winkler <[email protected]>Signed-off-by Alexander Usyskin <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>Quoted 8 lines
---
V2: Thanks Andy for review, integratd changes:
1. Renamedevm_mei_me_initback tomei_me_dev_initthey don't really belong todevm_namespace.
2. Revert pcim irq reservation change.
3. Drop setting driver data to NULL on exit.
4. Use directly mmio pointer received frompcim_iomap_table
V3: Removepci_disable_msi, it is also handled by the system.
Quoted 1 line
Andy, any objection to this version?
Nope, this looks exactly how I would put it!
Thanks!
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy