public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Paubert <paubert@iram.es>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org
Subject: Recent I2C "dead code removal" breaks pmac sound.
Date: Thu, 11 Nov 2004 19:09:02 +0100	[thread overview]
Message-ID: <20041111180902.GA8697@iram.es> (raw)

	Hi,
	
a recent patch to drivers/i2c/i2c-core.c removed a bunch of
functions because they were unused; i2c_smbus_write_block_data
was in the lot. I happen to have a different definition of dead
code since grepping for it reveals (in sound/ppc/pmac.h):

#define snd_pmac_keywest_write(i2c,cmd,len,data) i2c_smbus_write_block_data((i2c)->client, cmd, len, data)

I only get a link time error since the removed functions are still
declared in include/linux/i2c.h, and that is certainly wrong.

For now I have successfully compiled with the following patch
which ressuscitates the function I need. In a recent pull, the 
offending cset is 1.2114.2.8 from November 5th by arjan.

This patch is _not_ final, but I don't know what sould be done:
excluding the cset, or applying the following and making
the include file match the existing functions, or something
completely different?

	Gabriel


===== drivers/i2c/i2c-core.c 1.58 vs edited =====
--- 1.58/drivers/i2c/i2c-core.c	2004-11-05 20:49:20 +01:00
+++ edited/drivers/i2c/i2c-core.c	2004-11-11 18:33:23 +01:00
@@ -1021,6 +1021,22 @@
 	                      I2C_SMBUS_WORD_DATA,&data);
 }
 
+/* Returns the number of bytes transferred */
+s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
+			       u8 length, u8 *values)
+{
+	union i2c_smbus_data data;
+	int i;
+	if (length > I2C_SMBUS_BLOCK_MAX)
+		length = I2C_SMBUS_BLOCK_MAX;
+	for (i = 1; i <= length; i++)
+		data.block[i] = values[i-1];
+	data.block[0] = length;
+	return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
+			      I2C_SMBUS_WRITE,command,
+			      I2C_SMBUS_BLOCK_DATA,&data);
+}
+
 /* Returns the number of read bytes */
 s32 i2c_smbus_block_process_call(struct i2c_client *client, u8 command, u8 length, u8 *values)
 {
@@ -1279,6 +1295,7 @@
 EXPORT_SYMBOL(i2c_smbus_write_byte_data);
 EXPORT_SYMBOL(i2c_smbus_read_word_data);
 EXPORT_SYMBOL(i2c_smbus_write_word_data);
+EXPORT_SYMBOL(i2c_smbus_write_block_data);
 EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
 
 EXPORT_SYMBOL(i2c_get_functionality);



             reply	other threads:[~2004-11-11 18:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-11 18:09 Gabriel Paubert [this message]
2004-11-11 18:22 ` Recent I2C "dead code removal" breaks pmac sound Greg KH
2004-11-12 12:22   ` Gabriel Paubert
2004-11-12 21:20     ` Greg KH

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=20041111180902.GA8697@iram.es \
    --to=paubert@iram.es \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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