From: Chanwoo Choi <cw00.choi@samsung.com>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-kernel@vger.kernel.org, myungjoo.ham@samsung.com,
balbi@ti.com, gg@slimlogic.co.uk, kishon@ti.com,
ckeepax@opensource.wolfsonmicro.com, broonie@kernel.org,
k.kozlowski@samsung.com, kyungmin.park@samsung.com,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCHv2 6/9] extcon: palmas: Use devm_extcon_dev_allocate for extcon_dev
Date: Thu, 24 Apr 2014 14:22:17 +0900 [thread overview]
Message-ID: <53589F89.2030406@samsung.com> (raw)
In-Reply-To: <1398081742-24277-7-git-send-email-cw00.choi@samsung.com>
Hi Kishon, Felipe,
If you possible, I'd like you to test or review this patch.
And then I'll apply it on extcon-next branch if you could give
me a acked or tested message.
- This patch has a depenency on extcon-next branch.
Following patchset support devm_extcon_dev_* function.
[1] https://lkml.org/lkml/2014/4/21/140
[2] https://lkml.org/lkml/2014/4/21/164
Thanks,
Chanwoo Choi
On 04/21/2014 09:02 PM, Chanwoo Choi wrote:
> This patch use devm_extcon_dev_allocate() to simplify the memory control
> of extcon device.
>
> Cc: Graeme Gregory <gg@slimlogic.co.uk>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
> drivers/extcon/extcon-palmas.c | 35 ++++++++++++++++++++---------------
> include/linux/mfd/palmas.h | 2 +-
> 2 files changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
> index 1a770e0..a9299ea 100644
> --- a/drivers/extcon/extcon-palmas.c
> +++ b/drivers/extcon/extcon-palmas.c
> @@ -57,7 +57,7 @@ static irqreturn_t palmas_vbus_irq_handler(int irq, void *_palmas_usb)
> if (vbus_line_state & PALMAS_INT3_LINE_STATE_VBUS) {
> if (palmas_usb->linkstat != PALMAS_USB_STATE_VBUS) {
> palmas_usb->linkstat = PALMAS_USB_STATE_VBUS;
> - extcon_set_cable_state(&palmas_usb->edev, "USB", true);
> + extcon_set_cable_state(palmas_usb->edev, "USB", true);
> dev_info(palmas_usb->dev, "USB cable is attached\n");
> } else {
> dev_dbg(palmas_usb->dev,
> @@ -66,7 +66,7 @@ static irqreturn_t palmas_vbus_irq_handler(int irq, void *_palmas_usb)
> } else if (!(vbus_line_state & PALMAS_INT3_LINE_STATE_VBUS)) {
> if (palmas_usb->linkstat == PALMAS_USB_STATE_VBUS) {
> palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT;
> - extcon_set_cable_state(&palmas_usb->edev, "USB", false);
> + extcon_set_cable_state(palmas_usb->edev, "USB", false);
> dev_info(palmas_usb->dev, "USB cable is detached\n");
> } else {
> dev_dbg(palmas_usb->dev,
> @@ -93,7 +93,7 @@ static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb)
> PALMAS_USB_ID_INT_LATCH_CLR,
> PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND);
> palmas_usb->linkstat = PALMAS_USB_STATE_ID;
> - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", true);
> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true);
> dev_info(palmas_usb->dev, "USB-HOST cable is attached\n");
> } else if ((set & PALMAS_USB_ID_INT_SRC_ID_FLOAT) &&
> (id_src & PALMAS_USB_ID_INT_SRC_ID_FLOAT)) {
> @@ -101,17 +101,17 @@ static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb)
> PALMAS_USB_ID_INT_LATCH_CLR,
> PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT);
> palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT;
> - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", false);
> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", false);
> dev_info(palmas_usb->dev, "USB-HOST cable is detached\n");
> } else if ((palmas_usb->linkstat == PALMAS_USB_STATE_ID) &&
> (!(set & PALMAS_USB_ID_INT_SRC_ID_GND))) {
> palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT;
> - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", false);
> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", false);
> dev_info(palmas_usb->dev, "USB-HOST cable is detached\n");
> } else if ((palmas_usb->linkstat == PALMAS_USB_STATE_DISCONNECT) &&
> (id_src & PALMAS_USB_ID_INT_SRC_ID_GND)) {
> palmas_usb->linkstat = PALMAS_USB_STATE_ID;
> - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", true);
> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true);
> dev_info(palmas_usb->dev, " USB-HOST cable is attached\n");
> }
>
> @@ -187,15 +187,20 @@ static int palmas_usb_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, palmas_usb);
>
> - palmas_usb->edev.supported_cable = palmas_extcon_cable;
> - palmas_usb->edev.dev.parent = palmas_usb->dev;
> - palmas_usb->edev.name = kstrdup(node->name, GFP_KERNEL);
> - palmas_usb->edev.mutually_exclusive = mutually_exclusive;
> + palmas_usb->edev = devm_extcon_dev_allocate(&pdev->dev,
> + palmas_extcon_cable);
> + if (!palmas_usb->edev) {
> + dev_err(&pdev->dev, "failed to allocate extcon device\n");
> + return -ENOMEM;
> + }
> + palmas_usb->edev->name = kstrdup(node->name, GFP_KERNEL);
> + palmas_usb->edev->dev.parent = palmas_usb->dev;
> + palmas_usb->edev->mutually_exclusive = mutually_exclusive;
>
> - status = devm_extcon_dev_register(&pdev->dev, &palmas_usb->edev);
> + status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev);
> if (status) {
> dev_err(&pdev->dev, "failed to register extcon device\n");
> - kfree(palmas_usb->edev.name);
> + kfree(palmas_usb->edev->name);
> return status;
> }
>
> @@ -209,7 +214,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
> if (status < 0) {
> dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
> palmas_usb->id_irq, status);
> - kfree(palmas_usb->edev.name);
> + kfree(palmas_usb->edev->name);
> return status;
> }
> }
> @@ -224,7 +229,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
> if (status < 0) {
> dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
> palmas_usb->vbus_irq, status);
> - kfree(palmas_usb->edev.name);
> + kfree(palmas_usb->edev->name);
> return status;
> }
> }
> @@ -238,7 +243,7 @@ static int palmas_usb_remove(struct platform_device *pdev)
> {
> struct palmas_usb *palmas_usb = platform_get_drvdata(pdev);
>
> - kfree(palmas_usb->edev.name);
> + kfree(palmas_usb->edev->name);
>
> return 0;
> }
> diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
> index 9974e38..b8f87b7 100644
> --- a/include/linux/mfd/palmas.h
> +++ b/include/linux/mfd/palmas.h
> @@ -415,7 +415,7 @@ struct palmas_usb {
> struct palmas *palmas;
> struct device *dev;
>
> - struct extcon_dev edev;
> + struct extcon_dev *edev;
>
> int id_otg_irq;
> int id_irq;
>
next prev parent reply other threads:[~2014-04-24 5:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 12:02 [PATCHv2 0/9] extcon: Support devm_extcon_dev_allocate/free() Chanwoo Choi
2014-04-21 12:02 ` [PATCHv2 1/9] extcon: Add extcon_dev_allocate/free() to control the memory of extcon device Chanwoo Choi
2014-04-21 12:02 ` [PATCHv2 2/9] extcon: Add devm_extcon_dev_allocate/free to manage the resource " Chanwoo Choi
2014-04-21 12:02 ` [PATCHv2 3/9] extcon: max8997: Use devm_extcon_dev_allocate for extcon_dev Chanwoo Choi
2014-04-22 8:17 ` Krzysztof Kozlowski
2014-04-21 12:02 ` [PATCHv2 4/9] extcon: max77693: " Chanwoo Choi
2014-04-22 8:18 ` Krzysztof Kozlowski
2014-04-21 12:02 ` [PATCHv2 5/9] extcon: max14577: " Chanwoo Choi
2014-04-22 8:18 ` Krzysztof Kozlowski
2014-04-21 12:02 ` [PATCHv2 6/9] extcon: palmas: " Chanwoo Choi
2014-04-23 13:38 ` Lee Jones
2014-04-23 13:55 ` Lee Jones
2014-04-24 5:22 ` Chanwoo Choi [this message]
2014-04-24 14:10 ` Felipe Balbi
2014-04-21 12:02 ` [PATCHv2 7/9] extcon: arizona: " Chanwoo Choi
2014-04-21 12:55 ` Charles Keepax
2014-04-21 12:02 ` [PATCHv2 8/9] extcon: adc-jack: " Chanwoo Choi
2014-04-21 12:02 ` [PATCHv2 9/9] extcon: gpio: " Chanwoo Choi
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=53589F89.2030406@samsung.com \
--to=cw00.choi@samsung.com \
--cc=balbi@ti.com \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.wolfsonmicro.com \
--cc=gg@slimlogic.co.uk \
--cc=k.kozlowski@samsung.com \
--cc=kishon@ti.com \
--cc=kyungmin.park@samsung.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=sameo@linux.intel.com \
/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
Powered by JetHome