[PATCH] PCI: Move ATS declarations to linux/pci-ats.h

2019-09-14 Thread Krzysztof Wilczynski
Move ATS function prototypes from include/linux/pci.h
to include/linux/pci-ats.h as the ATS, PRI, and PASID
interfaces are related, and are used only by the IOMMU
drivers.  This effecively reverts the change done in
commit ff9bee895c4d ("PCI: Move ATS declarations to
linux/pci.h so they're all together").

Also, remove surplus forward declaration of struct pci_ats
from include/linux/pci.h, as it is no longer needed, since
the struct pci_ats has been embedded directly into struct
pci_dev in the commit d544d75ac96a ("PCI: Embed ATS info
directly into struct pci_dev").

No functional changes intended.

Signed-off-by: Krzysztof Wilczynski 
---
Related:
  https://lore.kernel.org/r/20190902211100.gh7...@google.com
  https://lore.kernel.org/r/20190724233848.73327-9-skunberg.kel...@gmail.com

 include/linux/pci-ats.h | 76 +++--
 include/linux/pci.h | 14 
 2 files changed, 28 insertions(+), 62 deletions(-)

diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
index 1ebb88e7c184..a2001673d445 100644
--- a/include/linux/pci-ats.h
+++ b/include/linux/pci-ats.h
@@ -4,74 +4,54 @@
 
 #include 
 
-#ifdef CONFIG_PCI_PRI
+#ifdef CONFIG_PCI_ATS
+/* Address Translation Service */
+int pci_enable_ats(struct pci_dev *dev, int ps);
+void pci_disable_ats(struct pci_dev *dev);
+int pci_ats_queue_depth(struct pci_dev *dev);
+int pci_ats_page_aligned(struct pci_dev *dev);
+#else /* CONFIG_PCI_ATS */
+static inline int pci_enable_ats(struct pci_dev *d, int ps)
+{ return -ENODEV; }
+static inline void pci_disable_ats(struct pci_dev *d) { }
+static inline int pci_ats_queue_depth(struct pci_dev *d)
+{ return -ENODEV; }
+static inline int pci_ats_page_aligned(struct pci_dev *dev)
+{ return 0; }
+#endif /* CONFIG_PCI_ATS */
 
+#ifdef CONFIG_PCI_PRI
 int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
 void pci_disable_pri(struct pci_dev *pdev);
 void pci_restore_pri_state(struct pci_dev *pdev);
 int pci_reset_pri(struct pci_dev *pdev);
-
 #else /* CONFIG_PCI_PRI */
-
 static inline int pci_enable_pri(struct pci_dev *pdev, u32 reqs)
-{
-   return -ENODEV;
-}
-
-static inline void pci_disable_pri(struct pci_dev *pdev)
-{
-}
-
-static inline void pci_restore_pri_state(struct pci_dev *pdev)
-{
-}
-
+{ return -ENODEV; }
+static inline void pci_disable_pri(struct pci_dev *pdev) { }
+static inline void pci_restore_pri_state(struct pci_dev *pdev) { }
 static inline int pci_reset_pri(struct pci_dev *pdev)
-{
-   return -ENODEV;
-}
-
+{ return -ENODEV; }
 #endif /* CONFIG_PCI_PRI */
 
 #ifdef CONFIG_PCI_PASID
-
 int pci_enable_pasid(struct pci_dev *pdev, int features);
 void pci_disable_pasid(struct pci_dev *pdev);
 void pci_restore_pasid_state(struct pci_dev *pdev);
 int pci_pasid_features(struct pci_dev *pdev);
 int pci_max_pasids(struct pci_dev *pdev);
 int pci_prg_resp_pasid_required(struct pci_dev *pdev);
-
-#else  /* CONFIG_PCI_PASID */
-
+#else /* CONFIG_PCI_PASID */
 static inline int pci_enable_pasid(struct pci_dev *pdev, int features)
-{
-   return -EINVAL;
-}
-
-static inline void pci_disable_pasid(struct pci_dev *pdev)
-{
-}
-
-static inline void pci_restore_pasid_state(struct pci_dev *pdev)
-{
-}
-
+{ return -EINVAL; }
+static inline void pci_disable_pasid(struct pci_dev *pdev) { }
+static inline void pci_restore_pasid_state(struct pci_dev *pdev) { }
 static inline int pci_pasid_features(struct pci_dev *pdev)
-{
-   return -EINVAL;
-}
-
+{ return -EINVAL; }
 static inline int pci_max_pasids(struct pci_dev *pdev)
-{
-   return -EINVAL;
-}
-
+{ return -EINVAL; }
 static inline int pci_prg_resp_pasid_required(struct pci_dev *pdev)
-{
-   return 0;
-}
+{ return 0; }
 #endif /* CONFIG_PCI_PASID */
 
-
-#endif /* LINUX_PCI_ATS_H*/
+#endif /* LINUX_PCI_ATS_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 56767f50ad96..5f2ae580bd19 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -284,7 +284,6 @@ struct irq_affinity;
 struct pcie_link_state;
 struct pci_vpd;
 struct pci_sriov;
-struct pci_ats;
 struct pci_p2pdma;
 
 /* The pci_dev structure describes PCI devices */
@@ -1764,19 +1763,6 @@ static inline const struct pci_device_id 
*pci_match_id(const struct pci_device_i
 static inline bool pci_ats_disabled(void) { return true; }
 #endif /* CONFIG_PCI */
 
-#ifdef CONFIG_PCI_ATS
-/* Address Translation Service */
-int pci_enable_ats(struct pci_dev *dev, int ps);
-void pci_disable_ats(struct pci_dev *dev);
-int pci_ats_queue_depth(struct pci_dev *dev);
-int pci_ats_page_aligned(struct pci_dev *dev);
-#else
-static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; }
-static inline void pci_disable_ats(struct pci_dev *d) { }
-static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; }
-static inline int pci_ats_page_aligned(struct pci_dev *dev) { return 0; }
-#endif
-
 /* Include architecture-dependent settings and functions */
 
 #include 
-- 
2.23.0



Re: [PATCH] iio: light: bh1750: Move static keyword to the front of declaration

2019-09-10 Thread Krzysztof Wilczynski
Hello Jonathan,

Thank you for the feedback.  I really appreciate it.

[...]
> We can do that of course, but that's nothing to do with moving the static
> keyword to the front of the declaration which is what the patch claims
> to be doing.

I see your point.  I am going to send a v2 that hopefully will be much
cleaner and better worded.  Thank you!

Krzysztof


Re: [PATCH] iio: light: bh1750: Move static keyword to the front of declaration

2019-09-08 Thread Krzysztof Wilczynski
Hello Jonathan,

Thank you for feedback.

[...]
> > drivers/iio/light/bh1750.c:64:1: warning:
> >   ‘static’ is not at beginning of declaration [-Wold-style-declaration]
[...]
> This one has me confused.  The warning seems to be false as static
> is at the beginning of the declaration
> 
> Sure we "could" combine the declaration with the definition as you have
> done here, but that has nothing much to do with the warning.
[...]

I only moved the "static const" at the front, I haven't changed the
code as it's already has been a declaration and definition.  There is
no semicolon there and the original author put a newline to separate
things which makes it look as if these were separate.

Simple example based on the existing code:

  https://godbolt.org/z/hV4HP7

I hope this helps to illustrate the change in the patch.  I apologise
if my approach was incorrect.

As part of the patch I removed the newline in an aim to make it less
confusing to anyone who will read the code in the future.  Especially,
since it makes it a bit awkward to read and when using things like
grep.

Krzysztof


[PATCH] nds32: Move static keyword to the front of declaration

2019-09-04 Thread Krzysztof Wilczynski
Move the static keyword to the front of declaration of
cpu_pmu_of_device_ids, and resolve the following compiler
warning that can be seen when building with warnings
enabled (W=1):

arch/nds32/kernel/perf_event_cpu.c:1122:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 arch/nds32/kernel/perf_event_cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/nds32/kernel/perf_event_cpu.c 
b/arch/nds32/kernel/perf_event_cpu.c
index 334c2a6cec23..0ce6f9f307e6 100644
--- a/arch/nds32/kernel/perf_event_cpu.c
+++ b/arch/nds32/kernel/perf_event_cpu.c
@@ -1119,7 +1119,7 @@ static void cpu_pmu_init(struct nds32_pmu *cpu_pmu)
on_each_cpu(cpu_pmu->reset, cpu_pmu, 1);
 }
 
-const static struct of_device_id cpu_pmu_of_device_ids[] = {
+static const struct of_device_id cpu_pmu_of_device_ids[] = {
{.compatible = "andestech,nds32v3-pmu",
 .data = device_pmu_init},
{},
-- 
2.22.1



Re: [PATCH v3] PCI: hv: Make functions static

2019-09-04 Thread Krzysztof Wilczynski
Hello Lorenzo,

[...]
> This patch should go via the net tree - the code it is fixing
> is queued there, I will drop this patch from the PCI review
> queue.
[...]

Thank you!  Appreciated.

Krzysztof


[PATCH] net: hns: Move static keyword to the front of declaration

2019-09-04 Thread Krzysztof Wilczynski
Move the static keyword to the front of declaration of g_dsaf_mode_match,
and resolve the following compiler warning that can be seen when building
with warnings enabled (W=1):

drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c:27:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c 
b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index c1eba421ba82..3a14bbc26ea2 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -24,7 +24,7 @@
 #include "hns_dsaf_rcb.h"
 #include "hns_dsaf_misc.h"
 
-const static char *g_dsaf_mode_match[DSAF_MODE_MAX] = {
+static const char *g_dsaf_mode_match[DSAF_MODE_MAX] = {
[DSAF_MODE_DISABLE_2PORT_64VM] = "2port-64vf",
[DSAF_MODE_DISABLE_6PORT_0VM] = "6port-16rss",
[DSAF_MODE_DISABLE_6PORT_16VM] = "6port-16vf",
-- 
2.22.1



[PATCH] net: qed: Move static keyword to the front of declaration

2019-09-04 Thread Krzysztof Wilczynski
Move the static keyword to the front of declaration of iwarp_state_names,
and resolve the following compiler warning that can be seen when building
with warnings enabled (W=1):

drivers/net/ethernet/qlogic/qed/qed_iwarp.c:385:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Also, resolve checkpatch.pl script warning:

WARNING: static const char * array should probably be
  static const char * const

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c 
b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
index f380fae8799d..65ec16a31658 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
@@ -382,7 +382,7 @@ qed_iwarp2roce_state(enum qed_iwarp_qp_state state)
}
 }
 
-const static char *iwarp_state_names[] = {
+static const char * const iwarp_state_names[] = {
"IDLE",
"RTS",
"TERMINATE",
-- 
2.22.1



Re: [PATCH] csky: Move static keyword to the front of declaration

2019-09-03 Thread Krzysztof Wilczynski
Hello Guo,

Thank you for the feedback!

[...]
> You may also modify others'
[...]

That work is on-going, and patches are being sent out to address other
warnings of this nature to the respective maintainers. :)

Krzysztof


[PATCH] csky: Move static keyword to the front of declaration

2019-09-03 Thread Krzysztof Wilczynski
Move the static keyword to the front of declaration of
csky_pmu_of_device_ids, and resolve the following compiler
warning that can be seen when building with warnings
enabled (W=1):

arch/csky/kernel/perf_event.c:1340:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 arch/csky/kernel/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/csky/kernel/perf_event.c b/arch/csky/kernel/perf_event.c
index 4c1a1934d76a..bc33e4ed189d 100644
--- a/arch/csky/kernel/perf_event.c
+++ b/arch/csky/kernel/perf_event.c
@@ -1337,7 +1337,7 @@ int csky_pmu_device_probe(struct platform_device *pdev,
return ret;
 }
 
-const static struct of_device_id csky_pmu_of_device_ids[] = {
+static const struct of_device_id csky_pmu_of_device_ids[] = {
{.compatible = "csky,csky-pmu"},
{},
 };
-- 
2.22.1



Re: [PATCH] iwlwifi: mvm: Move static keyword to the front of declarations

2019-09-02 Thread Krzysztof Wilczynski
Hi Luca,

[...]
> Thanks for your patch! Though we already have this change in our
> internal tree (submitted by YueHaibing) and it will reach the mainline
> soon.

Thank you for letting me know.  I am glad it's fixed. :)

Krzysztof


[PATCH] iio: light: bh1750: Move static keyword to the front of declaration

2019-09-02 Thread Krzysztof Wilczynski
Move the static keyword to the front of declaration of
bh1750_chip_info_tbl, and resolve the following compiler
warning that can be seen when building with warnings
enabled (W=1):

drivers/iio/light/bh1750.c:64:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 drivers/iio/light/bh1750.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c
index 28347df78cff..460c0013f1a9 100644
--- a/drivers/iio/light/bh1750.c
+++ b/drivers/iio/light/bh1750.c
@@ -42,7 +42,7 @@ struct bh1750_data {
u16 mtreg;
 };
 
-struct bh1750_chip_info {
+static const struct bh1750_chip_info {
u16 mtreg_min;
u16 mtreg_max;
u16 mtreg_default;
@@ -59,9 +59,7 @@ struct bh1750_chip_info {
 
u16 int_time_low_mask;
u16 int_time_high_mask;
-}
-
-static const bh1750_chip_info_tbl[] = {
+} bh1750_chip_info_tbl[] = {
[BH1710] = { 140, 1022, 300, 400,  25000, 2, 0x001F, 0x03E0 },
[BH1721] = { 140, 1020, 300, 400,  25000, 2, 0x0010, 0x03E0 },
[BH1750] = { 31,  254,  69,  1740, 5750,  1, 0x001F, 0x00E0 },
-- 
2.22.1



[PATCH] iwlwifi: mvm: Move static keyword to the front of declarations

2019-08-31 Thread Krzysztof Wilczynski
Move the static keyword to the front of declarations of
he_if_types_ext_capa_sta and he_iftypes_ext_capa, and
resolve the following compiler warnings that can be seen
when building with warnings enabled (W=1):

drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:427:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:434:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index d6499763f0dd..937a843fed56 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -424,14 +424,14 @@ int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm)
return ret;
 }
 
-const static u8 he_if_types_ext_capa_sta[] = {
+static const u8 he_if_types_ext_capa_sta[] = {
 [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
 [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
 [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
 [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT,
 };
 
-const static struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = {
+static const struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = {
{
.iftype = NL80211_IFTYPE_STATION,
.extended_capabilities = he_if_types_ext_capa_sta,
-- 
2.22.1



[PATCH] ceph: Move static keyword to the front of declarations

2019-08-31 Thread Krzysztof Wilczynski
Move the static keyword to the front of declarations of
snap_handle_length, handle_length and connected_handle_length,
and resolve the following compiler warnings that can be seen
when building with warnings enabled (W=1):

fs/ceph/export.c:38:2: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

fs/ceph/export.c:88:2: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

fs/ceph/export.c:90:2: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 fs/ceph/export.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 020d39a85ecc..b6bfa94332c3 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -35,7 +35,7 @@ struct ceph_nfs_snapfh {
 static int ceph_encode_snapfh(struct inode *inode, u32 *rawfh, int *max_len,
  struct inode *parent_inode)
 {
-   const static int snap_handle_length =
+   static const int snap_handle_length =
sizeof(struct ceph_nfs_snapfh) >> 2;
struct ceph_nfs_snapfh *sfh = (void *)rawfh;
u64 snapid = ceph_snap(inode);
@@ -85,9 +85,9 @@ static int ceph_encode_snapfh(struct inode *inode, u32 
*rawfh, int *max_len,
 static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
  struct inode *parent_inode)
 {
-   const static int handle_length =
+   static const int handle_length =
sizeof(struct ceph_nfs_fh) >> 2;
-   const static int connected_handle_length =
+   static const int connected_handle_length =
sizeof(struct ceph_nfs_confh) >> 2;
int type;
 
-- 
2.22.1



[PATCH v2 1/2] leds: lm3532: Move static keyword to the front of declarations

2019-08-30 Thread Krzysztof Wilczynski
Move the static keyword to the front of declarations ramp_table,
als_avrg_table and als_imp_table, and resolve the following
compiler warnings that can be seen when building with warnings
enabled (W=1):

drivers/leds/leds-lm3532.c:209:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/leds/leds-lm3532.c:266:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/leds/leds-lm3532.c:281:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 drivers/leds/leds-lm3532.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
index c5cfd8e3f15f..62ace6698d25 100644
--- a/drivers/leds/leds-lm3532.c
+++ b/drivers/leds/leds-lm3532.c
@@ -208,7 +208,7 @@ static const struct regmap_config lm3532_regmap_config = {
.cache_type = REGCACHE_FLAT,
 };
 
-const static int als_imp_table[LM3532_NUM_IMP_VALS] = {37000, 18500, 12330,
+static const int als_imp_table[LM3532_NUM_IMP_VALS] = {37000, 18500, 12330,
   92500, 7400, 6170, 5290,
   4630, 4110, 3700, 3360,
   3080, 2850, 2640, 2440,
@@ -265,7 +265,7 @@ static int lm3532_get_index(const int table[], int size, 
int value)
return -EINVAL;
 }
 
-const static int als_avrg_table[LM3532_NUM_AVG_VALS] = {17920, 35840, 71680,
+static const int als_avrg_table[LM3532_NUM_AVG_VALS] = {17920, 35840, 71680,
1433360, 286720, 573440,
1146880, 2293760};
 static int lm3532_get_als_avg_index(int avg_time)
@@ -280,7 +280,7 @@ static int lm3532_get_als_avg_index(int avg_time)
avg_time);
 }
 
-const static int ramp_table[LM3532_NUM_RAMP_VALS] = { 8, 1024, 2048, 4096, 
8192,
+static const int ramp_table[LM3532_NUM_RAMP_VALS] = { 8, 1024, 2048, 4096, 
8192,
 16384, 32768, 65536};
 static int lm3532_get_ramp_index(int ramp_time)
 {
-- 
2.22.1



[PATCH v2 2/2] leds: ti-lmu-common: Move static keyword to the front of declaration

2019-08-30 Thread Krzysztof Wilczynski
Move the static keyword to the front of declaration of ramp_table,
and resolve the following compiler warning that can be seen when
building with warnings enabled (W=1):

drivers/leds/leds-ti-lmu-common.c:14:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 drivers/leds/leds-ti-lmu-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-ti-lmu-common.c 
b/drivers/leds/leds-ti-lmu-common.c
index e294a0b097e3..d7f10ad721ba 100644
--- a/drivers/leds/leds-ti-lmu-common.c
+++ b/drivers/leds/leds-ti-lmu-common.c
@@ -11,7 +11,7 @@
 
 #include 
 
-const static unsigned int ramp_table[16] = {2048, 262000, 524000, 1049000,
+static const unsigned int ramp_table[16] = {2048, 262000, 524000, 1049000,
209, 4194000, 8389000, 1678, 3355,
4194, 5033, 5872, 6711,
8388, 10066, 11744};
-- 
2.22.1



Re: [PATCH] leds: Move static keyword to the front of declarations

2019-08-30 Thread Krzysztof Wilczynski

Hello Dan,

Thank you for feedback.
[...]

This file is missing in the subject.

Maybe break it out into a separate patch since they do not have 
dependencies on each other.


Will do.  Sorry about that.  I initially had these
as separate patches, but after looking at who the
maintainer is and thought that it perhaps makes
sense to send as a single patch.  Good point.

Krzysztof




[PATCH] unicode: Move static keyword to the front of declarations

2019-08-30 Thread Krzysztof Wilczynski
Move the static keyword to the front of declarations of nfdi_test_data
and nfdicf_test_data, and resolve the following compiler warnings that
can be seen when building with warnings enabled (W=1):

fs/unicode/utf8-selftest.c:38:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

fs/unicode/utf8-selftest.c:92:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 fs/unicode/utf8-selftest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/unicode/utf8-selftest.c b/fs/unicode/utf8-selftest.c
index 6c1a36bbf6ad..6fe8af7edccb 100644
--- a/fs/unicode/utf8-selftest.c
+++ b/fs/unicode/utf8-selftest.c
@@ -35,7 +35,7 @@ unsigned int total_tests;
 #define test_f(cond, fmt, ...) _test(cond, __func__, __LINE__, fmt, 
##__VA_ARGS__)
 #define test(cond) _test(cond, __func__, __LINE__, "")
 
-const static struct {
+static const struct {
/* UTF-8 strings in this vector _must_ be NULL-terminated. */
unsigned char str[10];
unsigned char dec[10];
@@ -89,7 +89,7 @@ const static struct {
 
 };
 
-const static struct {
+static const struct {
/* UTF-8 strings in this vector _must_ be NULL-terminated. */
unsigned char str[30];
unsigned char ncf[30];
-- 
2.22.1



[PATCH] leds: Move static keyword to the front of declarations

2019-08-30 Thread Krzysztof Wilczynski
Move the static keyword to the front of declarations.

In drivers/leds/leds-lm3532.c for ramp_table, als_avrg_table
and als_imp_table, and in drivers/leds/leds-lm3532.c for
ramp_table.

This will resolve the following compiler warnings that can
be seen when building with warnings enabled (W=1):

drivers/leds/leds-lm3532.c:209:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/leds/leds-lm3532.c:266:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/leds/leds-lm3532.c:281:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

drivers/leds/leds-ti-lmu-common.c:14:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski 
---
Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com

 drivers/leds/leds-lm3532.c| 6 +++---
 drivers/leds/leds-ti-lmu-common.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
index c5cfd8e3f15f..62ace6698d25 100644
--- a/drivers/leds/leds-lm3532.c
+++ b/drivers/leds/leds-lm3532.c
@@ -208,7 +208,7 @@ static const struct regmap_config lm3532_regmap_config = {
.cache_type = REGCACHE_FLAT,
 };
 
-const static int als_imp_table[LM3532_NUM_IMP_VALS] = {37000, 18500, 12330,
+static const int als_imp_table[LM3532_NUM_IMP_VALS] = {37000, 18500, 12330,
   92500, 7400, 6170, 5290,
   4630, 4110, 3700, 3360,
   3080, 2850, 2640, 2440,
@@ -265,7 +265,7 @@ static int lm3532_get_index(const int table[], int size, 
int value)
return -EINVAL;
 }
 
-const static int als_avrg_table[LM3532_NUM_AVG_VALS] = {17920, 35840, 71680,
+static const int als_avrg_table[LM3532_NUM_AVG_VALS] = {17920, 35840, 71680,
1433360, 286720, 573440,
1146880, 2293760};
 static int lm3532_get_als_avg_index(int avg_time)
@@ -280,7 +280,7 @@ static int lm3532_get_als_avg_index(int avg_time)
avg_time);
 }
 
-const static int ramp_table[LM3532_NUM_RAMP_VALS] = { 8, 1024, 2048, 4096, 
8192,
+static const int ramp_table[LM3532_NUM_RAMP_VALS] = { 8, 1024, 2048, 4096, 
8192,
 16384, 32768, 65536};
 static int lm3532_get_ramp_index(int ramp_time)
 {
diff --git a/drivers/leds/leds-ti-lmu-common.c 
b/drivers/leds/leds-ti-lmu-common.c
index e294a0b097e3..d7f10ad721ba 100644
--- a/drivers/leds/leds-ti-lmu-common.c
+++ b/drivers/leds/leds-ti-lmu-common.c
@@ -11,7 +11,7 @@
 
 #include 
 
-const static unsigned int ramp_table[16] = {2048, 262000, 524000, 1049000,
+static const unsigned int ramp_table[16] = {2048, 262000, 524000, 1049000,
209, 4194000, 8389000, 1678, 3355,
4194, 5033, 5872, 6711,
8388, 10066, 11744};
-- 
2.22.1



[PATCH v3] x86/PCI: Add missing log facility and move to use pr_ macros

2019-08-29 Thread Krzysztof Wilczynski
Add missing log facility where two instances of printk() that did not
use any (so it would be using MESSAGE_LOGLEVEL_DEFAULT set in Kconfig)
to make all the warnings in the arch/x86/pci/pcbios.c to be printed
consistently at the same log facility.  This resolves the following
checkpatch.pl script warning:

WARNING: printk() should include KERN_ facility level

While adding the missing log facility move over to using pr_ macros
over using printk(KERN_ ...) and DBG().

Also resolve the additional errors and warnings reported by the
checkpatch.pl script:

ERROR: trailing whitespace
ERROR: "foo * bar" should be "foo *bar"
ERROR: switch and case should be at the same indent

WARNING: please, no space before tabs
WARNING: line over 80 characters
WARNING: quoted string split across lines
WARNING: __packed is preferred over __attribute__((packed))
WARNING: Prefer using '"%s...", __func__' to using 'bios32_service',
  this function's name, in a string

Signed-off-by: Krzysztof Wilczynski 
---
Changes in v3:
  Remove name of the file from the subject.
  Address review feedback of v2, and resolve more checkpatch.pl
  script errors and warnings.

Changes in v2:
  Change wording and include checkpatch.pl script warning.
  Leverage pr_fmt and remove "PCI: " prefix used throught.
  Move to pr_debug() over using DBG() from arch/x86/include/asm/pci_x86.h.

 arch/x86/pci/pcbios.c | 77 +++
 1 file changed, 41 insertions(+), 36 deletions(-)

diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index 9c97d814125e..dd8ca5636953 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -3,6 +3,8 @@
  * BIOS32 and PCI BIOS handling.
  */
 
+#define pr_fmt(fmt) "PCI: " fmt
+
 #include 
 #include 
 #include 
@@ -47,15 +49,15 @@ static inline void set_bios_x(void)
pcibios_enabled = 1;
set_memory_x(PAGE_OFFSET + BIOS_BEGIN, (BIOS_END - BIOS_BEGIN) >> 
PAGE_SHIFT);
if (__supported_pte_mask & _PAGE_NX)
-   printk(KERN_INFO "PCI: PCI BIOS area is rw and x. Use 
pci=nobios if you want it NX.\n");
+   pr_info("PCI BIOS area is rw and x. Use pci=nobios if you want 
it NX.\n");
 }
 
 /*
  * This is the standard structure used to identify the entry point
  * to the BIOS32 Service Directory, as documented in
- * Standard BIOS 32-bit Service Directory Proposal
- * Revision 0.4 May 24, 1993
- * Phoenix Technologies Ltd.
+ * Standard BIOS 32-bit Service Directory Proposal
+ * Revision 0.4 May 24, 1993
+ * Phoenix Technologies Ltd.
  * Norwood, MA
  * and the PCI BIOS specification.
  */
@@ -67,7 +69,7 @@ union bios32 {
unsigned char revision; /* Revision level, 0 */
unsigned char length;   /* Length in paragraphs should 
be 01 */
unsigned char checksum; /* All bytes must add up to 
zero */
-   unsigned char reserved[5];  /* Must be zero */
+   unsigned char reserved[5];  /* Must be zero */
} fields;
char chars[16];
 };
@@ -108,15 +110,16 @@ static unsigned long __init bios32_service(unsigned long 
service)
local_irq_restore(flags);
 
switch (return_code) {
-   case 0:
-   return address + entry;
-   case 0x80:  /* Not present */
-   printk(KERN_WARNING "bios32_service(0x%lx): not 
present\n", service);
-   return 0;
-   default: /* Shouldn't happen */
-   printk(KERN_WARNING "bios32_service(0x%lx): returned 
0x%x -- BIOS bug!\n",
-   service, return_code);
-   return 0;
+   case 0:
+   return address + entry;
+   case 0x80:  /* Not present */
+   pr_warn("%s(0x%lx): not present\n",
+   __func__, service);
+   return 0;
+   default: /* Shouldn't happen */
+   pr_warn("%s(0x%lx): returned 0x%x -- BIOS bug!\n",
+   __func__, service, return_code);
+   return 0;
}
 }
 
@@ -140,8 +143,7 @@ static int __init check_pcibios(void)
pci_indirect.address = pcibios_entry + PAGE_OFFSET;
 
local_irq_save(flags);
-   __asm__(
-   "lcall *(%%edi); cld\n\t"
+   __asm__("lcall *(%%edi); cld\n\t"
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
@@ -160,14 +162,15 @@ static int __init check_pcibios(void)
minor_ver = ebx & 0xff;
if (pcibios_last_bus < 0)
pcibios_last_bus = ecx & 0xff;
-   DBG("PCI: BIOS probe returned s=%02x hw=%02x 

[PATCH v3] PCI: hv: Make functions static

2019-08-29 Thread Krzysztof Wilczynski
Functions hv_read_config_block(), hv_write_config_block()
and hv_register_block_invalidate() are not used anywhere
else and are local to drivers/pci/controller/pci-hyperv.c,
and do not need to be in global scope, so make these static.

Resolve following compiler warning that can be seen when
building with warnings enabled (W=1):

drivers/pci/controller/pci-hyperv.c:933:5: warning:
 no previous prototype for ‘hv_read_config_block’
  [-Wmissing-prototypes]

drivers/pci/controller/pci-hyperv.c:1013:5: warning:
 no previous prototype for ‘hv_write_config_block’
  [-Wmissing-prototypes]

drivers/pci/controller/pci-hyperv.c:1082:5: warning:
 no previous prototype for ‘hv_register_block_invalidate’
  [-Wmissing-prototypes]

Signed-off-by: Krzysztof Wilczynski 
---
Changes in v3:
  Commit message has been wrapped to fit 75 columns.
  Addressed formatting based on feedback from v2.

Changes in v2:
  Update commit message to include compiler warning.

 drivers/pci/controller/pci-hyperv.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/pci-hyperv.c 
b/drivers/pci/controller/pci-hyperv.c
index f1f300218fab..ba988fe033b5 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -930,8 +930,9 @@ static void hv_pci_read_config_compl(void *context, struct 
pci_response *resp,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_read_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
-unsigned int block_id, unsigned int *bytes_returned)
+static int hv_read_config_block(struct pci_dev *pdev, void *buf,
+   unsigned int len, unsigned int block_id,
+   unsigned int *bytes_returned)
 {
struct hv_pcibus_device *hbus =
container_of(pdev->bus->sysdata, struct hv_pcibus_device,
@@ -1010,8 +1011,8 @@ static void hv_pci_write_config_compl(void *context, 
struct pci_response *resp,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_write_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
- unsigned int block_id)
+static int hv_write_config_block(struct pci_dev *pdev, void *buf,
+unsigned int len, unsigned int block_id)
 {
struct hv_pcibus_device *hbus =
container_of(pdev->bus->sysdata, struct hv_pcibus_device,
@@ -1079,9 +1080,9 @@ int hv_write_config_block(struct pci_dev *pdev, void 
*buf, unsigned int len,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_register_block_invalidate(struct pci_dev *pdev, void *context,
-void (*block_invalidate)(void *context,
- u64 block_mask))
+static int hv_register_block_invalidate(
+   struct pci_dev *pdev, void *context,
+   void (*block_invalidate)(void *context, u64 block_mask))
 {
struct hv_pcibus_device *hbus =
container_of(pdev->bus->sysdata, struct hv_pcibus_device,
@@ -1097,7 +1098,6 @@ int hv_register_block_invalidate(struct pci_dev *pdev, 
void *context,
 
put_pcichild(hpdev);
return 0;
-
 }
 
 /* Interrupt management hooks */
-- 
2.22.1



RE: [PATCH v2] PCI: hv: Make functions only used locally static in pci-hyperv.c

2019-08-28 Thread Krzysztof Wilczynski

Hello Haiyang,

Thank you for feedback.

[...]

The second line should be aligned next to the "(" on the first line.
Also the first line is now over 80 chars.


Sorry about this.  I will fix it in v3.  Thank you for pointing this 
out.


To address both the alignment and line length of 
hv_register_block_invalidate(),
I took a hint from the way how hv_compose_msi_req_v1() is current 
formatted.  I

hope that this would be acceptable.

Krzysztof




Re: [PATCH] PCI: hv: Make functions only used locally static in pci-hyperv.c

2019-08-28 Thread Krzysztof Wilczynski

Hello Bjorn,
Thank you for feedback.

[...]

Maybe just:

  PCI: hv: Make functions static

since we already know it's in pci-hyperv.c, and it's obvious that you
can only do this for functions that are only used locally.


Makes sense.  I will update the subject line in v3.

[...]

Rewrap commit log to fill 75 columns.


Sorry about this.  I wasn't sure if one also should wrap compiler and/or
checkpatch.pl script warnings or errors.  I will fix this.


Does this fix all the similar warnings in drivers/pci/?  If there are
more, maybe we could fix them all in a single patch or at least a
single series?


At the moment, while compiling the drivers/pci the compiler yields a 
similar

warning for the following files:

arch/x86/pci/xen.c
arch/x86/pci/numachip.c
drivers/pci/controller/pci-hyperv.c
drivers/pci/vc.c

I will have a look at each closer.

Krzysztof




[PATCH v2] PCI: hv: Make functions only used locally static in pci-hyperv.c

2019-08-28 Thread Krzysztof Wilczynski
Functions hv_read_config_block(), hv_write_config_block()
and hv_register_block_invalidate() are not used anywhere
else and are local to drivers/pci/controller/pci-hyperv.c,
and do not need to be in global scope, so make these static.

Resolve following compiler warning that can be seen when
building with warnings enabled (W=1):

drivers/pci/controller/pci-hyperv.c:933:5: warning: no previous prototype for 
‘hv_read_config_block’ [-Wmissing-prototypes]
 int hv_read_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
 ^
drivers/pci/controller/pci-hyperv.c:1013:5: warning: no previous prototype for 
‘hv_write_config_block’ [-Wmissing-prototypes]
 int hv_write_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
 ^
drivers/pci/controller/pci-hyperv.c:1082:5: warning: no previous prototype for 
‘hv_register_block_invalidate’ [-Wmissing-prototypes]
 int hv_register_block_invalidate(struct pci_dev *pdev, void *context,
 ^
Signed-off-by: Krzysztof Wilczynski 
---
Changes in v2:
  Update commit message to include compiler warning.

 drivers/pci/controller/pci-hyperv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-hyperv.c 
b/drivers/pci/controller/pci-hyperv.c
index f1f300218fab..c9642e429c2d 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -930,7 +930,7 @@ static void hv_pci_read_config_compl(void *context, struct 
pci_response *resp,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_read_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
+static int hv_read_config_block(struct pci_dev *pdev, void *buf, unsigned int 
len,
 unsigned int block_id, unsigned int *bytes_returned)
 {
struct hv_pcibus_device *hbus =
@@ -1010,7 +1010,7 @@ static void hv_pci_write_config_compl(void *context, 
struct pci_response *resp,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_write_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
+static int hv_write_config_block(struct pci_dev *pdev, void *buf, unsigned int 
len,
  unsigned int block_id)
 {
struct hv_pcibus_device *hbus =
@@ -1079,7 +1079,7 @@ int hv_write_config_block(struct pci_dev *pdev, void 
*buf, unsigned int len,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_register_block_invalidate(struct pci_dev *pdev, void *context,
+static int hv_register_block_invalidate(struct pci_dev *pdev, void *context,
 void (*block_invalidate)(void *context,
  u64 block_mask))
 {
-- 
2.22.1



Re: [PATCH v2] x86/PCI: Add missing log facility and move to use pr_ macros in pcbios.c

2019-08-28 Thread Krzysztof Wilczynski

Hello Joe,
[...]

 The lines over 80 characters wide would be taken care of when
 moving to using the pr_ macros as the line length will now be
 shorter contrary to when the e.g., printk(KERNEL_INFO ...),
 etc., was used.


Not really, those were the warnings checkpatch
emits on your actual patch.


Ah! Yes, very true.  Sorry about that.  I will address these in v3,
of course.

Thank you for correcting me!

Krzysztof





Re: [PATCH v2] x86/PCI: Add missing log facility and move to use pr_ macros in pcbios.c

2019-08-28 Thread Krzysztof Wilczynski

Hello Joe,

Thank you for feedback.
[...]
   Move to pr_debug() over using DBG() from 
arch/x86/include/asm/pci_x86.h.


You might also consider the checkpatch output for this patch.

arch/x86/pci/pcbios.c:116: WARNING: line over 80 characters
arch/x86/pci/pcbios.c:116: WARNING: Prefer using '"%s...", __func__' 
to using 'bios32_service', this function's name, in a string
arch/x86/pci/pcbios.c:119: WARNING: Prefer using '"%s...", __func__' 
to using 'bios32_service', this function's name, in a string

arch/x86/pci/pcbios.c:391: WARNING: line over 80 characters


Good point.

The lines over 80 characters wide would be taken care of when
moving to using the pr_ macros as the line length will now be
shorter contrary to when the e.g., printk(KERNEL_INFO ...),
etc., was used.

The other warnings I am going to address in v3.  I was thinking
of replacing the following:

pr_warn("bios32_service(0x%lx): not present\n", service);

With something that looks like this:

pr_warn("BIOS32 Service(0x%lx): not present\n", service);

Using "bios32_service" name directly or even moving to __func__
feels a lot like an implementation detail is exposed to the
end user.  I am not sure how useful that could be.  Also,
we are already using log lines starting with "BIOS32", thus
it seemed like following them would be the most sensible
choice, especially to keep messages consistent.

What do you think?

Krzysztof




[PATCH v2] x86/PCI: Add missing log facility and move to use pr_ macros in pcbios.c

2019-08-28 Thread Krzysztof Wilczynski
Add missing log facility where two instances of printk() that did not
use any (so it would be using MESSAGE_LOGLEVEL_DEFAULT set in Kconfig)
to make all the warnings in the arch/x86/pci/pcbios.c to be printed
consistently at the same log facility.  Also resolve the following
checkpatch.pl script warning:

WARNING: printk() should include KERN_ facility level

While adding the missing log facility move over to using pr_ macros
over using printk(KERN_ ...) and DBG().

Signed-off-by: Krzysztof Wilczynski 
---
Changes in v2:
  Change wording and include checkpatch.pl script warning.
  Leverage pr_fmt and remove "PCI: " prefix used throught.
  Move to pr_debug() over using DBG() from arch/x86/include/asm/pci_x86.h.

 arch/x86/pci/pcbios.c | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index 9c97d814125e..ddcefb25c55e 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -3,6 +3,8 @@
  * BIOS32 and PCI BIOS handling.
  */
 
+#define pr_fmt(fmt) "PCI: " fmt
+
 #include 
 #include 
 #include 
@@ -47,7 +49,7 @@ static inline void set_bios_x(void)
pcibios_enabled = 1;
set_memory_x(PAGE_OFFSET + BIOS_BEGIN, (BIOS_END - BIOS_BEGIN) >> 
PAGE_SHIFT);
if (__supported_pte_mask & _PAGE_NX)
-   printk(KERN_INFO "PCI: PCI BIOS area is rw and x. Use 
pci=nobios if you want it NX.\n");
+   pr_info("PCI BIOS area is rw and x. Use pci=nobios if you want 
it NX.\n");
 }
 
 /*
@@ -111,10 +113,10 @@ static unsigned long __init bios32_service(unsigned long 
service)
case 0:
return address + entry;
case 0x80:  /* Not present */
-   printk(KERN_WARNING "bios32_service(0x%lx): not 
present\n", service);
+   pr_warn("bios32_service(0x%lx): not present\n", 
service);
return 0;
default: /* Shouldn't happen */
-   printk(KERN_WARNING "bios32_service(0x%lx): returned 
0x%x -- BIOS bug!\n",
+   pr_warn("bios32_service(0x%lx): returned 0x%x -- BIOS 
bug!\n",
service, return_code);
return 0;
}
@@ -160,14 +162,14 @@ static int __init check_pcibios(void)
minor_ver = ebx & 0xff;
if (pcibios_last_bus < 0)
pcibios_last_bus = ecx & 0xff;
-   DBG("PCI: BIOS probe returned s=%02x hw=%02x ver=%02x.%02x 
l=%02x\n",
+   pr_debug("BIOS probe returned s=%02x hw=%02x ver=%02x.%02x 
l=%02x\n",
status, hw_mech, major_ver, minor_ver, 
pcibios_last_bus);
if (status || signature != PCI_SIGNATURE) {
-   printk (KERN_ERR "PCI: BIOS BUG #%x[%08x] found\n",
+   pr_err("BIOS BUG #%x[%08x] found\n",
status, signature);
return 0;
}
-   printk(KERN_INFO "PCI: PCI BIOS revision %x.%02x entry at 
0x%lx, last bus=%d\n",
+   pr_info("PCI BIOS revision %x.%02x entry at 0x%lx, last 
bus=%d\n",
major_ver, minor_ver, pcibios_entry, pcibios_last_bus);
 #ifdef CONFIG_PCI_DIRECT
if (!(hw_mech & PCIBIOS_HW_TYPE1))
@@ -316,18 +318,18 @@ static const struct pci_raw_ops *__init 
pci_find_bios(void)
if (sum != 0)
continue;
if (check->fields.revision != 0) {
-   printk("PCI: unsupported BIOS32 revision %d at 0x%p\n",
+   pr_warn("unsupported BIOS32 revision %d at 0x%p\n",
check->fields.revision, check);
continue;
}
-   DBG("PCI: BIOS32 Service Directory structure at 0x%p\n", check);
+   pr_debug("BIOS32 Service Directory structure at 0x%p\n", check);
if (check->fields.entry >= 0x10) {
-   printk("PCI: BIOS32 entry (0x%p) in high memory, "
+   pr_warn("BIOS32 entry (0x%p) in high memory, "
"cannot use.\n", check);
return NULL;
} else {
unsigned long bios32_entry = check->fields.entry;
-   DBG("PCI: BIOS32 Service Directory entry at 0x%lx\n",
+   pr_debug("BIOS32 Service Directory entry at 0x%lx\n",
bios32_entry);
bios32_indirect.address = bios32_entry + PAGE_OFFSET;
   

[PATCH v2] x86/PCI: Correct warnings about missing or incorrect SPDX license headers.

2019-08-28 Thread Krzysztof Wilczynski
Add the missing "SPDX-License-Identifier" license header
to the arch/x86/pci/numachip.c (use the GPL-2.0 identifier
derived using the comment mentioning license from the
top of the file), and remove license boilerplate as per
a similar commit 8cfab3cf63cf ("PCI: Add SPDX GPL-2.0 to
replace GPL v2 boilerplate").

Correct existing SPDX license header in the files
drivers/pci/controller/pcie-cadence.h and
drivers/pci/controller/pcie-rockchip.h to use
correct comment style as per the section 2 "Style"
of the "Linux kernel licensing rules" (see:
Documentation/process/license-rules.rst).

Both changes will resolve the following checkpatch.pl
script warning:

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1

Signed-off-by: Krzysztof Wilczynski 
---
Changes in v2:
  Update wording and mention checkpatch.pl script warnings.
  Add two C header files to which the fix also applies.

 arch/x86/pci/numachip.c| 5 +
 drivers/pci/controller/pcie-cadence.h  | 2 +-
 drivers/pci/controller/pcie-rockchip.h | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/pci/numachip.c b/arch/x86/pci/numachip.c
index 2e565e65c893..01a085d9135a 100644
--- a/arch/x86/pci/numachip.c
+++ b/arch/x86/pci/numachip.c
@@ -1,8 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
  * Numascale NumaConnect-specific PCI code
  *
  * Copyright (C) 2012 Numascale AS. All rights reserved.
diff --git a/drivers/pci/controller/pcie-cadence.h 
b/drivers/pci/controller/pcie-cadence.h
index ae6bf2a2b3d3..f1cba3931b99 100644
--- a/drivers/pci/controller/pcie-cadence.h
+++ b/drivers/pci/controller/pcie-cadence.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (c) 2017 Cadence
 // Cadence PCIe controller driver.
 // Author: Cyrille Pitchen 
diff --git a/drivers/pci/controller/pcie-rockchip.h 
b/drivers/pci/controller/pcie-rockchip.h
index 8e87a059ce73..53e4f9e59624 100644
--- a/drivers/pci/controller/pcie-rockchip.h
+++ b/drivers/pci/controller/pcie-rockchip.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Rockchip AXI PCIe controller driver
  *
-- 
2.22.1



[PATCH v2] PCI: Move static keyword to the front of declarations in pci-bridge-emul.c

2019-08-28 Thread Krzysztof Wilczynski
Move the static keyword to the front of declarations of
pci_regs_behavior and pcie_cap_regs_behavior, and resolve
the following compiler warning that can be seen when
building with warnings enabled (W=1):

drivers/pci/pci-bridge-emul.c:41:1: warning: ‘static’ is not at beginning of 
declaration [-Wold-style-declaration]
 const static struct pci_bridge_reg_behavior pci_regs_behavior[] = {
 ^
drivers/pci/pci-bridge-emul.c:176:1: warning: ‘static’ is not at beginning of 
declaration [-Wold-style-declaration]
 const static struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
 ^

Signed-off-by: Krzysztof Wilczynski 
---
Changes in v2:
  Update commit message to include compiler warning.

 drivers/pci/pci-bridge-emul.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c
index 06083b86d4f4..5fd90105510d 100644
--- a/drivers/pci/pci-bridge-emul.c
+++ b/drivers/pci/pci-bridge-emul.c
@@ -38,7 +38,7 @@ struct pci_bridge_reg_behavior {
u32 rsvd;
 };
 
-const static struct pci_bridge_reg_behavior pci_regs_behavior[] = {
+static const struct pci_bridge_reg_behavior pci_regs_behavior[] = {
[PCI_VENDOR_ID / 4] = { .ro = ~0 },
[PCI_COMMAND / 4] = {
.rw = (PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
@@ -173,7 +173,7 @@ const static struct pci_bridge_reg_behavior 
pci_regs_behavior[] = {
},
 };
 
-const static struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
+static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
[PCI_CAP_LIST_ID / 4] = {
/*
 * Capability ID, Next Capability Pointer and
-- 
2.22.1



Re: [PATCH] x86/PCI: Add missing log facility and move to use pr_ macros in pcbios.c

2019-08-28 Thread Krzysztof Wilczynski

Hello Bjorn,

Thank you for the feedback.
[...]

 Make the log facility used to print warnings to be KERN_WARNING
 explicitly, rather than rely on the current (or default) value
 of the MESSAGE_LOGLEVEL_DEFAULT set in Kconfig.  This will make
 all the warnings in the arch/x86/pci/pcbios.c to be printed
 consistently at the same log facility.


This is slightly confusing.  There are only two messages that didn't
supply a log level, so the avoidance of MESSAGE_LOGLEVEL_DEFAULT
applies to those.


Good point.  I will update both the wording and the explanation so that
it would be more accurate and make a whole lot more sense.

[...]

Might be worth doing this as well:

  #define pr_fmt(fmt) "PCI: " fmt

and removing the "PCI: " prefix from the messages.  This would change
the "bios32_service" output slightly, but I think the change would be
a good one.


Will do. The v2 have all the improvements. Thank you!

Krzysztof




Re: [PATCH] x86/PCI: Add missing SPDX license header.

2019-08-28 Thread Krzysztof Wilczynski

Hello Bjorn,

Thank you for the feedback.

[...]

 +// SPDX-License-Identifier: GPL-2.0
  /*
   * This file is subject to the terms and conditions of the GNU 
General Public
   * License.  See the file "COPYING" in the main directory of this 
archive


You can remove this license text at the same time as in 8cfab3cf63cf
("PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate").


Will do. I am going to send an updated v2 that takes care about this.

Krzysztof




Re: [PATCH] PCI: Move static keyword to the front of declarations in pci-bridge-emul.c

2019-08-28 Thread Krzysztof Wilczynski

Hello Bjorn and Thomas,

Thank you for the feedback.

[...]

 Move the static keyword to the front of declarations of
 pci_regs_behavior and pcie_cap_regs_behavior, and resolve
 compiler warning that can be seen when building with
 warnings enabled (W=1).


It would be useful to include the compiler warning in the commit log.


Good point.  Sorry about that.  I will send a v2 that includes
updated commit message.


I notice there are a few similar occurrences elsewhere in the tree:

  arch/csky/kernel/perf_event.c:const static struct of_device_id 
csky_pmu_of_device_ids[] = {
  arch/nds32/kernel/perf_event_cpu.c:const static struct of_device_id 
cpu_pmu_of_device_ids[] = {
  drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static struct 
msm_dsi_host_cfg_ops msm_dsi_v2_host_ops = {
  drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static struct 
msm_dsi_host_cfg_ops msm_dsi_6g_host_ops = {
  drivers/gpu/drm/msm/dsi/dsi_cfg.c:const static struct 
msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
  drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:const static 
struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = {

  fs/unicode/utf8-selftest.c:const static struct {
  fs/unicode/utf8-selftest.c:const static struct {

Those should probably be fixed, too (but in separate patches since
other maintainers would take them).


I will take care about these too.

Krzysztof




[PATCH] PCI: Move PCI Express ASPM function prototypes and definitions to pci.h

2019-08-27 Thread Krzysztof Wilczynski
Merge PCI Express ASPM function prototypes and definitions
from include/linux/pci-aspm.h into include/linux/pci.h.

Function prototypes to move are pci_disable_link_state(),
pci_disable_link_state_locked(), pcie_no_aspm() and
pcie_aspm_support_enabled(), and definitions to move
are PCIE_LINK_STATE_L0S, PCIE_LINK_STATE_L1 and
PCIE_LINK_STATE_CLKPM.

There are no functional changes.

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/acpi/pci_root.c   |  1 -
 drivers/char/xillybus/xillybus_pcie.c |  1 -
 drivers/net/ethernet/intel/e1000e/e1000.h |  1 -
 drivers/net/ethernet/jme.c|  1 -
 drivers/net/ethernet/realtek/r8169_main.c |  1 -
 drivers/net/wireless/ath/ath5k/pci.c  |  1 -
 .../net/wireless/intel/iwlegacy/3945-mac.c|  1 -
 .../net/wireless/intel/iwlegacy/4965-mac.c|  1 -
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |  1 -
 drivers/pci/pci-acpi.c|  1 -
 drivers/pci/pcie/aspm.c   |  1 -
 drivers/pci/quirks.c  |  1 -
 drivers/scsi/aacraid/linit.c  |  1 -
 drivers/scsi/hpsa.c   |  1 -
 drivers/scsi/mpt3sas/mpt3sas_scsih.c  |  1 -
 include/linux/pci-aspm.h  | 36 ---
 include/linux/pci.h   | 18 ++
 17 files changed, 18 insertions(+), 51 deletions(-)
 delete mode 100644 include/linux/pci-aspm.h

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 314a187ed572..d1e666ef3fcc 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/char/xillybus/xillybus_pcie.c 
b/drivers/char/xillybus/xillybus_pcie.c
index 02c15952b103..18b0c392bc93 100644
--- a/drivers/char/xillybus/xillybus_pcie.c
+++ b/drivers/char/xillybus/xillybus_pcie.c
@@ -9,7 +9,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include "xillybus.h"
 
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h 
b/drivers/net/ethernet/intel/e1000e/e1000.h
index 34cd67951aec..6c51b1bad8c4 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 0b668357db4d..57e8aea98969 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/ethernet/realtek/r8169_main.c 
b/drivers/net/ethernet/realtek/r8169_main.c
index e1dd6ea60d67..a8f373e49505 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/net/wireless/ath/ath5k/pci.c 
b/drivers/net/wireless/ath/ath5k/pci.c
index c6156cc38940..d5ee32ce9eb3 100644
--- a/drivers/net/wireless/ath/ath5k/pci.c
+++ b/drivers/net/wireless/ath/ath5k/pci.c
@@ -18,7 +18,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "../ath.h"
diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c 
b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
index b82da75a9ae3..4fbcc7fba3cc 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c 
b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
index fa2c02881939..ffb705b18fb1 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index f5df5b370d78..4c308e33ee21 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -62,7 +62,6 @@
  *
  */
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 45049f558860..dd520fe927db 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index e44af7f4d37f..ad6259ec51a6 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "../pci.h"
 
 #ifdef MODULE_PARAM_PREFIX
diff --git a/drivers/pci/quirks.c b/drivers/p

[PATCH 1/3] PCI/ACPI: Rename ACPI Hot Plug structs for Type 0, 1 and 2 from _HPP to _HPX

2019-08-27 Thread Krzysztof Wilczynski
The name of the following structs suggests that these are related to the
_HPP record type, whereas these are related to _HPX, not _HPP, that is
the structs hpp_type0, hpp_type1 and hpp_type2.

The struct hpp_type0 denotes an _HPX Type 0 setting record that supersedes
the _HPP setting record type, and has been used interchangeably for _HPP
as per the ACPI specification (see version 6.3, section 6.2.9.1) which
states that it should be applied to PCI, PCI-X and PCI Express devices,
with settings being ignored if they are not applicable.  There aren't any
Type 1 and Type 2 setting record types in _HPP, therefore structs hpp_type1
and hpp_type2 are renamed to reflect their relation to _HPX rather than
_HPP.

Any relevant variable names, structs and function names, etc., have been
updated to reflect the name change of the A CPI Hot Plug structs.

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/pci-acpi.c  | 28 +++
 drivers/pci/probe.c | 72 ++---
 include/linux/pci_hotplug.h | 30 
 3 files changed, 64 insertions(+), 66 deletions(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 45049f558860..02addc47edae 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -119,7 +119,7 @@ phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)
 }
 
 static acpi_status decode_type0_hpx_record(union acpi_object *record,
-  struct hpp_type0 *hpx0)
+  struct hpx_type0 *hpx0)
 {
int i;
union acpi_object *fields = record->package.elements;
@@ -147,7 +147,7 @@ static acpi_status decode_type0_hpx_record(union 
acpi_object *record,
 }
 
 static acpi_status decode_type1_hpx_record(union acpi_object *record,
-  struct hpp_type1 *hpx1)
+  struct hpx_type1 *hpx1)
 {
int i;
union acpi_object *fields = record->package.elements;
@@ -174,7 +174,7 @@ static acpi_status decode_type1_hpx_record(union 
acpi_object *record,
 }
 
 static acpi_status decode_type2_hpx_record(union acpi_object *record,
-  struct hpp_type2 *hpx2)
+  struct hpx_type2 *hpx2)
 {
int i;
union acpi_object *fields = record->package.elements;
@@ -277,9 +277,9 @@ static acpi_status acpi_run_hpx(struct pci_dev *dev, 
acpi_handle handle,
acpi_status status;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
union acpi_object *package, *record, *fields;
-   struct hpp_type0 hpx0;
-   struct hpp_type1 hpx1;
-   struct hpp_type2 hpx2;
+   struct hpx_type0 hpx0;
+   struct hpx_type1 hpx1;
+   struct hpx_type2 hpx2;
u32 type;
int i;
 
@@ -353,10 +353,10 @@ static acpi_status acpi_run_hpp(struct pci_dev *dev, 
acpi_handle handle,
acpi_status status;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *package, *fields;
-   struct hpp_type0 hpp0;
+   struct hpx_type0 hpx0;
int i;
 
-   memset(, 0, sizeof(hpp0));
+   memset(, 0, sizeof(hpx0));
 
status = acpi_evaluate_object(handle, "_HPP", NULL, );
if (ACPI_FAILURE(status))
@@ -377,13 +377,13 @@ static acpi_status acpi_run_hpp(struct pci_dev *dev, 
acpi_handle handle,
}
}
 
-   hpp0.revision= 1;
-   hpp0.cache_line_size = fields[0].integer.value;
-   hpp0.latency_timer   = fields[1].integer.value;
-   hpp0.enable_serr = fields[2].integer.value;
-   hpp0.enable_perr = fields[3].integer.value;
+   hpx0.revision= 1;
+   hpx0.cache_line_size = fields[0].integer.value;
+   hpx0.latency_timer   = fields[1].integer.value;
+   hpx0.enable_serr = fields[2].integer.value;
+   hpx0.enable_perr = fields[3].integer.value;
 
-   hp_ops->program_type0(dev, );
+   hp_ops->program_type0(dev, );
 
 exit:
kfree(buffer.pointer);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index dbeeb385fb9f..33dae8f5e73e 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1915,7 +1915,7 @@ static void pci_configure_mps(struct pci_dev *dev)
 p_mps, mps, mpss);
 }
 
-static struct hpp_type0 pci_default_type0 = {
+static struct hpx_type0 pci_default_type0 = {
.revision = 1,
.cache_line_size = 8,
.latency_timer = 0x40,
@@ -1923,44 +1923,44 @@ static struct hpp_type0 pci_default_type0 = {
.enable_perr = 0,
 };
 
-static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp)
+static void program_hpx_type0(struct pci_dev *dev, struct hpx_type0 *hpx)
 {
u16 pci_cmd, pci_bctl;
 
-   if (!hpp)
-   hpp = _default_type0;
+   if (!hpx)
+   hpx = _default_type0;
 
-   

[PATCH 2/3] PCI/ACPI: Move ACPI-specific Hot Plug programming functions to pci-acpi.c

2019-08-27 Thread Krzysztof Wilczynski
Move functions program_hpx_type0(), program_hpx_type1(), etc.,
from drivers/pci/probe.c to drivers/pci/pci-acpi.c, and enums
hpx_type3_dev_type, hpx_type3_fn_type and hpx_type3_cfg_loc to
drivers/pci/pci-acpi.c as these functions and enums are
ACPI-specific.

Then move structs hpx_type0, hpx_type1, hpx_type2 and hpx_type3 to
drivers/pci/pci.h as these are shared between drivers/pci/pci-acpi.c
and drivers/pci/probe.c.

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/pci-acpi.c  | 296 
 drivers/pci/pci.h   |  79 ++
 drivers/pci/probe.c | 269 
 include/linux/pci_hotplug.h | 100 
 4 files changed, 375 insertions(+), 369 deletions(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 02addc47edae..0bfabb3f9931 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -118,6 +118,47 @@ phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)
return (phys_addr_t)mcfg_addr;
 }
 
+static struct hpx_type0 pci_default_type0 = {
+   .revision = 1,
+   .cache_line_size = 8,
+   .latency_timer = 0x40,
+   .enable_serr = 0,
+   .enable_perr = 0,
+};
+
+void program_hpx_type0(struct pci_dev *dev, struct hpx_type0 *hpx)
+{
+   u16 pci_cmd, pci_bctl;
+
+   if (!hpx)
+   hpx = _default_type0;
+
+   if (hpx->revision > 1) {
+   pci_warn(dev, "PCI settings rev %d not supported; using 
defaults\n",
+hpx->revision);
+   hpx = _default_type0;
+   }
+
+   pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, hpx->cache_line_size);
+   pci_write_config_byte(dev, PCI_LATENCY_TIMER, hpx->latency_timer);
+   pci_read_config_word(dev, PCI_COMMAND, _cmd);
+   if (hpx->enable_serr)
+   pci_cmd |= PCI_COMMAND_SERR;
+   if (hpx->enable_perr)
+   pci_cmd |= PCI_COMMAND_PARITY;
+   pci_write_config_word(dev, PCI_COMMAND, pci_cmd);
+
+   /* Program bridge control value */
+   if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
+   pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER,
+ hpx->latency_timer);
+   pci_read_config_word(dev, PCI_BRIDGE_CONTROL, _bctl);
+   if (hpx->enable_perr)
+   pci_bctl |= PCI_BRIDGE_CTL_PARITY;
+   pci_write_config_word(dev, PCI_BRIDGE_CONTROL, pci_bctl);
+   }
+}
+
 static acpi_status decode_type0_hpx_record(union acpi_object *record,
   struct hpx_type0 *hpx0)
 {
@@ -146,6 +187,20 @@ static acpi_status decode_type0_hpx_record(union 
acpi_object *record,
return AE_OK;
 }
 
+void program_hpx_type1(struct pci_dev *dev, struct hpx_type1 *hpx)
+{
+   int pos;
+
+   if (!hpx)
+   return;
+
+   pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
+   if (!pos)
+   return;
+
+   pci_warn(dev, "PCI-X settings not supported\n");
+}
+
 static acpi_status decode_type1_hpx_record(union acpi_object *record,
   struct hpx_type1 *hpx1)
 {
@@ -173,6 +228,107 @@ static acpi_status decode_type1_hpx_record(union 
acpi_object *record,
return AE_OK;
 }
 
+static bool pcie_root_rcb_set(struct pci_dev *dev)
+{
+   struct pci_dev *rp = pcie_find_root_port(dev);
+   u16 lnkctl;
+
+   if (!rp)
+   return false;
+
+   pcie_capability_read_word(rp, PCI_EXP_LNKCTL, );
+   if (lnkctl & PCI_EXP_LNKCTL_RCB)
+   return true;
+
+   return false;
+}
+
+void program_hpx_type2(struct pci_dev *dev, struct hpx_type2 *hpx)
+{
+   int pos;
+   u32 reg32;
+
+   if (!hpx)
+   return;
+
+   if (!pci_is_pcie(dev))
+   return;
+
+   if (hpx->revision > 1) {
+   pci_warn(dev, "PCIe settings rev %d not supported\n",
+hpx->revision);
+   return;
+   }
+
+   /*
+* Don't allow _HPX to change MPS or MRRS settings.  We manage
+* those to make sure they're consistent with the rest of the
+* platform.
+*/
+   hpx->pci_exp_devctl_and |= PCI_EXP_DEVCTL_PAYLOAD |
+   PCI_EXP_DEVCTL_READRQ;
+   hpx->pci_exp_devctl_or &= ~(PCI_EXP_DEVCTL_PAYLOAD |
+   PCI_EXP_DEVCTL_READRQ);
+
+   /* Initialize Device Control Register */
+   pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
+   ~hpx->pci_exp_devctl_and, hpx->pci_exp_devctl_or);
+
+   /* Initialize Link Control Register */
+   if (pcie_cap_has_lnkctl(dev)) {
+
+   /*
+* If the Root Port supports Read Completion Boundary of
+* 128, set RCB to 128.  Otherwi

[PATCH 0/3] PCI/ACPI: Rename _HPP to _HPX and move of ACPI-specific code from probe.c

2019-08-27 Thread Krzysztof Wilczynski
This series of patches moves the ACPI-specific code currently included
as part of the drivers/pci/probe.c. First, the ACPI Hot Plug structs
for Type 0, 1 and 2, and any relevant variable names, structs, function
names, etc., will have their names changed to reflect that these are
related to _HPX rather than _HPP.  Second, all of the ACPI-specific
code will be moved to drivers/pci/pci-acpi.c for better organisation
and to keep ACPI-related code base together.  Third, remove the
now obsolete struct hotplug_program_ops from drivers/pci/pci-acpi.c.

Patches should be preferably merged in order as they build upon
one-another.

Related:
  https://lore.kernel.org/lkml/20190419220220.gi173...@google.com
  https://lore.kernel.org/lkml/20190307213834.5914-3-mr.nuke...@gmail.com
  https://lore.kernel.org/lkml/20190307213834.5914-2-mr.nuke...@gmail.com

Krzysztof Wilczynski (3):
  PCI/ACPI: Rename ACPI Hot Plug structs for Type 0, 1 and 2 from _HPP
to _HPX
  PCI/ACPI: Move ACPI-specific Hot Plug programming functions to
pci-acpi.c
  PCI/ACPI: Remove unnecessary struct hotplug_program_ops from
pci-acpi.c

 drivers/pci/pci-acpi.c  | 410 +---
 drivers/pci/pci.h   |   9 +
 drivers/pci/probe.c | 278 +---
 include/linux/pci_hotplug.h | 100 -
 4 files changed, 389 insertions(+), 408 deletions(-)

-- 
2.22.1



[PATCH 3/3] PCI/ACPI: Remove unnecessary struct hotplug_program_ops from pci-acpi.c

2019-08-27 Thread Krzysztof Wilczynski
Move the ACPI-specific structs hpx_type0, hpx_type1, hpx_type2 and
hpx_type3 to drivers/pci/pci-acpi.c as they are not used anywhere
else.  Then remove the struct hotplug_program_ops that has been
shared between drivers/pci/probe.c and drivers/pci/pci-acpi.c
from drivers/pci/pci.h as it is no longer needed.

The struct hotplug_program_ops was introduced in the commit 87fcf12e846a
("PCI/ACPI: Remove the need for 'struct hotplug_params'") and replaced
previously used struct hotplug_params enabling the support for the _HPX
Type 3 Setting Record that has been added in the commit f873c51a155a
("PCI/ACPI: Implement _HPX Type 3 Setting Record").

The new struct allowed for the static functions such program_hpx_type0(),
program_hpx_type1(), etc., from the drivers/pci/probe.c to be called from
the function pci_acpi_program_hp_params() in the drivers/pci/pci-acpi.c.

Currently, a programming of _HPX Type 0 would be as follows:

drivers/pci/probe.c:

  program_hpx_type0()
  ...
  pci_configure_device()
hp_ops = {
  .program_type0 = program_hpx_type0,
  ...
}
pci_acpi_program_hp_params(_ops)

drivers/pci/pci-acpi.c:

  pci_acpi_program_hp_params(_ops)
acpi_run_hpx(hp_ops)
  decode_type0_hpx_record()
hp_ops->program_type0 # program_hpx_type0() called via hp_ops

After the ACPI-specific functions, structs, enums, etc., have been
moved to drivers/pci/pci-acpi.c there will be no need to keep using
the struct hotplug_program_ops as all of the _HPX Type 0, 1, 2 and 3
would be directly accessible.

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/pci-acpi.c | 96 --
 drivers/pci/pci.h  | 74 +---
 drivers/pci/probe.c|  9 +---
 3 files changed, 77 insertions(+), 102 deletions(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 0bfabb3f9931..c476b9ed009e 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -118,6 +118,15 @@ phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)
return (phys_addr_t)mcfg_addr;
 }
 
+/* _HPX PCI Setting Record (Type 0) */
+struct hpx_type0 {
+   u32 revision; /* Not present in _HPP */
+   u8  cache_line_size; /* Not applicable to PCI Express */
+   u8  latency_timer;   /* Not applicable to PCI Express */
+   u8  enable_serr;
+   u8  enable_perr;
+};
+
 static struct hpx_type0 pci_default_type0 = {
.revision = 1,
.cache_line_size = 8,
@@ -126,7 +135,7 @@ static struct hpx_type0 pci_default_type0 = {
.enable_perr = 0,
 };
 
-void program_hpx_type0(struct pci_dev *dev, struct hpx_type0 *hpx)
+static void program_hpx_type0(struct pci_dev *dev, struct hpx_type0 *hpx)
 {
u16 pci_cmd, pci_bctl;
 
@@ -187,7 +196,15 @@ static acpi_status decode_type0_hpx_record(union 
acpi_object *record,
return AE_OK;
 }
 
-void program_hpx_type1(struct pci_dev *dev, struct hpx_type1 *hpx)
+/* _HPX PCI-X Setting Record (Type 1) */
+struct hpx_type1 {
+   u32 revision;
+   u8  max_mem_read;
+   u8  avg_max_split;
+   u16 tot_max_split;
+};
+
+static void program_hpx_type1(struct pci_dev *dev, struct hpx_type1 *hpx)
 {
int pos;
 
@@ -243,7 +260,28 @@ static bool pcie_root_rcb_set(struct pci_dev *dev)
return false;
 }
 
-void program_hpx_type2(struct pci_dev *dev, struct hpx_type2 *hpx)
+/* _HPX PCI Express Setting Record (Type 2) */
+struct hpx_type2 {
+   u32 revision;
+   u32 unc_err_mask_and;
+   u32 unc_err_mask_or;
+   u32 unc_err_sever_and;
+   u32 unc_err_sever_or;
+   u32 cor_err_mask_and;
+   u32 cor_err_mask_or;
+   u32 adv_err_cap_and;
+   u32 adv_err_cap_or;
+   u16 pci_exp_devctl_and;
+   u16 pci_exp_devctl_or;
+   u16 pci_exp_lnkctl_and;
+   u16 pci_exp_lnkctl_or;
+   u32 sec_unc_err_sever_and;
+   u32 sec_unc_err_sever_or;
+   u32 sec_unc_err_mask_and;
+   u32 sec_unc_err_mask_or;
+};
+
+static void program_hpx_type2(struct pci_dev *dev, struct hpx_type2 *hpx)
 {
int pos;
u32 reg32;
@@ -369,6 +407,24 @@ static acpi_status decode_type2_hpx_record(union 
acpi_object *record,
return AE_OK;
 }
 
+/* _HPX PCI Express Setting Record (Type 3) */
+struct hpx_type3 {
+   u16 device_type;
+   u16 function_type;
+   u16 config_space_location;
+   u16 pci_exp_cap_id;
+   u16 pci_exp_cap_ver;
+   u16 pci_exp_vendor_id;
+   u16 dvsec_id;
+   u16 dvsec_rev;
+   u16 match_offset;
+   u32 match_mask_and;
+   u32 match_value;
+   u16 reg_offset;
+   u32 reg_mask_and;
+   u32 reg_mask_or;
+};
+
 enum hpx_type3_dev_type {
HPX_TYPE_ENDPOINT   = BIT(0),
HPX_TYPE_LEG_END= BIT(1),
@@ -498,7 +554,7 @@ static void program_hpx_type3_register(struct pci_dev *dev,
pos, orig_value, write_reg);
 }
 
-void program_hpx_type3(struct pci_dev *dev, struct hpx_type3 *hpx)
+static

[PATCH] PCI: hv: Make functions only used locally static in pci-hyperv.c

2019-08-26 Thread Krzysztof Wilczynski
Functions hv_read_config_block(), hv_write_config_block()
and hv_register_block_invalidate() are not used anywhere
else and are local to drivers/pci/controller/pci-hyperv.c,
and do not need to be in global scope, so make these static.

Resolve compiler warning that can be seen when building with
warnings enabled (W=1).

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/controller/pci-hyperv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-hyperv.c 
b/drivers/pci/controller/pci-hyperv.c
index f1f300218fab..c9642e429c2d 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -930,7 +930,7 @@ static void hv_pci_read_config_compl(void *context, struct 
pci_response *resp,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_read_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
+static int hv_read_config_block(struct pci_dev *pdev, void *buf, unsigned int 
len,
 unsigned int block_id, unsigned int *bytes_returned)
 {
struct hv_pcibus_device *hbus =
@@ -1010,7 +1010,7 @@ static void hv_pci_write_config_compl(void *context, 
struct pci_response *resp,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_write_config_block(struct pci_dev *pdev, void *buf, unsigned int len,
+static int hv_write_config_block(struct pci_dev *pdev, void *buf, unsigned int 
len,
  unsigned int block_id)
 {
struct hv_pcibus_device *hbus =
@@ -1079,7 +1079,7 @@ int hv_write_config_block(struct pci_dev *pdev, void 
*buf, unsigned int len,
  *
  * Return: 0 on success, -errno on failure
  */
-int hv_register_block_invalidate(struct pci_dev *pdev, void *context,
+static int hv_register_block_invalidate(struct pci_dev *pdev, void *context,
 void (*block_invalidate)(void *context,
  u64 block_mask))
 {
-- 
2.22.1



[PATCH] PCI: Move static keyword to the front of declarations in pci-bridge-emul.c

2019-08-26 Thread Krzysztof Wilczynski
Move the static keyword to the front of declarations of
pci_regs_behavior and pcie_cap_regs_behavior, and resolve
compiler warning that can be seen when building with
warnings enabled (W=1).

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/pci-bridge-emul.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c
index 06083b86d4f4..5fd90105510d 100644
--- a/drivers/pci/pci-bridge-emul.c
+++ b/drivers/pci/pci-bridge-emul.c
@@ -38,7 +38,7 @@ struct pci_bridge_reg_behavior {
u32 rsvd;
 };
 
-const static struct pci_bridge_reg_behavior pci_regs_behavior[] = {
+static const struct pci_bridge_reg_behavior pci_regs_behavior[] = {
[PCI_VENDOR_ID / 4] = { .ro = ~0 },
[PCI_COMMAND / 4] = {
.rw = (PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
@@ -173,7 +173,7 @@ const static struct pci_bridge_reg_behavior 
pci_regs_behavior[] = {
},
 };
 
-const static struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
+static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
[PCI_CAP_LIST_ID / 4] = {
/*
 * Capability ID, Next Capability Pointer and
-- 
2.22.1



[PATCH] PCI: hotplug: Remove surplus return from a void function

2019-08-26 Thread Krzysztof Wilczynski
Remove unnecessary empty return statement at the end of a void
function in the following:

  - drivers/pci/hotplug/cpci_hotplug_core.c: cleanup_slots()
  - drivers/pci/hotplug/cpqphp_core.c: pci_print_IRQ_route()
  - drivers/pci/hotplug/cpqphp_ctrl.c: cpqhp_pushbutton_thread()
  - drivers/pci/hotplug/cpqphp_ctrl.c: interrupt_event_handler()
  - drivers/pci/hotplug/cpqphp_nvram.h: compaq_nvram_init()
  - drivers/pci/hotplug/rpadlpar_core.c: rpadlpar_io_init()
  - drivers/pci/hotplug/rpaphp_core.c: cleanup_slots()

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/hotplug/cpci_hotplug_core.c | 1 -
 drivers/pci/hotplug/cpqphp_core.c   | 1 -
 drivers/pci/hotplug/cpqphp_ctrl.c   | 4 
 drivers/pci/hotplug/cpqphp_nvram.h  | 5 +
 drivers/pci/hotplug/rpadlpar_core.c | 1 -
 drivers/pci/hotplug/rpaphp_core.c   | 1 -
 6 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c 
b/drivers/pci/hotplug/cpci_hotplug_core.c
index 603eadf3d965..d0559d2faf50 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -563,7 +563,6 @@ cleanup_slots(void)
}
 cleanup_null:
up_write(_rwsem);
-   return;
 }
 
 int
diff --git a/drivers/pci/hotplug/cpqphp_core.c 
b/drivers/pci/hotplug/cpqphp_core.c
index 16bbb183695a..b8aacb41a83c 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -173,7 +173,6 @@ static void pci_print_IRQ_route(void)
dbg("%d %d %d %d\n", tbus, tdevice >> 3, tdevice & 0x7, tslot);
 
}
-   return;
 }
 
 
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c 
b/drivers/pci/hotplug/cpqphp_ctrl.c
index b7f4e1f099d9..68de958a9be8 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1872,8 +1872,6 @@ static void interrupt_event_handler(struct controller 
*ctrl)
}
}   /* End of FOR loop */
}
-
-   return;
 }
 
 
@@ -1943,8 +1941,6 @@ void cpqhp_pushbutton_thread(struct timer_list *t)
 
p_slot->state = STATIC_STATE;
}
-
-   return;
 }
 
 
diff --git a/drivers/pci/hotplug/cpqphp_nvram.h 
b/drivers/pci/hotplug/cpqphp_nvram.h
index 918ff8dbfe62..70e879b6a23f 100644
--- a/drivers/pci/hotplug/cpqphp_nvram.h
+++ b/drivers/pci/hotplug/cpqphp_nvram.h
@@ -16,10 +16,7 @@
 
 #ifndef CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM
 
-static inline void compaq_nvram_init(void __iomem *rom_start)
-{
-   return;
-}
+static inline void compaq_nvram_init(void __iomem *rom_start) { }
 
 static inline int compaq_nvram_load(void __iomem *rom_start, struct controller 
*ctrl)
 {
diff --git a/drivers/pci/hotplug/rpadlpar_core.c 
b/drivers/pci/hotplug/rpadlpar_core.c
index 182f9e3443ee..977946e4e613 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -473,7 +473,6 @@ int __init rpadlpar_io_init(void)
 void rpadlpar_io_exit(void)
 {
dlpar_sysfs_exit();
-   return;
 }
 
 module_init(rpadlpar_io_init);
diff --git a/drivers/pci/hotplug/rpaphp_core.c 
b/drivers/pci/hotplug/rpaphp_core.c
index c3899ee1db99..18627bb21e9e 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -408,7 +408,6 @@ static void __exit cleanup_slots(void)
pci_hp_deregister(>hotplug_slot);
dealloc_slot_struct(slot);
}
-   return;
 }
 
 static int __init rpaphp_init(void)
-- 
2.22.1



[PATCH] PCI: Remove the use of printk_ratelimit() in pci.c

2019-08-25 Thread Krzysztof Wilczynski
Do not use printk_ratelimit() in drivers/pci/pci.c as it shares the
rate limiting state with all other callers to the printk_ratelimit().

Add pci_info_ratelimited macro similar to pci_notice_ratelimited
added in the commit a88a7b3eb076 ("vfio: Use dev_printk() when
possible") and use it instead of pr_info inside the if-statement.

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/pci.c   | 4 ++--
 include/linux/pci.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index f20a3de57d21..e3d190d003c5 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -890,8 +890,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, 
pci_power_t state)
 
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, );
dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
-   if (dev->current_state != state && printk_ratelimit())
-   pci_info(dev, "Refused to change power state, currently in 
D%d\n",
+   if (dev->current_state != state)
+   pci_info_ratelimited(dev, "Refused to change power state, 
currently in D%d\n",
 dev->current_state);
 
/*
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 463486016290..73ce8d908322 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2367,4 +2367,7 @@ void pci_uevent_ers(struct pci_dev *pdev, enum  
pci_ers_result err_type);
 #define pci_notice_ratelimited(pdev, fmt, arg...) \
dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg)
 
+#define pci_info_ratelimited(pdev, fmt, arg...) \
+   dev_info_ratelimited(&(pdev)->dev, fmt, ##arg)
+
 #endif /* LINUX_PCI_H */
-- 
2.22.1



[PATCH] PCI: mediatek: Remove surplus return from a void function

2019-08-25 Thread Krzysztof Wilczynski
Remove unnecessary empty return statement at the
end of a void function mtk_pcie_intr_handler() in
the drivers/pci/controller/pcie-mediatek.c.

The surplus return statement was added as part of
the work in commit 42fe2f91b4eb ("PCI: mediatek:
Implement chained IRQ handling setup").

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/pci/controller/pcie-mediatek.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-mediatek.c 
b/drivers/pci/controller/pcie-mediatek.c
index 3eaa7081ab2a..626a7c352dfd 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -635,8 +635,6 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
}
 
chained_irq_exit(irqchip, desc);
-
-   return;
 }
 
 static int mtk_pcie_setup_irq(struct mtk_pcie_port *port,
-- 
2.22.1



[PATCH] x86/PCI: Add missing log facility and move to use pr_ macros in pcbios.c

2019-08-25 Thread Krzysztof Wilczynski
Make the log facility used to print warnings to be KERN_WARNING
explicitly, rather than rely on the current (or default) value
of the MESSAGE_LOGLEVEL_DEFAULT set in Kconfig.  This will make
all the warnings in the arch/x86/pci/pcbios.c to be printed
consistently at the same log facility.

Replace printk(KERN_ ...) with corresponding pr_ macros,
while adding the missing log facility.

Signed-off-by: Krzysztof Wilczynski 
---
 arch/x86/pci/pcbios.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index 9c97d814125e..0c3673f50bce 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -47,7 +47,7 @@ static inline void set_bios_x(void)
pcibios_enabled = 1;
set_memory_x(PAGE_OFFSET + BIOS_BEGIN, (BIOS_END - BIOS_BEGIN) >> 
PAGE_SHIFT);
if (__supported_pte_mask & _PAGE_NX)
-   printk(KERN_INFO "PCI: PCI BIOS area is rw and x. Use 
pci=nobios if you want it NX.\n");
+   pr_info("PCI: PCI BIOS area is rw and x. Use pci=nobios if you 
want it NX.\n");
 }
 
 /*
@@ -111,10 +111,10 @@ static unsigned long __init bios32_service(unsigned long 
service)
case 0:
return address + entry;
case 0x80:  /* Not present */
-   printk(KERN_WARNING "bios32_service(0x%lx): not 
present\n", service);
+   pr_warn("bios32_service(0x%lx): not present\n", 
service);
return 0;
default: /* Shouldn't happen */
-   printk(KERN_WARNING "bios32_service(0x%lx): returned 
0x%x -- BIOS bug!\n",
+   pr_warn("bios32_service(0x%lx): returned 0x%x -- BIOS 
bug!\n",
service, return_code);
return 0;
}
@@ -163,11 +163,11 @@ static int __init check_pcibios(void)
DBG("PCI: BIOS probe returned s=%02x hw=%02x ver=%02x.%02x 
l=%02x\n",
status, hw_mech, major_ver, minor_ver, 
pcibios_last_bus);
if (status || signature != PCI_SIGNATURE) {
-   printk (KERN_ERR "PCI: BIOS BUG #%x[%08x] found\n",
+   pr_err("PCI: BIOS BUG #%x[%08x] found\n",
status, signature);
return 0;
}
-   printk(KERN_INFO "PCI: PCI BIOS revision %x.%02x entry at 
0x%lx, last bus=%d\n",
+   pr_info("PCI: PCI BIOS revision %x.%02x entry at 0x%lx, last 
bus=%d\n",
major_ver, minor_ver, pcibios_entry, pcibios_last_bus);
 #ifdef CONFIG_PCI_DIRECT
if (!(hw_mech & PCIBIOS_HW_TYPE1))
@@ -316,13 +316,13 @@ static const struct pci_raw_ops *__init 
pci_find_bios(void)
if (sum != 0)
continue;
if (check->fields.revision != 0) {
-   printk("PCI: unsupported BIOS32 revision %d at 0x%p\n",
+   pr_warn("PCI: unsupported BIOS32 revision %d at 0x%p\n",
check->fields.revision, check);
continue;
}
DBG("PCI: BIOS32 Service Directory structure at 0x%p\n", check);
if (check->fields.entry >= 0x10) {
-   printk("PCI: BIOS32 entry (0x%p) in high memory, "
+   pr_warn("PCI: BIOS32 entry (0x%p) in high memory, "
"cannot use.\n", check);
return NULL;
} else {
@@ -386,7 +386,7 @@ struct irq_routing_table * 
pcibios_get_irq_routing_table(void)
: "memory");
DBG("OK  ret=%d, size=%d, map=%x\n", ret, opt.size, map);
if (ret & 0xff00)
-   printk(KERN_ERR "PCI: Error %02x when fetching IRQ routing 
table.\n", (ret >> 8) & 0xff);
+   pr_err("PCI: Error %02x when fetching IRQ routing table.\n", 
(ret >> 8) & 0xff);
else if (opt.size) {
rt = kmalloc(sizeof(struct irq_routing_table) + opt.size, 
GFP_KERNEL);
if (rt) {
@@ -394,7 +394,7 @@ struct irq_routing_table * 
pcibios_get_irq_routing_table(void)
rt->size = opt.size + sizeof(struct irq_routing_table);
rt->exclusive_irqs = map;
memcpy(rt->slots, (void *) page, opt.size);
-   printk(KERN_INFO "PCI: Using BIOS Interrupt Routing 
Table\n");
+   pr_info("PCI: Using BIOS Interrupt Routing Table\n");
}
}
free_page(page);
-- 
2.22.1



[tip: x86/cleanups] x86/PCI: Remove superfluous returns from void functions

2019-08-22 Thread tip-bot2 for Krzysztof Wilczynski
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: f25896ebfe0cf818ebd1adb5e6a05dc40b820e45
Gitweb:
https://git.kernel.org/tip/f25896ebfe0cf818ebd1adb5e6a05dc40b820e45
Author:Krzysztof Wilczynski 
AuthorDate:Tue, 20 Aug 2019 08:51:21 +02:00
Committer: Borislav Petkov 
CommitterDate: Tue, 20 Aug 2019 09:54:36 +02:00

x86/PCI: Remove superfluous returns from void functions

Remove unnecessary empty return statements at the end of void functions
in arch/x86/kernel/quirks.c.

Signed-off-by: Krzysztof Wilczynski 
Signed-off-by: Borislav Petkov 
Cc: Bjorn Helgaas 
Cc: "H. Peter Anvin" 
Cc: Ingo Molnar 
Cc: linux-...@vger.kernel.org
Cc: Thomas Gleixner 
Cc: x86-ml 
Link: https://lkml.kernel.org/r/20190820065121.16594-1...@linux.com
---
 arch/x86/kernel/quirks.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 8451f38..1daf8f2 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -90,8 +90,6 @@ static void ich_force_hpet_resume(void)
BUG();
else
printk(KERN_DEBUG "Force enabled HPET at resume\n");
-
-   return;
 }
 
 static void ich_force_enable_hpet(struct pci_dev *dev)
@@ -448,7 +446,6 @@ static void nvidia_force_enable_hpet(struct pci_dev *dev)
dev_printk(KERN_DEBUG, >dev, "Force enabled HPET at 0x%lx\n",
force_hpet_address);
cached_dev = dev;
-   return;
 }
 
 /* ISA Bridges */
@@ -513,7 +510,6 @@ static void e6xx_force_enable_hpet(struct pci_dev *dev)
force_hpet_resume_type = NONE_FORCE_HPET_RESUME;
dev_printk(KERN_DEBUG, >dev, "Force enabled HPET at "
"0x%lx\n", force_hpet_address);
-   return;
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E6XX_CU,
 e6xx_force_enable_hpet);


[PATCH] x86/PCI: Remove surplus return from a void function

2019-08-20 Thread Krzysztof Wilczynski
Remove unnecessary empty return statement at the end of a void
function in the arch/x86/kernel/quirks.c.

Signed-off-by: Krzysztof Wilczynski 
---
 arch/x86/kernel/quirks.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 8451f38ad399..1daf8f2aa21f 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -90,8 +90,6 @@ static void ich_force_hpet_resume(void)
BUG();
else
printk(KERN_DEBUG "Force enabled HPET at resume\n");
-
-   return;
 }
 
 static void ich_force_enable_hpet(struct pci_dev *dev)
@@ -448,7 +446,6 @@ static void nvidia_force_enable_hpet(struct pci_dev *dev)
dev_printk(KERN_DEBUG, >dev, "Force enabled HPET at 0x%lx\n",
force_hpet_address);
cached_dev = dev;
-   return;
 }
 
 /* ISA Bridges */
@@ -513,7 +510,6 @@ static void e6xx_force_enable_hpet(struct pci_dev *dev)
force_hpet_resume_type = NONE_FORCE_HPET_RESUME;
dev_printk(KERN_DEBUG, >dev, "Force enabled HPET at "
"0x%lx\n", force_hpet_address);
-   return;
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E6XX_CU,
 e6xx_force_enable_hpet);
-- 
2.22.1



[PATCH] ACPI/PCI: Remove surplus parentheses from a return statement

2019-08-19 Thread Krzysztof Wilczynski
Remove unnecessary parentheses enclosing the value in a return
statement in the drivers/acpi/pci_link.c.

Signed-off-by: Krzysztof Wilczynski 
---
 drivers/acpi/pci_link.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index db11f7771ef1..00a6da2121be 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -661,7 +661,7 @@ int acpi_pci_link_allocate_irq(acpi_handle handle, int 
index, int *triggering,
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  "Link %s is referenced\n",
  acpi_device_bid(link->device)));
-   return (link->irq.active);
+   return link->irq.active;
 }
 
 /*
@@ -712,7 +712,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL);
 
mutex_unlock(_link_lock);
-   return (link->irq.active);
+   return link->irq.active;
 }
 
 /* --
-- 
2.22.1



[PATCH] PCI: Fix misspelled words.

2019-08-19 Thread Krzysztof Wilczynski
Fix misspelled words in include/linux/pci.h, drivers/pci/Kconfig,
and in the documentation for Freescale i.MX6 and Marvell Armada 7K/8K
PCIe interfaces.  No functional change intended.

Related commit 96291d565550 ("PCI: Fix typos and whitespace errors").

Signed-off-by: Krzysztof Wilczynski 
---
 Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt | 2 +-
 Documentation/devicetree/bindings/pci/pci-armada8k.txt   | 2 +-
 drivers/pci/Kconfig  | 2 +-
 include/linux/pci.h  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt 
b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
index a7f5f5afa0e6..de4b2baf91e8 100644
--- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
@@ -50,7 +50,7 @@ Additional required properties for imx7d-pcie and imx8mq-pcie:
 - power-domains: Must be set to a phandle pointing to PCIE_PHY power domain
 - resets: Must contain phandles to PCIe-related reset lines exposed by SRC
   IP block
-- reset-names: Must contain the following entires:
+- reset-names: Must contain the following entries:
   - "pciephy"
   - "apps"
   - "turnoff"
diff --git a/Documentation/devicetree/bindings/pci/pci-armada8k.txt 
b/Documentation/devicetree/bindings/pci/pci-armada8k.txt
index 9e3fc15e1af8..1aaa09254001 100644
--- a/Documentation/devicetree/bindings/pci/pci-armada8k.txt
+++ b/Documentation/devicetree/bindings/pci/pci-armada8k.txt
@@ -11,7 +11,7 @@ Required properties:
 - reg-names:
- "ctrl" for the control register region
- "config" for the config space region
-- interrupts: Interrupt specifier for the PCIe controler
+- interrupts: Interrupt specifier for the PCIe controller
 - clocks: reference to the PCIe controller clocks
 - clock-names: mandatory if there is a second clock, in this case the
name must be "core" for the first clock and "reg" for the second
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 2ab92409210a..46f4912a370d 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -170,7 +170,7 @@ config PCI_P2PDMA
 
  Many PCIe root complexes do not support P2P transactions and
  it's hard to tell which support it at all, so at this time,
- P2P DMA transations must be between devices behind the same root
+ P2P DMA transactions must be between devices behind the same root
  port.
 
  If unsure, say N.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 463486016290..5a89854bd3cb 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -961,7 +961,7 @@ resource_size_t pcibios_align_resource(void *, const struct 
resource *,
resource_size_t,
resource_size_t);
 
-/* Weak but can be overriden by arch */
+/* Weak but can be overridden by arch */
 void pci_fixup_cardbus(struct pci_bus *);
 
 /* Generic PCI functions used internally */
-- 
2.22.0



[PATCH] x86/PCI: Add missing SPDX license header.

2019-08-19 Thread Krzysztof Wilczynski
Add the missing "SPDX-License-Identifier" license header to the
arch/x86/pci/numachip.c.  Use GPL-2.0 identifier derived using
the comment mentioning license from the top of the file.

Signed-off-by: Krzysztof Wilczynski 
---
 arch/x86/pci/numachip.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/pci/numachip.c b/arch/x86/pci/numachip.c
index 2e565e65c893..b73157e834e0 100644
--- a/arch/x86/pci/numachip.c
+++ b/arch/x86/pci/numachip.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
-- 
2.22.0



[PATCH] x86/PCI: Replace deprecated EXTRA_CFLAGS with ccflags-y.

2019-08-19 Thread Krzysztof Wilczynski
Update arch/x86/pci/Makefile replacing the deprecated EXTRA_CFLAGS
with the ccflags-y matching recommendation as per the section 3.7
"Compilation flags" of the "Linux Kernel Makefiles" (see:
Documentation/kbuild/makefiles.txt).

Signed-off-by: Krzysztof Wilczynski 
---
 arch/x86/pci/Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index c806b57d3f22..48bcada5cabe 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -24,6 +24,4 @@ obj-y += bus_numa.o
 obj-$(CONFIG_AMD_NB)   += amd_bus.o
 obj-$(CONFIG_PCI_CNB20LE_QUIRK)+= broadcom_bus.o
 
-ifeq ($(CONFIG_PCI_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-$(CONFIG_PCI_DEBUG)+= -DDEBUG
-- 
2.22.0