x86/platform/iosf_mbi: fix and clean up
v2 cover x86/platform/iosf_mbi: fix and clean up
There are few patches to clean up an fix iosf_mbi driver along with extension it to cover Intel Tangier SoC.
Changelog v2:
- move iosf_mbi to arch/x86/platfom/intel (patch 1)
- amend commit messages
- rebase on top of tip tree (master)
Andy Shevchenko (5):
x86/platform/iosf_mbi: move to dedicated folder x86/platform/iosf_mbi: check result for all calls of debugfs API x86/platform/iosf_mbi: pci_dev_put() is NULL-proof x86/platform/iosf_mbi: group global variables x86/platform/iosf_mbi: append Intel Tangier ID
arch/x86/include/asm/iosf_mbi.h | 8 +++----
arch/x86/kernel/Makefile | 1 -
arch/x86/platform/Makefile | 1 +
arch/x86/platform/intel/Makefile | 1 +
arch/x86/{kernel => platform/intel}/iosf_mbi.c | 31 +++++++++++++-------------
5 files changed, 21 insertions(+), 21 deletions(-)
create mode 100644 arch/x86/platform/intel/Makefile
rename arch/x86/{kernel => platform/intel}/iosf_mbi.c (93%)Signature · 1 line
2.1.4
PATCH v2 1/5 x86/platform/iosf_mbi: move to dedicated folder
Move the driver to arch/x86/platform/intel since it is not a core kernel code and it is related to many Intel SoCs from different groups: Atom, MID, etc.
There is no functional change.
---
arch/x86/kernel/Makefile | 1 -
arch/x86/platform/Makefile | 1 +
arch/x86/platform/intel/Makefile | 1 +
arch/x86/{kernel => platform/intel}/iosf_mbi.c | 0
4 files changed, 2 insertions(+), 1 deletion(-)
create mode 100644 arch/x86/platform/intel/Makefile
rename arch/x86/{kernel => platform/intel}/iosf_mbi.c (100%)arch/x86/kernel/Makefile +0 -1
@@ -108,7 +108,6 @@ obj-$(CONFIG_EFI) += sysfb_efi.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_TRACING) += tracepoint.o -obj-$(CONFIG_IOSF_MBI) += iosf_mbi.o ### # 64 bit specific files
arch/x86/platform/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-y += efi/ obj-y += geode/ obj-y += goldfish/ obj-y += iris/ +obj-y += intel/ obj-y += intel-mid/ obj-y += intel-quark/ obj-y += olpc/
arch/x86/platform/intel/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_IOSF_MBI) += iosf_mbi.o
arch/x86/platform/intel/iosf_mbi.c renamed from arch/x86/kernel/iosf_mbi.c +0 -0
Signature · 1 line
2.1.4
tip-bot for Andy Shevchenko
merge bot[tip:x86/platform] x86/platform/iosf_mbi: Move to dedicated folder
x86/platform/iosf_mbi: Move to dedicated folder
Commit-ID: 23ae2a16bb39d999892a86a65933fe3e9b6b525f Gitweb: http://git.kernel.org/tip/23ae2a16bb39d999892a86a65933fe3e9b6b525f Author: Andy Shevchenko <[email protected]> AuthorDate: Wed, 8 Jul 2015 17:45:05 +0300 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 16 Jul 2015 17:48:47 +0200
x86/platform/iosf_mbi: Move to dedicated folder
Move the driver to arch/x86/platform/intel since it is not a core kernel code and it is related to many Intel SoCs from different
groups: Atom, MID, etc.
There is no functional change.
---
arch/x86/kernel/Makefile | 1 -
arch/x86/platform/Makefile | 1 +
arch/x86/platform/intel/Makefile | 1 +
arch/x86/{kernel => platform/intel}/iosf_mbi.c | 0
4 files changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/Makefile +0 -1
@@ -107,7 +107,6 @@ obj-$(CONFIG_EFI) += sysfb_efi.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_TRACING) += tracepoint.o -obj-$(CONFIG_IOSF_MBI) += iosf_mbi.o ### # 64 bit specific files
arch/x86/platform/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-y += efi/ obj-y += geode/ obj-y += goldfish/ obj-y += iris/ +obj-y += intel/ obj-y += intel-mid/ obj-y += intel-quark/ obj-y += olpc/
arch/x86/platform/intel/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_IOSF_MBI) += iosf_mbi.o
arch/x86/platform/intel/iosf_mbi.c renamed from arch/x86/kernel/iosf_mbi.c +0 -0
PATCH v2 2/5 x86/platform/iosf_mbi: check result for all calls of debugfs API
In reply to Andy ShevchenkoThe patch fixes a debugfs interface by checking the result code for each node.
While here, replace IS_ERR_OR_NULL(x) by just !x since first one does the job for us when we create a folder.
--- arch/x86/platform/intel/iosf_mbi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/platform/intel/iosf_mbi.c +5 -5
@@ -240,17 +240,17 @@ static void iosf_sideband_debug_init(void)/* mdr */ d =debugfs_create_x32 ("mdr" ,0660 , iosf_dbg, &dbg_mdr); -if (IS_ERR_OR_NULL (d)) +if (!d) goto cleanup;/* mcrx */ -debugfs_create_x32 ("mcrx" ,0660 , iosf_dbg, &dbg_mcrx); -if (IS_ERR_OR_NULL (d)) + d =debugfs_create_x32 ("mcrx" ,0660 , iosf_dbg, &dbg_mcrx); +if (!d) goto cleanup;/* mcr - initiates mailbox tranaction */ -debugfs_create_file ("mcr" ,0660 , iosf_dbg, &dbg_mcr, &iosf_mcr_fops); -if (IS_ERR_OR_NULL (d)) + d =debugfs_create_file ("mcr" ,0660 , iosf_dbg, &dbg_mcr, &iosf_mcr_fops); +if (!d) goto cleanup;return ;
Signature · 1 line
2.1.4
tip-bot for Andy Shevchenko
merge bot[tip:x86/platform] x86/platform/iosf_mbi: Check return value of debugfs_create properly
x86/platform/iosf_mbi: Check return value of debugfs_create properly
Commit-ID: 64279c7e05264f9774c6c9ee65a5b9ed186e442b Gitweb: http://git.kernel.org/tip/64279c7e05264f9774c6c9ee65a5b9ed186e442b Author: Andy Shevchenko <[email protected]> AuthorDate: Wed, 8 Jul 2015 17:45:06 +0300 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 16 Jul 2015 17:48:48 +0200
x86/platform/iosf_mbi: Check return value of debugfs_create properly
The code checks the result of the first debugfs_create call several times and fails to check the result of the subsequent calls due to missing assigments.
Add the missing assignments and check only for !res because debugfs_create() returns only NULL on error and not an encoded error code.
[ tglx: Massaged changelog ]
--- arch/x86/platform/intel/iosf_mbi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/platform/intel/iosf_mbi.c +5 -5
@@ -240,17 +240,17 @@ static void iosf_sideband_debug_init(void)/* mdr */ d =debugfs_create_x32 ("mdr" ,0660 , iosf_dbg, &dbg_mdr); -if (IS_ERR_OR_NULL (d)) +if (!d) goto cleanup;/* mcrx */ -debugfs_create_x32 ("mcrx" ,0660 , iosf_dbg, &dbg_mcrx); -if (IS_ERR_OR_NULL (d)) + d =debugfs_create_x32 ("mcrx" ,0660 , iosf_dbg, &dbg_mcrx); +if (!d) goto cleanup;/* mcr - initiates mailbox tranaction */ -debugfs_create_file ("mcr" ,0660 , iosf_dbg, &dbg_mcr, &iosf_mcr_fops); -if (IS_ERR_OR_NULL (d)) + d =debugfs_create_file ("mcr" ,0660 , iosf_dbg, &dbg_mcr, &iosf_mcr_fops); +if (!d) goto cleanup;return ;
PATCH v2 3/5 x86/platform/iosf_mbi: pci_dev_put() is NULL-proof
In reply to Andy ShevchenkoThere is no need to check for NULL when call pci_dev_put().
--- arch/x86/platform/intel/iosf_mbi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/platform/intel/iosf_mbi.c +2 -4
@@ -314,10 +314,8 @@ static void __exit iosf_mbi_exit(void)iosf_debugfs_remove ();pci_unregister_driver (&iosf_mbi_pci_driver); -if (mbi_pdev) { -pci_dev_put (mbi_pdev); - mbi_pdev =NULL ; - } +pci_dev_put (mbi_pdev); + mbi_pdev =NULL ; }module_init (iosf_mbi_init);
Signature · 1 line
2.1.4
tip-bot for Andy Shevchenko
merge bot[tip:x86/platform] x86/platform/iosf_mbi: Remove NULL pointer checks for pci_dev_put()
x86/platform/iosf_mbi: Remove NULL pointer checks for pci_dev_put()
Commit-ID: b93fb9f6aee0ea6fe60ed20278b9c7fea70a58ff Gitweb: http://git.kernel.org/tip/b93fb9f6aee0ea6fe60ed20278b9c7fea70a58ff Author: Andy Shevchenko <[email protected]> AuthorDate: Wed, 8 Jul 2015 17:45:07 +0300 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 16 Jul 2015 17:48:48 +0200
x86/platform/iosf_mbi: Remove NULL pointer checks for pci_dev_put()
pci_dev_put() has already a check for NULL pointer.
[ tglx: Massaged changelog ]
--- arch/x86/platform/intel/iosf_mbi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/platform/intel/iosf_mbi.c +2 -4
@@ -314,10 +314,8 @@ static void __exit iosf_mbi_exit(void)iosf_debugfs_remove ();pci_unregister_driver (&iosf_mbi_pci_driver); -if (mbi_pdev) { -pci_dev_put (mbi_pdev); - mbi_pdev =NULL ; - } +pci_dev_put (mbi_pdev); + mbi_pdev =NULL ; }module_init (iosf_mbi_init);
PATCH v2 4/5 x86/platform/iosf_mbi: group global variables
In reply to Andy ShevchenkoThe patch moves the global variables to one place in the source file.
While here, fix indentation in the header and comments.
There is no functional change.
--- arch/x86/include/asm/iosf_mbi.h | 8 ++++---- arch/x86/platform/intel/iosf_mbi.c | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-)
arch/x86/include/asm/iosf_mbi.h +4 -4
@@ -52,20 +52,20 @@/* Quark available units */ #define QRK_MBI_UNIT_HBA 0x00 -#define QRK_MBI_UNIT_HB 0x03 +#define QRK_MBI_UNIT_HB 0x03#define QRK_MBI_UNIT_RMU 0x04 -#define QRK_MBI_UNIT_MM 0x05 +#define QRK_MBI_UNIT_MM 0x05#define QRK_MBI_UNIT_MMESRAM 0x05#define QRK_MBI_UNIT_SOC 0x31/* Quark read/write opcodes */ #define QRK_MBI_HBA_READ 0x10#define QRK_MBI_HBA_WRITE 0x11 -#define QRK_MBI_HB_READ 0x10 +#define QRK_MBI_HB_READ 0x10#define QRK_MBI_HB_WRITE 0x11#define QRK_MBI_RMU_READ 0x10#define QRK_MBI_RMU_WRITE 0x11 -#define QRK_MBI_MM_READ 0x10 +#define QRK_MBI_MM_READ 0x10#define QRK_MBI_MM_WRITE 0x11#define QRK_MBI_MMESRAM_READ 0x12#define QRK_MBI_MMESRAM_WRITE 0x13
arch/x86/platform/intel/iosf_mbi.c +4 -5
@@ -31,6 +31,7 @@#define PCI_DEVICE_ID_BRASWELL 0x2280#define PCI_DEVICE_ID_QUARK_X1000 0x0958 +static struct pci_dev *mbi_pdev;/* one mbi device */ static DEFINE_SPINLOCK (iosf_mbi_lock);static inline u32 iosf_mbi_form_mcr (u8 op,u8 port,u8 offset)
@@ -38,8 +39,6 @@ static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)return (op <<24 ) | (port <<16 ) | (offset <<8 ) |MBI_ENABLE ; } -static struct pci_dev *mbi_pdev;/* one mbi device */ -static int iosf_mbi_pci_read_mdr (u32 mcrx,u32 mcr,u32 *mdr) {int result;
@@ -104,7 +103,7 @@ int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr)unsigned long flags;int ret; -/*Access to the GFX unit is handled by GPU code */ +/* Access to the GFX unit is handled by GPU code */ if (port ==BT_MBI_UNIT_GFX ) {WARN_ON (1 );return -EPERM ;
@@ -127,7 +126,7 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)unsigned long flags;int ret; -/*Access to the GFX unit is handled by GPU code */ +/* Access to the GFX unit is handled by GPU code */ if (port ==BT_MBI_UNIT_GFX ) {WARN_ON (1 );return -EPERM ;
@@ -151,7 +150,7 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)unsigned long flags;int ret; -/*Access to the GFX unit is handled by GPU code */ +/* Access to the GFX unit is handled by GPU code */ if (port ==BT_MBI_UNIT_GFX ) {WARN_ON (1 );return -EPERM ;
Signature · 1 line
2.1.4
tip-bot for Andy Shevchenko
merge bot[tip:x86/platform] x86/platform/iosf_mbi: Source cleanup
x86/platform/iosf_mbi: Source cleanup
Commit-ID: 7e1ff15b699bcb2bce1e8086323d227788960044 Gitweb: http://git.kernel.org/tip/7e1ff15b699bcb2bce1e8086323d227788960044 Author: Andy Shevchenko <[email protected]> AuthorDate: Wed, 8 Jul 2015 17:45:08 +0300 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 16 Jul 2015 17:48:48 +0200
x86/platform/iosf_mbi: Source cleanup
- Move the static variables to one place
- Fix indentations in the header
- Correct comments
No functional change.
[ tglx: Massaged changelog ]
--- arch/x86/include/asm/iosf_mbi.h | 8 ++++---- arch/x86/platform/intel/iosf_mbi.c | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-)
arch/x86/include/asm/iosf_mbi.h +4 -4
@@ -52,20 +52,20 @@/* Quark available units */ #define QRK_MBI_UNIT_HBA 0x00 -#define QRK_MBI_UNIT_HB 0x03 +#define QRK_MBI_UNIT_HB 0x03#define QRK_MBI_UNIT_RMU 0x04 -#define QRK_MBI_UNIT_MM 0x05 +#define QRK_MBI_UNIT_MM 0x05#define QRK_MBI_UNIT_MMESRAM 0x05#define QRK_MBI_UNIT_SOC 0x31/* Quark read/write opcodes */ #define QRK_MBI_HBA_READ 0x10#define QRK_MBI_HBA_WRITE 0x11 -#define QRK_MBI_HB_READ 0x10 +#define QRK_MBI_HB_READ 0x10#define QRK_MBI_HB_WRITE 0x11#define QRK_MBI_RMU_READ 0x10#define QRK_MBI_RMU_WRITE 0x11 -#define QRK_MBI_MM_READ 0x10 +#define QRK_MBI_MM_READ 0x10#define QRK_MBI_MM_WRITE 0x11#define QRK_MBI_MMESRAM_READ 0x12#define QRK_MBI_MMESRAM_WRITE 0x13
arch/x86/platform/intel/iosf_mbi.c +4 -5
@@ -31,6 +31,7 @@#define PCI_DEVICE_ID_BRASWELL 0x2280#define PCI_DEVICE_ID_QUARK_X1000 0x0958 +static struct pci_dev *mbi_pdev;static DEFINE_SPINLOCK (iosf_mbi_lock);static inline u32 iosf_mbi_form_mcr (u8 op,u8 port,u8 offset)
@@ -38,8 +39,6 @@ static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)return (op <<24 ) | (port <<16 ) | (offset <<8 ) |MBI_ENABLE ; } -static struct pci_dev *mbi_pdev;/* one mbi device */ -static int iosf_mbi_pci_read_mdr (u32 mcrx,u32 mcr,u32 *mdr) {int result;
@@ -104,7 +103,7 @@ int iosf_mbi_read(u8 port, u8 opcode, u32 offset, u32 *mdr)unsigned long flags;int ret; -/*Access to the GFX unit is handled by GPU code */ +/* Access to the GFX unit is handled by GPU code */ if (port ==BT_MBI_UNIT_GFX ) {WARN_ON (1 );return -EPERM ;
@@ -127,7 +126,7 @@ int iosf_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)unsigned long flags;int ret; -/*Access to the GFX unit is handled by GPU code */ +/* Access to the GFX unit is handled by GPU code */ if (port ==BT_MBI_UNIT_GFX ) {WARN_ON (1 );return -EPERM ;
@@ -151,7 +150,7 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)unsigned long flags;int ret; -/*Access to the GFX unit is handled by GPU code */ +/* Access to the GFX unit is handled by GPU code */ if (port ==BT_MBI_UNIT_GFX ) {WARN_ON (1 );return -EPERM ;
PATCH v2 5/5 x86/platform/iosf_mbi: append Intel Tangier ID
In reply to Andy ShevchenkoIntel Tangier has an IOSF Mailbox with PCI ID 8086:1170.
While here, keep list ordered by ID.
--- arch/x86/platform/intel/iosf_mbi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/platform/intel/iosf_mbi.c +4 -2
@@ -27,9 +27,10 @@#include <asm/iosf_mbi.h> +#define PCI_DEVICE_ID_QUARK_X1000 0x0958#define PCI_DEVICE_ID_BAYTRAIL 0x0F00 +#define PCI_DEVICE_ID_TANGIER 0x1170#define PCI_DEVICE_ID_BRASWELL 0x2280 -#define PCI_DEVICE_ID_QUARK_X1000 0x0958static struct pci_dev *mbi_pdev;/* one mbi device */ static DEFINE_SPINLOCK (iosf_mbi_lock);
@@ -288,9 +289,10 @@ static int iosf_mbi_probe(struct pci_dev *pdev, }static const struct pci_device_id iosf_mbi_pci_ids[] = { + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_QUARK_X1000 ) }, {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_BAYTRAIL ) }, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_TANGIER ) }, {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_BRASWELL ) }, - {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_QUARK_X1000 ) }, {0 , }, };MODULE_DEVICE_TABLE (pci, iosf_mbi_pci_ids);
Signature · 1 line
2.1.4
Re: [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID
Quoted 3 lines · Andy Shevchenko
Intel Tangier has an IOSF Mailbox with PCI ID 8086:1170.
While here, keep list ordered by ID.
I skipped that ordering part, because the result is horrible to read. Alphabetic ordering in both places is the right thing.
Thanks,
tglx
tip-bot for Andy Shevchenko
merge bot[tip:x86/platform] x86/platform/iosf_mbi: Add Intel Tangier PCI id
In reply to Andy Shevchenkox86/platform/iosf_mbi: Add Intel Tangier PCI id
Commit-ID: f33d159ea701cbaba90f20876aeba11d27b698c2 Gitweb: http://git.kernel.org/tip/f33d159ea701cbaba90f20876aeba11d27b698c2 Author: Andy Shevchenko <[email protected]> AuthorDate: Wed, 8 Jul 2015 17:45:09 +0300 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 16 Jul 2015 17:48:48 +0200
x86/platform/iosf_mbi: Add Intel Tangier PCI id
Intel Tangier has an IOSF Mailbox with PCI ID 8086:1170.
--- arch/x86/platform/intel/iosf_mbi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/platform/intel/iosf_mbi.c +2 -0
@@ -30,6 +30,7 @@#define PCI_DEVICE_ID_BAYTRAIL 0x0F00#define PCI_DEVICE_ID_BRASWELL 0x2280#define PCI_DEVICE_ID_QUARK_X1000 0x0958 +#define PCI_DEVICE_ID_TANGIER 0x1170static struct pci_dev *mbi_pdev;static DEFINE_SPINLOCK (iosf_mbi_lock);
@@ -291,6 +292,7 @@ static const struct pci_device_id iosf_mbi_pci_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BRASWELL) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_TANGIER) }, { 0, }, };MODULE_DEVICE_TABLE (pci, iosf_mbi_pci_ids);