diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2014-04-21 07:39:53 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2014-04-28 20:50:07 -0400 |
commit | 577bef11048c9dc7ce5f9f18e89bf5305be49554 (patch) | |
tree | 3f15bf1469632922dcbc5cc85dea8d6b97034a66 /drivers/extcon | |
parent | 22f9afb95ba67eb6839e2b5499f5f42a767b1c18 (diff) |
extcon: max77693: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon-max77693.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index f0f18e29ae07..2c7c3e191591 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
@@ -1175,23 +1175,22 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | /* Initialize extcon device */ | 1177 | /* Initialize extcon device */ |
1178 | info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev), | 1178 | info->edev = devm_extcon_dev_allocate(&pdev->dev, |
1179 | GFP_KERNEL); | 1179 | max77693_extcon_cable); |
1180 | if (!info->edev) { | 1180 | if (IS_ERR(info->edev)) { |
1181 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); | 1181 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); |
1182 | ret = -ENOMEM; | 1182 | ret = -ENOMEM; |
1183 | goto err_irq; | 1183 | goto err_irq; |
1184 | } | 1184 | } |
1185 | info->edev->name = DEV_NAME; | 1185 | info->edev->name = DEV_NAME; |
1186 | info->edev->dev.parent = &pdev->dev; | 1186 | info->edev->dev.parent = &pdev->dev; |
1187 | info->edev->supported_cable = max77693_extcon_cable; | 1187 | |
1188 | ret = devm_extcon_dev_register(&pdev->dev, info->edev); | 1188 | ret = devm_extcon_dev_register(&pdev->dev, info->edev); |
1189 | if (ret) { | 1189 | if (ret) { |
1190 | dev_err(&pdev->dev, "failed to register extcon device\n"); | 1190 | dev_err(&pdev->dev, "failed to register extcon device\n"); |
1191 | goto err_irq; | 1191 | goto err_irq; |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | |||
1195 | /* Initialize MUIC register by using platform data or default data */ | 1194 | /* Initialize MUIC register by using platform data or default data */ |
1196 | if (pdata && pdata->muic_data) { | 1195 | if (pdata && pdata->muic_data) { |
1197 | init_data = pdata->muic_data->init_data; | 1196 | init_data = pdata->muic_data->init_data; |