Skip to content

Commit f25e229

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: "Two bugfixes for the AT24 I2C eeprom driver and some minor corrections for I2C bus drivers" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: piix4: Fix port number check on release i2c: stm32: Fix copyrights i2c-cht-wc: constify platform_device_id eeprom: at24: change nvmem stride to 1 eeprom: at24: fix I2C device selection for runtime PM
2 parents d025fbf + 45fd447 commit f25e229

File tree

6 files changed

+19
-20
lines changed

6 files changed

+19
-20
lines changed

drivers/i2c/busses/i2c-cht-wc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
379379
return 0;
380380
}
381381

382-
static struct platform_device_id cht_wc_i2c_adap_id_table[] = {
382+
static const struct platform_device_id cht_wc_i2c_adap_id_table[] = {
383383
{ .name = "cht_wcove_ext_chgr" },
384384
{},
385385
};

drivers/i2c/busses/i2c-piix4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ static void piix4_adap_remove(struct i2c_adapter *adap)
983983

984984
if (adapdata->smba) {
985985
i2c_del_adapter(adap);
986-
if (adapdata->port == (0 << 1)) {
986+
if (adapdata->port == (0 << piix4_port_shift_sb800)) {
987987
release_region(adapdata->smba, SMBIOSIZE);
988988
if (adapdata->sb800_main)
989989
release_region(SB800_PIIX4_SMB_IDX, 2);

drivers/i2c/busses/i2c-stm32.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* i2c-stm32.h
34
*
45
* Copyright (C) M'boumba Cedric Madianga 2017
6+
* Copyright (C) STMicroelectronics 2017
57
* Author: M'boumba Cedric Madianga <[email protected]>
68
*
7-
* License terms: GNU General Public License (GPL), version 2
89
*/
910

1011
#ifndef _I2C_STM32_H

drivers/i2c/busses/i2c-stm32f4.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Driver for STMicroelectronics STM32 I2C controller
34
*
@@ -6,11 +7,11 @@
67
* http://www.st.com/resource/en/reference_manual/DM00031020.pdf
78
*
89
* Copyright (C) M'boumba Cedric Madianga 2016
10+
* Copyright (C) STMicroelectronics 2017
911
* Author: M'boumba Cedric Madianga <[email protected]>
1012
*
1113
* This driver is based on i2c-st.c
1214
*
13-
* License terms: GNU General Public License (GPL), version 2
1415
*/
1516

1617
#include <linux/clk.h>

drivers/i2c/busses/i2c-stm32f7.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Driver for STMicroelectronics STM32F7 I2C controller
34
*
@@ -7,11 +8,11 @@
78
* http://www.st.com/resource/en/reference_manual/dm00124865.pdf
89
*
910
* Copyright (C) M'boumba Cedric Madianga 2017
11+
* Copyright (C) STMicroelectronics 2017
1012
* Author: M'boumba Cedric Madianga <[email protected]>
1113
*
1214
* This driver is based on i2c-stm32f4.c
1315
*
14-
* License terms: GNU General Public License (GPL), version 2
1516
*/
1617
#include <linux/clk.h>
1718
#include <linux/delay.h>

drivers/misc/eeprom/at24.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf,
562562
static int at24_read(void *priv, unsigned int off, void *val, size_t count)
563563
{
564564
struct at24_data *at24 = priv;
565-
struct i2c_client *client;
565+
struct device *dev = &at24->client[0]->dev;
566566
char *buf = val;
567567
int ret;
568568

@@ -572,11 +572,9 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
572572
if (off + count > at24->chip.byte_len)
573573
return -EINVAL;
574574

575-
client = at24_translate_offset(at24, &off);
576-
577-
ret = pm_runtime_get_sync(&client->dev);
575+
ret = pm_runtime_get_sync(dev);
578576
if (ret < 0) {
579-
pm_runtime_put_noidle(&client->dev);
577+
pm_runtime_put_noidle(dev);
580578
return ret;
581579
}
582580

@@ -592,7 +590,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
592590
status = at24->read_func(at24, buf, off, count);
593591
if (status < 0) {
594592
mutex_unlock(&at24->lock);
595-
pm_runtime_put(&client->dev);
593+
pm_runtime_put(dev);
596594
return status;
597595
}
598596
buf += status;
@@ -602,15 +600,15 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
602600

603601
mutex_unlock(&at24->lock);
604602

605-
pm_runtime_put(&client->dev);
603+
pm_runtime_put(dev);
606604

607605
return 0;
608606
}
609607

610608
static int at24_write(void *priv, unsigned int off, void *val, size_t count)
611609
{
612610
struct at24_data *at24 = priv;
613-
struct i2c_client *client;
611+
struct device *dev = &at24->client[0]->dev;
614612
char *buf = val;
615613
int ret;
616614

@@ -620,11 +618,9 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
620618
if (off + count > at24->chip.byte_len)
621619
return -EINVAL;
622620

623-
client = at24_translate_offset(at24, &off);
624-
625-
ret = pm_runtime_get_sync(&client->dev);
621+
ret = pm_runtime_get_sync(dev);
626622
if (ret < 0) {
627-
pm_runtime_put_noidle(&client->dev);
623+
pm_runtime_put_noidle(dev);
628624
return ret;
629625
}
630626

@@ -640,7 +636,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
640636
status = at24->write_func(at24, buf, off, count);
641637
if (status < 0) {
642638
mutex_unlock(&at24->lock);
643-
pm_runtime_put(&client->dev);
639+
pm_runtime_put(dev);
644640
return status;
645641
}
646642
buf += status;
@@ -650,7 +646,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
650646

651647
mutex_unlock(&at24->lock);
652648

653-
pm_runtime_put(&client->dev);
649+
pm_runtime_put(dev);
654650

655651
return 0;
656652
}
@@ -880,7 +876,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
880876
at24->nvmem_config.reg_read = at24_read;
881877
at24->nvmem_config.reg_write = at24_write;
882878
at24->nvmem_config.priv = at24;
883-
at24->nvmem_config.stride = 4;
879+
at24->nvmem_config.stride = 1;
884880
at24->nvmem_config.word_size = 1;
885881
at24->nvmem_config.size = chip.byte_len;
886882

0 commit comments

Comments
 (0)