Skip to content

Commit 906c404

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Three more driver bugfixes, and two doc improvements fixing build warnings while we are here" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: pca-platform: Use platform_irq_get_optional i2c: st: fix missing struct parameter description i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status() i2c: fix a doc warning i2c: hix5hd2: add missed clk_disable_unprepare in remove
2 parents 83fd69c + 14c1fe6 commit 906c404

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

drivers/i2c/busses/i2c-hix5hd2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ static int hix5hd2_i2c_remove(struct platform_device *pdev)
477477
i2c_del_adapter(&priv->adap);
478478
pm_runtime_disable(priv->dev);
479479
pm_runtime_set_suspended(priv->dev);
480+
clk_disable_unprepare(priv->clk);
480481

481482
return 0;
482483
}

drivers/i2c/busses/i2c-nvidia-gpu.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/delay.h>
99
#include <linux/i2c.h>
1010
#include <linux/interrupt.h>
11+
#include <linux/iopoll.h>
1112
#include <linux/module.h>
1213
#include <linux/pci.h>
1314
#include <linux/platform_device.h>
@@ -75,20 +76,15 @@ static void gpu_enable_i2c_bus(struct gpu_i2c_dev *i2cd)
7576

7677
static int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd)
7778
{
78-
unsigned long target = jiffies + msecs_to_jiffies(1000);
7979
u32 val;
80+
int ret;
8081

81-
do {
82-
val = readl(i2cd->regs + I2C_MST_CNTL);
83-
if (!(val & I2C_MST_CNTL_CYCLE_TRIGGER))
84-
break;
85-
if ((val & I2C_MST_CNTL_STATUS) !=
86-
I2C_MST_CNTL_STATUS_BUS_BUSY)
87-
break;
88-
usleep_range(500, 600);
89-
} while (time_is_after_jiffies(target));
90-
91-
if (time_is_before_jiffies(target)) {
82+
ret = readl_poll_timeout(i2cd->regs + I2C_MST_CNTL, val,
83+
!(val & I2C_MST_CNTL_CYCLE_TRIGGER) ||
84+
(val & I2C_MST_CNTL_STATUS) != I2C_MST_CNTL_STATUS_BUS_BUSY,
85+
500, 1000 * USEC_PER_MSEC);
86+
87+
if (ret) {
9288
dev_err(i2cd->dev, "i2c timeout error %x\n", val);
9389
return -ETIMEDOUT;
9490
}

drivers/i2c/busses/i2c-pca-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
140140
int ret = 0;
141141
int irq;
142142

143-
irq = platform_get_irq(pdev, 0);
143+
irq = platform_get_irq_optional(pdev, 0);
144144
/* If irq is 0, we do polling. */
145145
if (irq < 0)
146146
irq = 0;

drivers/i2c/busses/i2c-st.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ static void st_i2c_wr_fill_tx_fifo(struct st_i2c_dev *i2c_dev)
434434
/**
435435
* st_i2c_rd_fill_tx_fifo() - Fill the Tx FIFO in read mode
436436
* @i2c_dev: Controller's private data
437+
* @max: Maximum amount of data to fill into the Tx FIFO
437438
*
438439
* This functions fills the Tx FIFO with fixed pattern when
439440
* in read mode to trigger clock.

include/linux/i2c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
506506
* @smbus_xfer_atomic: same as @smbus_xfer. Yet, only using atomic context
507507
* so e.g. PMICs can be accessed very late before shutdown. Optional.
508508
* @functionality: Return the flags that this algorithm/adapter pair supports
509-
* from the I2C_FUNC_* flags.
509+
* from the ``I2C_FUNC_*`` flags.
510510
* @reg_slave: Register given client to I2C slave mode of this adapter
511511
* @unreg_slave: Unregister given client from I2C slave mode of this adapter
512512
*
@@ -515,7 +515,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
515515
* be addressed using the same bus algorithms - i.e. bit-banging or the PCF8584
516516
* to name two of the most common.
517517
*
518-
* The return codes from the @master_xfer{_atomic} fields should indicate the
518+
* The return codes from the ``master_xfer{_atomic}`` fields should indicate the
519519
* type of error code that occurred during the transfer, as documented in the
520520
* Kernel Documentation file Documentation/i2c/fault-codes.rst.
521521
*/

0 commit comments

Comments
 (0)