diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-16 16:34:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-16 16:34:38 -0500 |
commit | f25e22956058e783cb9bd6d015c2f6b621e831ca (patch) | |
tree | b02875d2a4c8a31c7b2f206108d95cc5791aaf4f | |
parent | d025fbf1a2cd1d60f39579d331a9accf84c5ec5b (diff) | |
parent | 45fd4470ba86e9ca2837b666a52cc65dc69f0fa3 (diff) |
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
-rw-r--r-- | drivers/i2c/busses/i2c-cht-wc.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-piix4.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-stm32.h | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-stm32f4.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-stm32f7.c | 3 | ||||
-rw-r--r-- | drivers/misc/eeprom/at24.c | 26 |
6 files changed, 19 insertions, 20 deletions
diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c index 0d05dadb2dc5..44cffad43701 100644 --- a/drivers/i2c/busses/i2c-cht-wc.c +++ b/drivers/i2c/busses/i2c-cht-wc.c | |||
@@ -379,7 +379,7 @@ static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev) | |||
379 | return 0; | 379 | return 0; |
380 | } | 380 | } |
381 | 381 | ||
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[] = { |
383 | { .name = "cht_wcove_ext_chgr" }, | 383 | { .name = "cht_wcove_ext_chgr" }, |
384 | {}, | 384 | {}, |
385 | }; | 385 | }; |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 174579d32e5f..462948e2c535 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -983,7 +983,7 @@ static void piix4_adap_remove(struct i2c_adapter *adap) | |||
983 | 983 | ||
984 | if (adapdata->smba) { | 984 | if (adapdata->smba) { |
985 | i2c_del_adapter(adap); | 985 | i2c_del_adapter(adap); |
986 | if (adapdata->port == (0 << 1)) { | 986 | if (adapdata->port == (0 << piix4_port_shift_sb800)) { |
987 | release_region(adapdata->smba, SMBIOSIZE); | 987 | release_region(adapdata->smba, SMBIOSIZE); |
988 | if (adapdata->sb800_main) | 988 | if (adapdata->sb800_main) |
989 | release_region(SB800_PIIX4_SMB_IDX, 2); | 989 | release_region(SB800_PIIX4_SMB_IDX, 2); |
diff --git a/drivers/i2c/busses/i2c-stm32.h b/drivers/i2c/busses/i2c-stm32.h index dab51761f8c5..d4f9cef251ac 100644 --- a/drivers/i2c/busses/i2c-stm32.h +++ b/drivers/i2c/busses/i2c-stm32.h | |||
@@ -1,10 +1,11 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * i2c-stm32.h | 3 | * i2c-stm32.h |
3 | * | 4 | * |
4 | * Copyright (C) M'boumba Cedric Madianga 2017 | 5 | * Copyright (C) M'boumba Cedric Madianga 2017 |
6 | * Copyright (C) STMicroelectronics 2017 | ||
5 | * Author: M'boumba Cedric Madianga <cedric.madianga@gmail.com> | 7 | * Author: M'boumba Cedric Madianga <cedric.madianga@gmail.com> |
6 | * | 8 | * |
7 | * License terms: GNU General Public License (GPL), version 2 | ||
8 | */ | 9 | */ |
9 | 10 | ||
10 | #ifndef _I2C_STM32_H | 11 | #ifndef _I2C_STM32_H |
diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c index 4ec108496f15..47c8d00de53f 100644 --- a/drivers/i2c/busses/i2c-stm32f4.c +++ b/drivers/i2c/busses/i2c-stm32f4.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Driver for STMicroelectronics STM32 I2C controller | 3 | * Driver for STMicroelectronics STM32 I2C controller |
3 | * | 4 | * |
@@ -6,11 +7,11 @@ | |||
6 | * http://www.st.com/resource/en/reference_manual/DM00031020.pdf | 7 | * http://www.st.com/resource/en/reference_manual/DM00031020.pdf |
7 | * | 8 | * |
8 | * Copyright (C) M'boumba Cedric Madianga 2016 | 9 | * Copyright (C) M'boumba Cedric Madianga 2016 |
10 | * Copyright (C) STMicroelectronics 2017 | ||
9 | * Author: M'boumba Cedric Madianga <cedric.madianga@gmail.com> | 11 | * Author: M'boumba Cedric Madianga <cedric.madianga@gmail.com> |
10 | * | 12 | * |
11 | * This driver is based on i2c-st.c | 13 | * This driver is based on i2c-st.c |
12 | * | 14 | * |
13 | * License terms: GNU General Public License (GPL), version 2 | ||
14 | */ | 15 | */ |
15 | 16 | ||
16 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index d4a6e9c2e9aa..b445b3bb0bb1 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Driver for STMicroelectronics STM32F7 I2C controller | 3 | * Driver for STMicroelectronics STM32F7 I2C controller |
3 | * | 4 | * |
@@ -7,11 +8,11 @@ | |||
7 | * http://www.st.com/resource/en/reference_manual/dm00124865.pdf | 8 | * http://www.st.com/resource/en/reference_manual/dm00124865.pdf |
8 | * | 9 | * |
9 | * Copyright (C) M'boumba Cedric Madianga 2017 | 10 | * Copyright (C) M'boumba Cedric Madianga 2017 |
11 | * Copyright (C) STMicroelectronics 2017 | ||
10 | * Author: M'boumba Cedric Madianga <cedric.madianga@gmail.com> | 12 | * Author: M'boumba Cedric Madianga <cedric.madianga@gmail.com> |
11 | * | 13 | * |
12 | * This driver is based on i2c-stm32f4.c | 14 | * This driver is based on i2c-stm32f4.c |
13 | * | 15 | * |
14 | * License terms: GNU General Public License (GPL), version 2 | ||
15 | */ | 16 | */ |
16 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 305a7a464d09..4d63ac8a82e0 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c | |||
@@ -562,7 +562,7 @@ static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, | |||
562 | static int at24_read(void *priv, unsigned int off, void *val, size_t count) | 562 | static int at24_read(void *priv, unsigned int off, void *val, size_t count) |
563 | { | 563 | { |
564 | struct at24_data *at24 = priv; | 564 | struct at24_data *at24 = priv; |
565 | struct i2c_client *client; | 565 | struct device *dev = &at24->client[0]->dev; |
566 | char *buf = val; | 566 | char *buf = val; |
567 | int ret; | 567 | int ret; |
568 | 568 | ||
@@ -572,11 +572,9 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count) | |||
572 | if (off + count > at24->chip.byte_len) | 572 | if (off + count > at24->chip.byte_len) |
573 | return -EINVAL; | 573 | return -EINVAL; |
574 | 574 | ||
575 | client = at24_translate_offset(at24, &off); | 575 | ret = pm_runtime_get_sync(dev); |
576 | |||
577 | ret = pm_runtime_get_sync(&client->dev); | ||
578 | if (ret < 0) { | 576 | if (ret < 0) { |
579 | pm_runtime_put_noidle(&client->dev); | 577 | pm_runtime_put_noidle(dev); |
580 | return ret; | 578 | return ret; |
581 | } | 579 | } |
582 | 580 | ||
@@ -592,7 +590,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count) | |||
592 | status = at24->read_func(at24, buf, off, count); | 590 | status = at24->read_func(at24, buf, off, count); |
593 | if (status < 0) { | 591 | if (status < 0) { |
594 | mutex_unlock(&at24->lock); | 592 | mutex_unlock(&at24->lock); |
595 | pm_runtime_put(&client->dev); | 593 | pm_runtime_put(dev); |
596 | return status; | 594 | return status; |
597 | } | 595 | } |
598 | buf += status; | 596 | buf += status; |
@@ -602,7 +600,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count) | |||
602 | 600 | ||
603 | mutex_unlock(&at24->lock); | 601 | mutex_unlock(&at24->lock); |
604 | 602 | ||
605 | pm_runtime_put(&client->dev); | 603 | pm_runtime_put(dev); |
606 | 604 | ||
607 | return 0; | 605 | return 0; |
608 | } | 606 | } |
@@ -610,7 +608,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count) | |||
610 | static int at24_write(void *priv, unsigned int off, void *val, size_t count) | 608 | static int at24_write(void *priv, unsigned int off, void *val, size_t count) |
611 | { | 609 | { |
612 | struct at24_data *at24 = priv; | 610 | struct at24_data *at24 = priv; |
613 | struct i2c_client *client; | 611 | struct device *dev = &at24->client[0]->dev; |
614 | char *buf = val; | 612 | char *buf = val; |
615 | int ret; | 613 | int ret; |
616 | 614 | ||
@@ -620,11 +618,9 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count) | |||
620 | if (off + count > at24->chip.byte_len) | 618 | if (off + count > at24->chip.byte_len) |
621 | return -EINVAL; | 619 | return -EINVAL; |
622 | 620 | ||
623 | client = at24_translate_offset(at24, &off); | 621 | ret = pm_runtime_get_sync(dev); |
624 | |||
625 | ret = pm_runtime_get_sync(&client->dev); | ||
626 | if (ret < 0) { | 622 | if (ret < 0) { |
627 | pm_runtime_put_noidle(&client->dev); | 623 | pm_runtime_put_noidle(dev); |
628 | return ret; | 624 | return ret; |
629 | } | 625 | } |
630 | 626 | ||
@@ -640,7 +636,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count) | |||
640 | status = at24->write_func(at24, buf, off, count); | 636 | status = at24->write_func(at24, buf, off, count); |
641 | if (status < 0) { | 637 | if (status < 0) { |
642 | mutex_unlock(&at24->lock); | 638 | mutex_unlock(&at24->lock); |
643 | pm_runtime_put(&client->dev); | 639 | pm_runtime_put(dev); |
644 | return status; | 640 | return status; |
645 | } | 641 | } |
646 | buf += status; | 642 | buf += status; |
@@ -650,7 +646,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count) | |||
650 | 646 | ||
651 | mutex_unlock(&at24->lock); | 647 | mutex_unlock(&at24->lock); |
652 | 648 | ||
653 | pm_runtime_put(&client->dev); | 649 | pm_runtime_put(dev); |
654 | 650 | ||
655 | return 0; | 651 | return 0; |
656 | } | 652 | } |
@@ -880,7 +876,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
880 | at24->nvmem_config.reg_read = at24_read; | 876 | at24->nvmem_config.reg_read = at24_read; |
881 | at24->nvmem_config.reg_write = at24_write; | 877 | at24->nvmem_config.reg_write = at24_write; |
882 | at24->nvmem_config.priv = at24; | 878 | at24->nvmem_config.priv = at24; |
883 | at24->nvmem_config.stride = 4; | 879 | at24->nvmem_config.stride = 1; |
884 | at24->nvmem_config.word_size = 1; | 880 | at24->nvmem_config.word_size = 1; |
885 | at24->nvmem_config.size = chip.byte_len; | 881 | at24->nvmem_config.size = chip.byte_len; |
886 | 882 | ||