Re: [PATCH v2 17/19] mailbox: rockchip: Use device-managed registration API

2018-12-17 Thread Caesar Wang

On 2018/12/17 下午11:02, Thierry Reding wrote:

From: Thierry Reding 

Get rid of some boilerplate driver removal code by using the newly added
device-managed registration API.


Reviewed-by: Caesar Wang 

Thanks,
Caesar


Cc: Caesar Wang 
Signed-off-by: Thierry Reding 
---
  drivers/mailbox/rockchip-mailbox.c | 15 +--
  1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/mailbox/rockchip-mailbox.c 
b/drivers/mailbox/rockchip-mailbox.c
index d702a204f5c1..f24a77b1a0ff 100644
--- a/drivers/mailbox/rockchip-mailbox.c
+++ b/drivers/mailbox/rockchip-mailbox.c
@@ -247,28 +247,15 @@ static int rockchip_mbox_probe(struct platform_device 
*pdev)
mb->chans[i].msg = NULL;
}
  
-	ret = mbox_controller_register(>mbox);

+   ret = devm_mbox_controller_register(>dev, >mbox);
if (ret < 0)
dev_err(>dev, "Failed to register mailbox: %d\n", ret);
  
  	return ret;

  }
  
-static int rockchip_mbox_remove(struct platform_device *pdev)

-{
-   struct rockchip_mbox *mb = platform_get_drvdata(pdev);
-
-   if (!mb)
-   return -EINVAL;
-
-   mbox_controller_unregister(>mbox);
-
-   return 0;
-}
-
  static struct platform_driver rockchip_mbox_driver = {
.probe  = rockchip_mbox_probe,
-   .remove = rockchip_mbox_remove,
.driver = {
.name = "rockchip-mailbox",
.of_match_table = of_match_ptr(rockchip_mbox_of_match),


--
王晓腾 | 系统产品三部 | 软件工程师
Caesar Wang |  Product R Dept.III | Software engineer
**
福州瑞芯微电子股份有限公司
Fuzhou Rockchip Electronics Co.Ltd
地址:福建省福州市铜盘路软件大道89号软件园A区20号楼 (福州总部)
Addr: No.20 Building, A District, Fuzhou Software Park.Gulou 
District,Fuzhou,Fujian,China(Fuzhou Headquarters)
Tel:+86-0591-83991906-8221
Mobile: +86 15059456742
E-mail: w...@rock-chips.com
*

保密提示:本邮件及其附件含有机密信息,仅发送给本邮件所指特定收件人。若非该特定收件人,请勿复制、
使用或披露本邮件的任何内容。若误收本邮件,请从系统中永久性删除本邮件及所有附件,并以回复邮件或其他方式即刻告知发件人。
福州瑞芯微电子有限公司拥有本邮件信息的著作权及解释权,禁止任何未经授权许可的侵权行为。
IMPORTANT NOTICE: This email is from Fuzhou Rockchip Electronics Co., Ltd .The 
contents of this
email and any attachments may contain information that is privileged, 
confidential and/or exempt from disclosure under applicable law and relevant 
NDA.
If you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution, or use of the information is STRICTLY 
PROHIBITED.
Please immediately contact the sender as soon as possible and destroy the 
material in its entirety in any format. Thank you.




[PATCH v2 17/19] mailbox: rockchip: Use device-managed registration API

2018-12-17 Thread Thierry Reding
From: Thierry Reding 

Get rid of some boilerplate driver removal code by using the newly added
device-managed registration API.

Cc: Caesar Wang 
Signed-off-by: Thierry Reding 
---
 drivers/mailbox/rockchip-mailbox.c | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/mailbox/rockchip-mailbox.c 
b/drivers/mailbox/rockchip-mailbox.c
index d702a204f5c1..f24a77b1a0ff 100644
--- a/drivers/mailbox/rockchip-mailbox.c
+++ b/drivers/mailbox/rockchip-mailbox.c
@@ -247,28 +247,15 @@ static int rockchip_mbox_probe(struct platform_device 
*pdev)
mb->chans[i].msg = NULL;
}
 
-   ret = mbox_controller_register(>mbox);
+   ret = devm_mbox_controller_register(>dev, >mbox);
if (ret < 0)
dev_err(>dev, "Failed to register mailbox: %d\n", ret);
 
return ret;
 }
 
-static int rockchip_mbox_remove(struct platform_device *pdev)
-{
-   struct rockchip_mbox *mb = platform_get_drvdata(pdev);
-
-   if (!mb)
-   return -EINVAL;
-
-   mbox_controller_unregister(>mbox);
-
-   return 0;
-}
-
 static struct platform_driver rockchip_mbox_driver = {
.probe  = rockchip_mbox_probe,
-   .remove = rockchip_mbox_remove,
.driver = {
.name = "rockchip-mailbox",
.of_match_table = of_match_ptr(rockchip_mbox_of_match),
-- 
2.19.1