From: Levente Kurusa <levex@linux.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Levente Kurusa <levex@linux.com>,
Paul Mundt <lethal@linux-sh.org>,
Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>,
linux-sh@vger.kernel.org
Subject: [PATCH 29/38] superhyway: maple: add missing put_device call
Date: Thu, 19 Dec 2013 15:03:40 +0000 [thread overview]
Message-ID: <1387465429-3568-30-git-send-email-levex@linux.com> (raw)
In-Reply-To: <1387465429-3568-2-git-send-email-levex@linux.com>
This is required so that we give up the last reference to the device.
Also rework maple_release_device to use maple_free_dev instead, avoiding
same code being in two functions at the same time.
Signed-off-by: Levente Kurusa <levex@linux.com>
---
drivers/sh/maple/maple.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index bec81c2..c4afb7e 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -134,16 +134,18 @@ static int maple_dma_done(void)
return (__raw_readl(MAPLE_STATE) & 1) = 0;
}
+static void maple_free_dev(struct maple_device *mdev)
+{
+ kmem_cache_free(maple_queue_cache, mdev->mq->recvbuf);
+ kfree(mdev->mq);
+ kfree(mdev);
+}
+
static void maple_release_device(struct device *dev)
{
struct maple_device *mdev;
- struct mapleq *mq;
-
mdev = to_maple_dev(dev);
- mq = mdev->mq;
- kmem_cache_free(maple_queue_cache, mq->recvbuf);
- kfree(mq);
- kfree(mdev);
+ maple_free_dev(mdev);
}
/**
@@ -234,13 +236,6 @@ static struct maple_device *maple_alloc_dev(int port, int unit)
return mdev;
}
-static void maple_free_dev(struct maple_device *mdev)
-{
- kmem_cache_free(maple_queue_cache, mdev->mq->recvbuf);
- kfree(mdev->mq);
- kfree(mdev);
-}
-
/* process the command queue into a maple command block
* terminating command has bit 32 of first long set to 0
*/
@@ -393,7 +388,7 @@ static void maple_attach_driver(struct maple_device *mdev)
dev_warn(&mdev->dev, "could not register device at"
" (%d, %d), with error 0x%X\n", mdev->unit,
mdev->port, error);
- maple_free_dev(mdev);
+ put_device(&mdev->dev);
mdev = NULL;
return;
}
--
1.8.3.1
WARNING: multiple messages have this Message-ID (diff)
From: Levente Kurusa <levex@linux.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Levente Kurusa <levex@linux.com>,
Paul Mundt <lethal@linux-sh.org>,
Simon Horman <horms@verge.net.au>,
Magnus Damm <magnus.damm@gmail.com>,
linux-sh@vger.kernel.org
Subject: [PATCH 29/38] superhyway: maple: add missing put_device call
Date: Thu, 19 Dec 2013 16:03:40 +0100 [thread overview]
Message-ID: <1387465429-3568-30-git-send-email-levex@linux.com> (raw)
In-Reply-To: <1387465429-3568-2-git-send-email-levex@linux.com>
This is required so that we give up the last reference to the device.
Also rework maple_release_device to use maple_free_dev instead, avoiding
same code being in two functions at the same time.
Signed-off-by: Levente Kurusa <levex@linux.com>
---
drivers/sh/maple/maple.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index bec81c2..c4afb7e 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -134,16 +134,18 @@ static int maple_dma_done(void)
return (__raw_readl(MAPLE_STATE) & 1) == 0;
}
+static void maple_free_dev(struct maple_device *mdev)
+{
+ kmem_cache_free(maple_queue_cache, mdev->mq->recvbuf);
+ kfree(mdev->mq);
+ kfree(mdev);
+}
+
static void maple_release_device(struct device *dev)
{
struct maple_device *mdev;
- struct mapleq *mq;
-
mdev = to_maple_dev(dev);
- mq = mdev->mq;
- kmem_cache_free(maple_queue_cache, mq->recvbuf);
- kfree(mq);
- kfree(mdev);
+ maple_free_dev(mdev);
}
/**
@@ -234,13 +236,6 @@ static struct maple_device *maple_alloc_dev(int port, int unit)
return mdev;
}
-static void maple_free_dev(struct maple_device *mdev)
-{
- kmem_cache_free(maple_queue_cache, mdev->mq->recvbuf);
- kfree(mdev->mq);
- kfree(mdev);
-}
-
/* process the command queue into a maple command block
* terminating command has bit 32 of first long set to 0
*/
@@ -393,7 +388,7 @@ static void maple_attach_driver(struct maple_device *mdev)
dev_warn(&mdev->dev, "could not register device at"
" (%d, %d), with error 0x%X\n", mdev->unit,
mdev->port, error);
- maple_free_dev(mdev);
+ put_device(&mdev->dev);
mdev = NULL;
return;
}
--
1.8.3.1
next prev parent reply other threads:[~2013-12-19 15:03 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-19 15:03 [PATCH 01/38] sh: dma-sysfs: add missing put_device call Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 02/38] powerpc: qe_lib: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 03/38] powerpc: cell: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 04/38] powerpc: kernel: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 05/38] sparc: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-27 17:43 ` David Miller
2013-12-27 17:43 ` David Miller
2013-12-19 15:03 ` [PATCH 06/38] arm: mach-s3c64: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 07/38] arm: locomo: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 08/38] arm: mach-rpc: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 09/38] arm: mach-imx: add missing put_device calls Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 10/38] arm: exynos: add missing put_device call Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 11/38] arm: mach-integrator: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 12/38] arm: s5pv210: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 13/38] arm: s390: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 14/38] mips: txx9: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 15/38] mips: txx9: 7segled: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 16/38] mips: sgi-ip22: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 17/38] parisc: kernel: " Levente Kurusa
2013-12-19 15:29 ` James Bottomley
2013-12-19 15:03 ` [PATCH 18/38] ia64: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 19/38] net: atm: " Levente Kurusa
2013-12-27 17:40 ` David Miller
2013-12-19 15:03 ` [PATCH 20/38] net: iucv: " Levente Kurusa
2013-12-27 17:41 ` David Miller
2013-12-19 15:03 ` [PATCH 21/38] workqueue: " Levente Kurusa
2013-12-19 15:20 ` Tejun Heo
2013-12-19 15:31 ` Levente Kurusa
2013-12-19 15:34 ` Tejun Heo
2013-12-19 15:42 ` Levente Kurusa
2013-12-19 15:45 ` Tejun Heo
2013-12-19 15:03 ` [PATCH 22/38] sound: ac97: " Levente Kurusa
2013-12-19 16:17 ` Takashi Iwai
2013-12-19 15:03 ` [PATCH 23/38] sound: soc: " Levente Kurusa
2013-12-21 14:31 ` Mark Brown
2013-12-21 14:31 ` Mark Brown
2013-12-19 15:03 ` [PATCH 24/38] pcmcia: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 25/38] pnp: card: " Levente Kurusa
2014-01-05 22:04 ` Rafael J. Wysocki
2013-12-19 15:03 ` [PATCH 26/38] xen: xenbus: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2014-01-02 13:53 ` David Vrabel
2014-01-02 13:53 ` [Xen-devel] " David Vrabel
2014-01-06 10:00 ` Ian Campbell
2014-01-06 11:00 ` David Vrabel
2014-01-06 11:00 ` [Xen-devel] " David Vrabel
2014-01-06 11:09 ` Ian Campbell
2014-01-06 11:09 ` Ian Campbell
2014-01-06 10:00 ` Ian Campbell
2013-12-19 15:03 ` [PATCH 27/38] superhyway: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` [PATCH 28/38] superhyway: intc: " Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa
2013-12-19 15:03 ` Levente Kurusa [this message]
2013-12-19 15:03 ` [PATCH 29/38] superhyway: maple: " Levente Kurusa
2013-12-19 15:03 ` [PATCH 30/38] vlynq: " Levente Kurusa
2013-12-19 17:37 ` Florian Fainelli
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=1387465429-3568-30-git-send-email-levex@linux.com \
--to=levex@linux.com \
--cc=horms@verge.net.au \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.