linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] x86/platform/iosf_mbi: fix and clean up
@ 2015-07-08 14:45 Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 1/5] x86/platform/iosf_mbi: move to dedicated folder Andy Shevchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Andy Shevchenko @ 2015-07-08 14:45 UTC (permalink / raw)
  To: David E . Box, x86, linux-kernel, Ingo Molnar, Thomas Gleixner
  Cc: Andy Shevchenko

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%)

-- 
2.1.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/5] x86/platform/iosf_mbi: move to dedicated folder
  2015-07-08 14:45 [PATCH v2 0/5] x86/platform/iosf_mbi: fix and clean up Andy Shevchenko
@ 2015-07-08 14:45 ` Andy Shevchenko
  2015-07-16 15:52   ` [tip:x86/platform] x86/platform/iosf_mbi: Move " tip-bot for Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 2/5] x86/platform/iosf_mbi: check result for all calls of debugfs API Andy Shevchenko
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2015-07-08 14:45 UTC (permalink / raw)
  To: David E . Box, x86, linux-kernel, Ingo Molnar, Thomas Gleixner
  Cc: Andy Shevchenko

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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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%)

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 917d646..523101c 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile
index f1a6c8e..184842e 100644
--- a/arch/x86/platform/Makefile
+++ b/arch/x86/platform/Makefile
@@ -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/
diff --git a/arch/x86/platform/intel/Makefile b/arch/x86/platform/intel/Makefile
new file mode 100644
index 0000000..b878032
--- /dev/null
+++ b/arch/x86/platform/intel/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_IOSF_MBI)			+= iosf_mbi.o
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
similarity index 100%
rename from arch/x86/kernel/iosf_mbi.c
rename to arch/x86/platform/intel/iosf_mbi.c
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/5] x86/platform/iosf_mbi: check result for all calls of debugfs API
  2015-07-08 14:45 [PATCH v2 0/5] x86/platform/iosf_mbi: fix and clean up Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 1/5] x86/platform/iosf_mbi: move to dedicated folder Andy Shevchenko
@ 2015-07-08 14:45 ` Andy Shevchenko
  2015-07-16 15:52   ` [tip:x86/platform] x86/platform/iosf_mbi: Check return value of debugfs_create properly tip-bot for Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 3/5] x86/platform/iosf_mbi: pci_dev_put() is NULL-proof Andy Shevchenko
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2015-07-08 14:45 UTC (permalink / raw)
  To: David E . Box, x86, linux-kernel, Ingo Molnar, Thomas Gleixner
  Cc: Andy Shevchenko

The 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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/platform/intel/iosf_mbi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 82f8d02..2362da9 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/5] x86/platform/iosf_mbi: pci_dev_put() is NULL-proof
  2015-07-08 14:45 [PATCH v2 0/5] x86/platform/iosf_mbi: fix and clean up Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 1/5] x86/platform/iosf_mbi: move to dedicated folder Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 2/5] x86/platform/iosf_mbi: check result for all calls of debugfs API Andy Shevchenko
@ 2015-07-08 14:45 ` Andy Shevchenko
  2015-07-16 15:53   ` [tip:x86/platform] x86/platform/iosf_mbi: Remove NULL pointer checks for pci_dev_put() tip-bot for Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 4/5] x86/platform/iosf_mbi: group global variables Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID Andy Shevchenko
  4 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2015-07-08 14:45 UTC (permalink / raw)
  To: David E . Box, x86, linux-kernel, Ingo Molnar, Thomas Gleixner
  Cc: Andy Shevchenko

There is no need to check for NULL when call pci_dev_put().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/platform/intel/iosf_mbi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 2362da9..0b33105 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/5] x86/platform/iosf_mbi: group global variables
  2015-07-08 14:45 [PATCH v2 0/5] x86/platform/iosf_mbi: fix and clean up Andy Shevchenko
                   ` (2 preceding siblings ...)
  2015-07-08 14:45 ` [PATCH v2 3/5] x86/platform/iosf_mbi: pci_dev_put() is NULL-proof Andy Shevchenko
@ 2015-07-08 14:45 ` Andy Shevchenko
  2015-07-16 15:53   ` [tip:x86/platform] x86/platform/iosf_mbi: Source cleanup tip-bot for Andy Shevchenko
  2015-07-08 14:45 ` [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID Andy Shevchenko
  4 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2015-07-08 14:45 UTC (permalink / raw)
  To: David E . Box, x86, linux-kernel, Ingo Molnar, Thomas Gleixner
  Cc: Andy Shevchenko

The 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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/include/asm/iosf_mbi.h    | 8 ++++----
 arch/x86/platform/intel/iosf_mbi.c | 9 ++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h
index 57995f0..b72ad0f 100644
--- a/arch/x86/include/asm/iosf_mbi.h
+++ b/arch/x86/include/asm/iosf_mbi.h
@@ -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
diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 0b33105..79bd5fc 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID
  2015-07-08 14:45 [PATCH v2 0/5] x86/platform/iosf_mbi: fix and clean up Andy Shevchenko
                   ` (3 preceding siblings ...)
  2015-07-08 14:45 ` [PATCH v2 4/5] x86/platform/iosf_mbi: group global variables Andy Shevchenko
@ 2015-07-08 14:45 ` Andy Shevchenko
  2015-07-16 15:42   ` Thomas Gleixner
  2015-07-16 15:53   ` [tip:x86/platform] x86/platform/iosf_mbi: Add Intel Tangier PCI id tip-bot for Andy Shevchenko
  4 siblings, 2 replies; 12+ messages in thread
From: Andy Shevchenko @ 2015-07-08 14:45 UTC (permalink / raw)
  To: David E . Box, x86, linux-kernel, Ingo Molnar, Thomas Gleixner
  Cc: Andy Shevchenko

Intel Tangier has an IOSF Mailbox with PCI ID 8086:1170.

While here, keep list ordered by ID.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/platform/intel/iosf_mbi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 79bd5fc..b086501 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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	0x0958
 
 static 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);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID
  2015-07-08 14:45 ` [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID Andy Shevchenko
@ 2015-07-16 15:42   ` Thomas Gleixner
  2015-07-16 15:53   ` [tip:x86/platform] x86/platform/iosf_mbi: Add Intel Tangier PCI id tip-bot for Andy Shevchenko
  1 sibling, 0 replies; 12+ messages in thread
From: Thomas Gleixner @ 2015-07-16 15:42 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: David E . Box, x86, linux-kernel, Ingo Molnar

On Wed, 8 Jul 2015, Andy Shevchenko wrote:

> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tip:x86/platform] x86/platform/iosf_mbi: Move to dedicated folder
  2015-07-08 14:45 ` [PATCH v2 1/5] x86/platform/iosf_mbi: move to dedicated folder Andy Shevchenko
@ 2015-07-16 15:52   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Andy Shevchenko @ 2015-07-16 15:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, tglx, david.e.box, linux-kernel, andriy.shevchenko, hpa

Commit-ID:  23ae2a16bb39d999892a86a65933fe3e9b6b525f
Gitweb:     http://git.kernel.org/tip/23ae2a16bb39d999892a86a65933fe3e9b6b525f
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Wed, 8 Jul 2015 17:45:05 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David E . Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1436366709-17683-2-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 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(-)

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 81db53b..7041f8b 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile
index f1a6c8e..184842e 100644
--- a/arch/x86/platform/Makefile
+++ b/arch/x86/platform/Makefile
@@ -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/
diff --git a/arch/x86/platform/intel/Makefile b/arch/x86/platform/intel/Makefile
new file mode 100644
index 0000000..b878032
--- /dev/null
+++ b/arch/x86/platform/intel/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_IOSF_MBI)			+= iosf_mbi.o
diff --git a/arch/x86/kernel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
similarity index 100%
rename from arch/x86/kernel/iosf_mbi.c
rename to arch/x86/platform/intel/iosf_mbi.c

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [tip:x86/platform] x86/platform/iosf_mbi: Check return value of debugfs_create properly
  2015-07-08 14:45 ` [PATCH v2 2/5] x86/platform/iosf_mbi: check result for all calls of debugfs API Andy Shevchenko
@ 2015-07-16 15:52   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Andy Shevchenko @ 2015-07-16 15:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, david.e.box, andriy.shevchenko, hpa, linux-kernel, mingo

Commit-ID:  64279c7e05264f9774c6c9ee65a5b9ed186e442b
Gitweb:     http://git.kernel.org/tip/64279c7e05264f9774c6c9ee65a5b9ed186e442b
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Wed, 8 Jul 2015 17:45:06 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
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 ]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David E . Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1436366709-17683-3-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/platform/intel/iosf_mbi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 82f8d02..2362da9 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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;

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [tip:x86/platform] x86/platform/iosf_mbi: Remove NULL pointer checks for pci_dev_put()
  2015-07-08 14:45 ` [PATCH v2 3/5] x86/platform/iosf_mbi: pci_dev_put() is NULL-proof Andy Shevchenko
@ 2015-07-16 15:53   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Andy Shevchenko @ 2015-07-16 15:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, andriy.shevchenko, david.e.box, mingo, tglx, linux-kernel

Commit-ID:  b93fb9f6aee0ea6fe60ed20278b9c7fea70a58ff
Gitweb:     http://git.kernel.org/tip/b93fb9f6aee0ea6fe60ed20278b9c7fea70a58ff
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Wed, 8 Jul 2015 17:45:07 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
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 ]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David E . Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1436366709-17683-4-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/platform/intel/iosf_mbi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 2362da9..0b33105 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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);

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [tip:x86/platform] x86/platform/iosf_mbi: Source cleanup
  2015-07-08 14:45 ` [PATCH v2 4/5] x86/platform/iosf_mbi: group global variables Andy Shevchenko
@ 2015-07-16 15:53   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Andy Shevchenko @ 2015-07-16 15:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, andriy.shevchenko, tglx, david.e.box, mingo, hpa

Commit-ID:  7e1ff15b699bcb2bce1e8086323d227788960044
Gitweb:     http://git.kernel.org/tip/7e1ff15b699bcb2bce1e8086323d227788960044
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Wed, 8 Jul 2015 17:45:08 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
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 ]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David E . Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1436366709-17683-5-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/iosf_mbi.h    | 8 ++++----
 arch/x86/platform/intel/iosf_mbi.c | 9 ++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h
index 57995f0..b72ad0f 100644
--- a/arch/x86/include/asm/iosf_mbi.h
+++ b/arch/x86/include/asm/iosf_mbi.h
@@ -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
diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 0b33105..28fb290 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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;

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [tip:x86/platform] x86/platform/iosf_mbi: Add Intel Tangier PCI id
  2015-07-08 14:45 ` [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID Andy Shevchenko
  2015-07-16 15:42   ` Thomas Gleixner
@ 2015-07-16 15:53   ` tip-bot for Andy Shevchenko
  1 sibling, 0 replies; 12+ messages in thread
From: tip-bot for Andy Shevchenko @ 2015-07-16 15:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, david.e.box, hpa, linux-kernel, tglx, andriy.shevchenko

Commit-ID:  f33d159ea701cbaba90f20876aeba11d27b698c2
Gitweb:     http://git.kernel.org/tip/f33d159ea701cbaba90f20876aeba11d27b698c2
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Wed, 8 Jul 2015 17:45:09 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David E . Box <david.e.box@linux.intel.com>
Link: http://lkml.kernel.org/r/1436366709-17683-6-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/platform/intel/iosf_mbi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c
index 28fb290..edf2c54 100644
--- a/arch/x86/platform/intel/iosf_mbi.c
+++ b/arch/x86/platform/intel/iosf_mbi.c
@@ -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		0x1170
 
 static 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);

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-16 15:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 14:45 [PATCH v2 0/5] x86/platform/iosf_mbi: fix and clean up Andy Shevchenko
2015-07-08 14:45 ` [PATCH v2 1/5] x86/platform/iosf_mbi: move to dedicated folder Andy Shevchenko
2015-07-16 15:52   ` [tip:x86/platform] x86/platform/iosf_mbi: Move " tip-bot for Andy Shevchenko
2015-07-08 14:45 ` [PATCH v2 2/5] x86/platform/iosf_mbi: check result for all calls of debugfs API Andy Shevchenko
2015-07-16 15:52   ` [tip:x86/platform] x86/platform/iosf_mbi: Check return value of debugfs_create properly tip-bot for Andy Shevchenko
2015-07-08 14:45 ` [PATCH v2 3/5] x86/platform/iosf_mbi: pci_dev_put() is NULL-proof Andy Shevchenko
2015-07-16 15:53   ` [tip:x86/platform] x86/platform/iosf_mbi: Remove NULL pointer checks for pci_dev_put() tip-bot for Andy Shevchenko
2015-07-08 14:45 ` [PATCH v2 4/5] x86/platform/iosf_mbi: group global variables Andy Shevchenko
2015-07-16 15:53   ` [tip:x86/platform] x86/platform/iosf_mbi: Source cleanup tip-bot for Andy Shevchenko
2015-07-08 14:45 ` [PATCH v2 5/5] x86/platform/iosf_mbi: append Intel Tangier ID Andy Shevchenko
2015-07-16 15:42   ` Thomas Gleixner
2015-07-16 15:53   ` [tip:x86/platform] x86/platform/iosf_mbi: Add Intel Tangier PCI id tip-bot for Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).