mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, khali@linux-fr.org
Subject: [patch 11/29] I2C: 24RF08 corruption prevention (again)
Date: Fri, 29 Jul 2005 12:15:33 -0700	[thread overview]
Message-ID: <20050729191533.GM5095@kroah.com> (raw)
In-Reply-To: <20050729191255.GA5095@kroah.com>

From: Jean Delvare <khali@linux-fr.org>

The 24RF08 corruption prevention in the eeprom and max6875 drivers wasn't
complete. For one thing, the additional quick write should happen as soon
as possible and unconditionally, while both drivers had error paths before.
For another, when a given chip is forced, the core does not emit a quick
write, so a second quick write would cause the corruption rather than
prevent it.

I plan to move the corruption prevention in the core in the long run, so
that individual drivers don't have to care anymore. But I need to merge
i2c_probe and i2c_detect before I do (work in progress).

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/i2c/chips/eeprom.c  |    8 +++++---
 drivers/i2c/chips/max6875.c |    8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

--- gregkh-2.6.orig/drivers/i2c/chips/eeprom.c	2005-07-29 11:36:14.000000000 -0700
+++ gregkh-2.6/drivers/i2c/chips/eeprom.c	2005-07-29 11:36:18.000000000 -0700
@@ -163,6 +163,11 @@
 	struct eeprom_data *data;
 	int err = 0;
 
+	/* prevent 24RF08 corruption */
+	if (kind < 0)
+		i2c_smbus_xfer(adapter, address, 0, 0, 0,
+			       I2C_SMBUS_QUICK, NULL);
+
 	/* There are three ways we can read the EEPROM data:
 	   (1) I2C block reads (faster, but unsupported by most adapters)
 	   (2) Consecutive byte reads (100% overhead)
@@ -187,9 +192,6 @@
 	new_client->driver = &eeprom_driver;
 	new_client->flags = 0;
 
-	/* prevent 24RF08 corruption */
-	i2c_smbus_write_quick(new_client, 0);
-
 	/* Fill in the remaining client fields */
 	strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE);
 	data->valid = 0;
--- gregkh-2.6.orig/drivers/i2c/chips/max6875.c	2005-07-29 11:36:14.000000000 -0700
+++ gregkh-2.6/drivers/i2c/chips/max6875.c	2005-07-29 11:36:18.000000000 -0700
@@ -343,6 +343,11 @@
 	struct max6875_data *data;
 	int err = 0;
 
+	/* Prevent 24RF08 corruption (in case of user error) */
+	if (kind < 0)
+		i2c_smbus_xfer(adapter, address, 0, 0, 0,
+			       I2C_SMBUS_QUICK, NULL);
+
 	/* There are three ways we can read the EEPROM data:
 	   (1) I2C block reads (faster, but unsupported by most adapters)
 	   (2) Consecutive byte reads (100% overhead)
@@ -370,9 +375,6 @@
 	new_client->driver = &max6875_driver;
 	new_client->flags = 0;
 
-	/* Prevent 24RF08 corruption */
-	i2c_smbus_write_quick(new_client, 0);
-
 	/* Setup the user section */
 	data->blocks[max6875_eeprom_user].type    = max6875_eeprom_user;
 	data->blocks[max6875_eeprom_user].slices  = USER_EEPROM_SLICES;

--

  parent reply	other threads:[~2005-07-30  0:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050729184950.014589000@press.kroah.org>
2005-07-29 19:12 ` [patch 00/29] fixes for 2.6.13-rc4 Greg KH
2005-07-29 19:13   ` [patch 02/29] sysfs: fix sysfs_chmod_file Greg KH
2005-07-29 19:14   ` [patch 01/29] stable_api_nonsense.txt fixes Greg KH
2005-07-29 19:14   ` [patch 03/29] sysfs: fix sysfs_setattr Greg KH
2005-07-29 19:14   ` [patch 04/29] DEBUG_FS must depend on SYSFS Greg KH
2005-07-29 19:14   ` [patch 05/29] Add the rules about the -stable kernel releases to the Documentation directory Greg KH
2005-07-29 19:14   ` [patch 06/29] I2C-MPC: Restore code removed Greg KH
2005-07-29 19:15   ` [patch 07/29] I2C: ds1337 - fix 12/24 hour mode bug Greg KH
2005-07-29 19:15   ` [patch 08/29] I2C: Missing space in split strings Greg KH
2005-07-29 19:15   ` [patch 09/29] I2C: use time_after in 3 chip drivers Greg KH
2005-07-29 19:15   ` [patch 10/29] I2C: missing new lines in i2c-core messages Greg KH
2005-07-29 19:15   ` Greg KH [this message]
2005-07-29 19:15   ` [patch 12/29] w1: kconfig/Makefile fix Greg KH
2005-07-29 19:15   ` [patch 13/29] PCI: Hidden SMBus bridge on Toshiba Tecra M2 Greg KH
2005-07-29 19:16   ` [patch 14/29] PCI: Adjust PCI rom code to handle more broken ROMs Greg KH
2005-07-29 19:16   ` [patch 15/29] PCI: remove PCI_BRIDGE_CTL_VGA handling from setup-bus.c Greg KH
2005-07-29 19:16   ` [patch 16/29] PCI: fix up errors after dma bursting patch and CONFIG_PCI=n -- bug? Greg KH
2005-07-29 19:16   ` [patch 17/29] USB: ftdi_sio: new microHAM and Evolution Robotics devices Greg KH
2005-07-29 19:16   ` [patch 18/29] USB: ftdi_sio: Update RTS and DTR simultaneously Greg KH
2005-07-29 19:16   ` [patch 19/29] USB: ftdi_sio: fix a couple of timeouts Greg KH
2005-07-29 19:16   ` [patch 20/29] USB: usbfs: Don't leak uninitialized data Greg KH
2005-07-29 19:17   ` [patch 21/29] USB: drivers/usb/net/: remove two unused multicast_filter_limit variables Greg KH
2005-07-29 19:17   ` [patch 22/29] USB: Usbcore: Don't try to delete unregistered interfaces Greg KH
2005-07-29 19:17   ` [patch 23/29] USB: ldusb fixes Greg KH
2005-07-29 19:17   ` [patch 24/29] USB: Patch for KYOCERA AH-K3001V support Greg KH
2005-07-29 19:17   ` [patch 25/29] USB: drivers/net/usb/zd1201.c: Gigabyte GN-WLBZ201 dongle usbid Greg KH
2005-07-29 19:18   ` [patch 26/29] USB: add S3C24XX USB Host driver support Greg KH
2005-07-29 19:18   ` [patch 27/29] USB: fix Bug in usb-skeleton.c Greg KH
2005-07-29 19:18   ` [patch 28/29] USB: fix in usb_calc_bus_time Greg KH
2005-07-29 19:18   ` [patch 29/29] USB: hidinput_hid_event() oops fix Greg KH
2005-07-29 19:13 ` [patch 01/29] stable_api_nonsense.txt fixes 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=20050729191533.GM5095@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@osdl.org \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®