linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: linux-i2c@vger.kernel.org
Cc: Wolfram Sang <w.sang@pengutronix.de>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	Andy Walls <awalls@md.metrocast.net>,
	Jarod Wilson <jarod@redhat.com>, Joe Perches <joe@perches.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] drivers/staging/lirc: Remove obsolete cleanup for clientdata
Date: Mon, 24 Jan 2011 11:44:30 +0100	[thread overview]
Message-ID: <1295865880-27672-4-git-send-email-w.sang@pengutronix.de> (raw)
In-Reply-To: <1295865880-27672-1-git-send-email-w.sang@pengutronix.de>

A few new i2c-drivers came into the kernel which clear the clientdata-pointer
on exit or error. This is obsolete meanwhile, the core will do it. Simplify the
kfree() calls after that, the pointers don't need to be checked.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Joe Perches <joe@perches.com>
---

Compile tested only.

 drivers/staging/lirc/lirc_zilog.c |   28 +++++++++-------------------
 1 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index 3fe5f41..df1055f 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -1214,15 +1214,12 @@ static int ir_remove(struct i2c_client *client)
 
 	/* Good-bye Rx */
 	destroy_rx_kthread(ir->rx);
-	if (ir->rx != NULL) {
-		if (ir->rx->buf.fifo_initialized)
-			lirc_buffer_free(&ir->rx->buf);
-		i2c_set_clientdata(ir->rx->c, NULL);
-		kfree(ir->rx);
-	}
+	if (ir->rx && ir->rx->buf.fifo_initialized)
+		lirc_buffer_free(&ir->rx->buf);
+
+	kfree(ir->rx);
 
 	/* Good-bye Tx */
-	i2c_set_clientdata(ir->tx->c, NULL);
 	kfree(ir->tx);
 
 	/* Good-bye IR */
@@ -1388,18 +1385,11 @@ out_unregister:
 out_free_thread:
 	destroy_rx_kthread(ir->rx);
 out_free_xx:
-	if (ir->rx != NULL) {
-		if (ir->rx->buf.fifo_initialized)
-			lirc_buffer_free(&ir->rx->buf);
-		if (ir->rx->c != NULL)
-			i2c_set_clientdata(ir->rx->c, NULL);
-		kfree(ir->rx);
-	}
-	if (ir->tx != NULL) {
-		if (ir->tx->c != NULL)
-			i2c_set_clientdata(ir->tx->c, NULL);
-		kfree(ir->tx);
-	}
+	if (ir->rx && ir->rx->buf.fifo_initialized)
+		lirc_buffer_free(&ir->rx->buf);
+
+	kfree(ir->rx);
+	kfree(ir->tx);
 out_free_ir:
 	del_ir_device(ir);
 	kfree(ir);
-- 
1.7.2.3

  parent reply	other threads:[~2011-01-24 10:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 10:44 [PATCH 1/4] mfd: Remove obsolete cleanup for clientdata Wolfram Sang
2011-01-24 10:44 ` [PATCH 2/4] power: " Wolfram Sang
     [not found] ` <1295865880-27672-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-01-24 10:44   ` [PATCH 3/4] staging/ste_rmi4: " Wolfram Sang
2011-01-31 10:45   ` [PATCH 1/4] mfd: " Samuel Ortiz
2011-01-24 10:44 ` Wolfram Sang [this message]
     [not found]   ` <1295865880-27672-4-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-01-24 14:54     ` [PATCH 4/4] drivers/staging/lirc: " Jarod Wilson
2011-01-25  0:09     ` Andy Walls
2011-01-25  7:49       ` Jean Delvare
2011-01-25 20:57       ` Wolfram Sang

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=1295865880-27672-4-git-send-email-w.sang@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=awalls@md.metrocast.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=jarod@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@redhat.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;
as well as URLs for NNTP newsgroup(s).