- 25 10月, 2010 1 次提交
-
-
由 Jean Delvare 提交于
This makes the calling site's code clearer IMHO. Signed-off-by: NJean Delvare <khali@linux-fr.org> Acked-by: NMichael Lawnick <ml.lawnick@gmx.de>
-
- 12 8月, 2010 3 次提交
-
-
由 Michael Lawnick 提交于
Add multiplexed bus core support. I2C multiplexer and switches like pca954x get instantiated as new adapters per port. Signed-off-by: NMichael Lawnick <ml.lawnick@gmx.de> Acked-by: NRodolfo Giometti <giometti@linux.it> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
由 Julia Lawall 提交于
Use memdup_user when user data is immediately copied into the allocated region. Note that in the second case, the ++i is no longer necessary, as the last value is already freed if needed by the call to memdup_user. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression from,to,size,flag; position p; identifier l1,l2; @@ - to = \(kmalloc@p\|kzalloc@p\)(size,flag); + to = memdup_user(from,size); if ( - to==NULL + IS_ERR(to) || ...) { <+... when != goto l1; - -ENOMEM + PTR_ERR(to) ...+> } - if (copy_from_user(to, from, size) != 0) { - <+... when != goto l2; - -EFAULT - ...+> - } // </smpl> Signed-off-by: NJulia Lawall <julia@diku.dk> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
由 Joe Perches 提交于
Signed-off-by: NJoe Perches <joe@perches.com> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 22 5月, 2010 2 次提交
-
-
由 Farid Hammane 提交于
Fix all coding style issues found by checkpatch.pl. Signed-off-by: NFarid Hammane <farid.hammane@gmail.com> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
由 H Hartley Sweeten 提交于
The private_data member of struct file is a void *, there is no need to cast it. Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 07 12月, 2009 1 次提交
-
-
由 Vincent Sanders 提交于
The BKL is held over a kmalloc so cannot protect anything beyond that. The two calls before the kmalloc have their own locking. Improve device open function by removing the now unnecessary ret variable Signed-off-by: NVincent Sanders <vince@simtec.co.uk> Signed-off-by: NThomas Gleixner <tglx@linutronix.de> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 25 2月, 2009 1 次提交
-
-
由 Jean Delvare 提交于
The unit in which user-space can set the bus timeout value is jiffies for historical reasons (back when HZ was always 100.) This is however not good because user-space doesn't know how long a jiffy lasts. The timeout value should instead be set in a fixed time unit. Given the original value of HZ, this unit should be 10 ms, for compatibility. Signed-off-by: NJean Delvare <khali@linux-fr.org> Acked-by: NWolfram Sang <w.sang@pengutronix.de>
-
- 17 10月, 2008 1 次提交
-
-
由 Greg Kroah-Hartman 提交于
Now that device_create() has been audited, rename things back to the original call to be sane. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 24 9月, 2008 1 次提交
-
-
由 Sven Wegener 提交于
We need to convert the error pointer from class_create(), else we'll return the successful return code from register_chrdev() on failure. Signed-off-by: NSven Wegener <sven.wegener@stealer.net> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 11 8月, 2008 1 次提交
-
-
由 David Brownell 提交于
Fix various printk format strings where %zd was passed a size_t; those should be %zu instead. (Courtesy of a version of GCC which warns when these details are wrong.) Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 22 7月, 2008 1 次提交
-
-
由 Greg Kroah-Hartman 提交于
device_create() is race-prone, so use the race-free device_create_drvdata() instead as device_create() is going away. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 15 7月, 2008 2 次提交
-
-
由 Jean Delvare 提交于
Implementing detach_client is optional, so there is no point in an empty implementation. Likewise, i2c driver IDs are optional, and we don't need one. Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
由 Alan Cox 提交于
This is part of the effort to get rid of the BKL. [JD: In fact i2c-dev doesn't need more locking than is already done for the other i2c drivers, so we can simply switch to unlocked_ioctl.] Signed-off-by: NAlan Cox <alan@redhat.com> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 19 5月, 2008 1 次提交
-
-
由 Jonathan Corbet 提交于
Signed-off-by: NJonathan Corbet <corbet@lwn.net>
-
- 23 4月, 2008 1 次提交
-
-
由 Jean Delvare 提交于
Split the handling of the I2C_RDWR and I2C_SMBUS ioctls to their own functions. This limits the stack usage, saves one level of indentation and makes the code more readable. Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 28 1月, 2008 1 次提交
-
-
由 David Brownell 提交于
The i2c_adapter.clients list of i2c_client nodes duplicates driver model state. This patch starts removing that list, letting us remove most existing users of those i2c-core lists. * The core I2C code now iterates over the driver model's list instead of the i2c-internal one in some places where it's safe: - Passing a command/ioctl to each client, a mechanims used almost exclusively by DVB adapters; - Device address checking, in both i2c-core and i2c-dev. * Provide i2c_verify_client() to use with driver model iterators. * Flag the relevant i2c_adapter and i2c_client fields as deprecated, to help prevent new users from appearing. For the moment the list needs to stick around, since some issues show up when deleting devices created by legacy I2C drivers. (They don't follow standard driver model rules. Removing those devices can cause self-deadlocks.) Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 15 1月, 2008 1 次提交
-
-
由 Joe Perches 提交于
[JD: One more fix in i2c-dev.] Signed-off-by: NJoe Perches <joe@perches.com> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 16 11月, 2007 2 次提交
-
-
由 Jean Delvare 提交于
Let i2c-dev deal properly with new-style i2c clients. Instead of considering them always busy, it needs to check wether a driver is bound to them or not. This is still not completely correct, as the client could become busy later, but the same problem already existed before new-style clients were introduced. We'll want to fix it someday. Signed-off-by: NJean Delvare <khali@linux-fr.org> Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
-
由 David Brownell 提交于
This adds some "how does this work" comments to the i2c-dev driver, plus separators between the three main components: - The parallel list of i2c_adapters ("i2c_dev_list"), each of which gets a "struct i2c_dev" and a /dev/i2c-X character special file. - An i2cdev_driver gets adapter add/remove notifications, which are used to maintain that list of adapters. - Special file operations, which let userspace talk either directly to the adapter (for i2c_msg operations) or through cached addressing info using an anonymous i2c_client (never registered anywhere). Plus there's the usual module load/unload record keeping. After making sense of this code, I think that the anonymous i2c_client is pretty shady. But since it's never registered, using this code with a system set up for "new style" I2C drivers is no more complicated than always using the I2C_SLAVE_FORCE ioctl (instead of I2C_SLAVE). Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 14 10月, 2007 2 次提交
-
-
由 David Brownell 提交于
This removes: - An effectively unused hook: i2c_algorithm.algo_control. - The i2c_control() call, used only by i2c-dev to call that unused hook or set two barely supported adapter params. (That param setting moves into i2c-dev.c ... still iffy due to lack of locking, but no other changes.) As shown by diffstat, this is a net code shrink. It also reduces the complexity of the I2C adapter and /dev interfaces. Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
由 David Brownell 提交于
The I2C_M_RECV_LEN calling convention for i2c_mesg.flags involves playing games with reported buffer lengths. (They start out less than their actual size, and the length is then modified to reflect how many bytes were delivered ... which one hopes is less than the presumed actual size.) Refuse to play such error prone games across the boundary between userspace and kernel. Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 12 7月, 2007 1 次提交
-
-
由 Jean Delvare 提交于
Let the drivers specify how many bytes they want to read with i2c_smbus_read_i2c_block_data(). So far, the block count was hard-coded to I2C_SMBUS_BLOCK_MAX (32), which did not make much sense. Many driver authors complained about this before, and I believe it's about time to fix it. Right now, authors have to do technically stupid things, such as individual byte reads or full-fledged I2C messaging, to work around the problem. We do not want to encourage that. I even found that some bus drivers (e.g. i2c-amd8111) already implemented I2C block read the "right" way, that is, they didn't follow the old, broken standard. The fact that it was never noticed before just shows how little i2c_smbus_read_i2c_block_data() was used, which isn't that surprising given how broken its prototype was so far. There are some obvious compatiblity considerations: * This changes the i2c_smbus_read_i2c_block_data() prototype. Users outside the kernel tree will notice at compilation time, and will have to update their code. * User-space has access to i2c_smbus_xfer() directly using i2c-dev, so the changed expectations would affect tools such as i2cdump. In order to preserve binary compatibility, we give I2C_SMBUS_I2C_BLOCK_DATA a new numeric value, and define I2C_SMBUS_I2C_BLOCK_BROKEN with the old numeric value. When i2c-dev receives a transaction with the old value, it can convert it to the new format on the fly. Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 09 5月, 2007 1 次提交
-
-
由 Randy Dunlap 提交于
Remove includes of <linux/smp_lock.h> where it is not used/needed. Suggested by Al Viro. Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc, sparc64, and arm (all 59 defconfigs). Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com> Signed-off-by: NAndrew Morton <akpm@linux-foundation.org> Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
-
- 13 2月, 2007 1 次提交
-
-
由 Arjan van de Ven 提交于
Many struct file_operations in the kernel can be "const". Marking them const moves these to the .rodata section, which avoids false sharing with potential dirty data. In addition it'll catch accidental writes at compile time to these shared resources. Signed-off-by: NArjan van de Ven <arjan@linux.intel.com> Signed-off-by: NAndrew Morton <akpm@linux-foundation.org> Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
-
- 11 12月, 2006 4 次提交
-
-
由 Jean Delvare 提交于
Refactor kfree(i2c_dev) into return_i2c_dev(). This saves some code and makes more sense, as the memory is allocated in get_free_i2c_dev(). Signed-off-by: NJean Delvare <khali@linux-fr.org> Cc: Greg Kroah-Hartman <gregkh@suse.de>
-
由 Akinobu Mita 提交于
device_create() returns error code as pointer on failures. This patch checks the return value of device_create() by using IS_ERR(). Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
由 David Brownell 提交于
Remove extraneous whitespace from various i2c headers and core files, like space-before-tab and whitespace at end of line. Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
由 Jean Delvare 提交于
This speeds up the I2C_FUNCS ioctl by 5 to 8% in my tests. Signed-off-by: NJean Delvare <khali@linux-fr.org> Laughed-at-by: NMark M. Hoffman <mhoffman@lightlink.com>
-
- 09 12月, 2006 1 次提交
-
-
由 Josef Sipek 提交于
Signed-off-by: NJosef Sipek <jsipek@fsl.cs.sunysb.edu> Signed-off-by: NAndrew Morton <akpm@osdl.org> Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
-
- 02 12月, 2006 1 次提交
-
-
由 Greg Kroah-Hartman 提交于
As class_device is going away eventually... Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 27 9月, 2006 5 次提交
-
-
由 Jean Delvare 提交于
i2c-dev: attach/detach_adapter cleanups * Only print that an adapter was attached when it succeeds. * i2c_dev == NULL on detach simply means that the attach failed before, this isn't an error per se. Signed-off-by: NJean Delvare <khali@linux-fr.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Jean Delvare 提交于
i2c: __must_check fixes (i2c-dev) Check for error on sysfs file creation. Check for error on device creation. Delete sysfs file on device destruction. I couldn't test this one beyond compilation, as it applies on top of another patch in Greg's tree [1] which breaks all my systems when I apply it (my udev isn't recent enough.) Anyone with bleeding edge udev is welcome to test and report. [1] http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/i2c/i2c-dev-device.patchSigned-off-by: NJean Delvare <khali@linux-fr.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Jean Delvare 提交于
i2c-dev: Drop the client template Drop the i2c-dev client template. This saves about 360 bytes of memory. I got the idea from a similar cleanup Hans-Frieder Vogt made to i2c-nforce2 recently. Signed-off-by: NJean Delvare <khali@linux-fr.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Jean Delvare 提交于
i2c-dev: Use a list for data storage Use a list instead of a static array for storing the i2c-dev data. Given that most systems have less than 10 i2c busses, most of the space was wasted, so this saves around 1 kB of memory (2 kB on 64-bit archs.) The drawback is that lookup was in O(1) and is now in O(N), but given that the values of N are always small, I don't think this is a problem. Signed-off-by: NJean Delvare <khali@linux-fr.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Jean Delvare 提交于
i2c-dev: Cleanups * We no more need to include platform_device.h. * Delete the to_i2c_dev macro, which is no more used (and no more valid either.) * Drop i2c_dev.minor. Now that the minor number always matches the i2c adapter number, this field is redundant with i2c_dev.adap->nr. * Delete i2c_dev_get_by_adapter() which is now redundant with i2c_dev_get_by_minor() for the same reason. * Drop the local variable dev in i2cdev_attach_adapter(), we can easily do without it. Signed-off-by: NJean Delvare <khali@linux-fr.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 23 6月, 2006 1 次提交
-
-
由 David Brownell 提交于
I2C creates some sysfs nodes in the wrong places: not as children of parent controllers, but as their peers (!). This puts them into the right place always, instead of just when the adapter is on the platform bus. Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
- 06 1月, 2006 3 次提交
-
-
由 Laurent Riffard 提交于
Given that implementing i2c_driver.command is optional, there is no point in an empty implementation thereof. Signed-off-by: NLaurent Riffard <laurent.riffard@free.fr> Signed-off-by: NJean Delvare <khali@linux-fr.org> Cc: Michael Geng <linux@MichaelGeng.de> Cc: Petr Vandrovec <vandrove@vc.cvut.cz> Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
-
由 Greg Kroah-Hartman 提交于
i2c-dev doesn't use the reference counting logic of struct class_device so move it to the dynamic method. This makes the code paths simpler and the driver smaller. Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de> Cc: Jean Delvare <khali@linux-fr.org>
-
由 Greg Kroah-Hartman 提交于
Now that i2c_add_driver() doesn't need the module owner to be set by hand, we can delete it from the drivers. This patch catches all of the drivers that I found in the current tree (if a driver sets the .owner by hand, it's not a problem, just not needed.) Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de> Cc: Jean Delvare <khali@linux-fr.org>
-