Re: [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed

2020-06-16 Thread chentao (AS)

Ok, i will modify it in v2 patch.

On 2020/6/16 14:50, Christian König wrote:
Probably better to remove the duplication of result and r here and 
then use "goto err".


[PATCH -next] scsi: ufs-mediatek: Make ufs_mtk_fixup_dev_quirks static

2020-05-13 Thread ChenTao
Fix the following warning:

drivers/scsi/ufs/ufs-mediatek.c:585:6: warning:
symbol 'ufs_mtk_fixup_dev_quirks' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/scsi/ufs/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index c543142554d3..73e4a4f9a3a2 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -582,7 +582,7 @@ static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)
return 0;
 }
 
-void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
+static void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
 {
struct ufs_dev_info *dev_info = >dev_info;
u16 mid = dev_info->wmanufacturerid;
-- 
2.22.0



[PATCH -next] sfc: Make siena_check_caps static

2020-05-13 Thread ChenTao
Fix the following warning:

drivers/net/ethernet/sfc/siena.c:951:14: warning:
symbol 'siena_check_caps' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/net/ethernet/sfc/siena.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index ed1cb6caa69d..4b4afe81be2a 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -948,8 +948,8 @@ static int siena_mtd_probe(struct efx_nic *efx)
 
 #endif /* CONFIG_SFC_MTD */
 
-unsigned int siena_check_caps(const struct efx_nic *efx,
- u8 flag, u32 offset)
+static unsigned int siena_check_caps(const struct efx_nic *efx,
+u8 flag, u32 offset)
 {
/* Siena did not support MC_CMD_GET_CAPABILITIES */
return 0;
-- 
2.22.0



[PATCH -next v2] rtl8187: Remove unused variable rtl8225z2_tx_power_ofdm

2020-05-12 Thread ChenTao
Fix the following warning:

drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c:609:17: warning:
‘rtl8225z2_tx_power_ofdm’ defined but not used
 static const u8 rtl8225z2_tx_power_ofdm[] = {

Acked-by: Hin-Tak Leung 
Acked-by: Larry Finger 
Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
v1->v2:
- change the subject

 drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c 
b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
index b2616d61b66d..585784258c66 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
@@ -606,10 +606,6 @@ static const u8 rtl8225z2_tx_power_cck[] = {
0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
 };
 
-static const u8 rtl8225z2_tx_power_ofdm[] = {
-   0x42, 0x00, 0x40, 0x00, 0x40
-};
-
 static const u8 rtl8225z2_tx_gain_cck_ofdm[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
-- 
2.22.0



[PATCH -next v2] rtl8187: Remove unused variable rtl8225z2_tx_power_ofdm

2020-05-12 Thread ChenTao
Fix the following warning:

drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c:609:17: warning:
‘rtl8225z2_tx_power_ofdm’ defined but not used
 static const u8 rtl8225z2_tx_power_ofdm[] = {

Acked-by: Hin-Tak Leung 
Acked-by: Larry Finger 
Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c 
b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
index b2616d61b66d..585784258c66 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
@@ -606,10 +606,6 @@ static const u8 rtl8225z2_tx_power_cck[] = {
0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
 };
 
-static const u8 rtl8225z2_tx_power_ofdm[] = {
-   0x42, 0x00, 0x40, 0x00, 0x40
-};
-
 static const u8 rtl8225z2_tx_gain_cck_ofdm[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
-- 
2.22.0



Re: [PATCH -next] net/wireless/rtl8225: Remove unused variable rtl8225z2_tx_power_ofdm

2020-05-12 Thread chentao (AS)

Thanks, i will change it in v2.

On 2020/5/12 23:24, Larry Finger wrote:

On 5/12/20 6:14 AM, ChenTao wrote:

Fix the following warning:

drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c:609:17: warning:
‘rtl8225z2_tx_power_ofdm’ defined but not used
  static const u8 rtl8225z2_tx_power_ofdm[] = {

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 


The patch is OK, but the subject is wrong. It should be "[PATCH-next] 
rtl8187: Remove "


With that change, ACKed-by: Larry Finger 

Larry


[PATCH -next] net/wireless/rtl8225: Remove unused variable rtl8225z2_tx_power_ofdm

2020-05-12 Thread ChenTao
Fix the following warning:

drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c:609:17: warning:
‘rtl8225z2_tx_power_ofdm’ defined but not used
 static const u8 rtl8225z2_tx_power_ofdm[] = {

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c 
b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
index b2616d61b66d..585784258c66 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
@@ -606,10 +606,6 @@ static const u8 rtl8225z2_tx_power_cck[] = {
0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
 };
 
-static const u8 rtl8225z2_tx_power_ofdm[] = {
-   0x42, 0x00, 0x40, 0x00, 0x40
-};
-
 static const u8 rtl8225z2_tx_gain_cck_ofdm[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
-- 
2.22.0



[PATCH -next] drm/amd/dc: Remove a useless comparison

2020-05-07 Thread ChenTao
Fix the following warning:

'en' is uint32_t and can never be negative.

drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_hpd.c:132:10: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/hw_generic.c:109:10: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c | 2 +-
 drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c 
b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
index f9e847e6555d..6cd50232c432 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c
@@ -106,7 +106,7 @@ void dal_hw_generic_init(
enum gpio_id id,
uint32_t en)
 {
-   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
+   if (en > GPIO_DDC_LINE_MAX) {
ASSERT_CRITICAL(false);
*hw_generic = NULL;
}
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c 
b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
index 692f29de7797..f91f426699c0 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
@@ -129,7 +129,7 @@ void dal_hw_hpd_init(
enum gpio_id id,
uint32_t en)
 {
-   if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
+   if (en > GPIO_DDC_LINE_MAX) {
ASSERT_CRITICAL(false);
*hw_hpd = NULL;
}
-- 
2.22.0



[PATCH] input/misc/drv260x: Remove a useless comparison

2020-05-06 Thread ChenTao
Fix the following warning:

'mode' and 'library' are u32, they are never be negative,
DRV260X_LRA_MODE and DRV260X_LIB_EMPTY are 0x00, the comparison
is always false.

drivers/input/misc/drv260x.c:478:20: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (haptics->mode < DRV260X_LRA_MODE ||
drivers/input/misc/drv260x.c:490:23: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (haptics->library < DRV260X_LIB_EMPTY ||

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/input/misc/drv260x.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 79d7fa710a71..0078f742df5c 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -475,8 +475,7 @@ static int drv260x_probe(struct i2c_client *client,
return error;
}
 
-   if (haptics->mode < DRV260X_LRA_MODE ||
-   haptics->mode > DRV260X_ERM_MODE) {
+   if (haptics->mode > DRV260X_ERM_MODE) {
dev_err(dev, "Vibrator mode is invalid: %i\n", haptics->mode);
return -EINVAL;
}
@@ -487,8 +486,7 @@ static int drv260x_probe(struct i2c_client *client,
return error;
}
 
-   if (haptics->library < DRV260X_LIB_EMPTY ||
-   haptics->library > DRV260X_ERM_LIB_F) {
+   if (haptics->library > DRV260X_ERM_LIB_F) {
dev_err(dev,
"Library value is invalid: %i\n", haptics->library);
return -EINVAL;
-- 
2.22.0



[PATCH -next] soc: fsl_asrc: Make some functions static

2020-05-06 Thread ChenTao
Fix the following warning:

sound/soc/fsl/fsl_asrc.c:157:5: warning:
symbol 'fsl_asrc_request_pair' was not declared. Should it be static?
sound/soc/fsl/fsl_asrc.c:200:6: warning:
symbol 'fsl_asrc_release_pair' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 sound/soc/fsl/fsl_asrc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 067a54ab554f..432936039de4 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -154,7 +154,7 @@ static void fsl_asrc_sel_proc(int inrate, int outrate,
  * within range [ANCA, ANCA+ANCB-1], depends on the channels of pair A
  * while pair A and pair C are comparatively independent.
  */
-int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
+static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
 {
enum asrc_pair_index index = ASRC_INVALID_PAIR;
struct fsl_asrc *asrc = pair->asrc;
@@ -197,7 +197,7 @@ int fsl_asrc_request_pair(int channels, struct 
fsl_asrc_pair *pair)
  *
  * It clears the resource from asrc and releases the occupied channels.
  */
-void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
+static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
 {
struct fsl_asrc *asrc = pair->asrc;
enum asrc_pair_index index = pair->index;
-- 
2.22.0



[PATCH -next] power/supply/cw2015: Make some symbols static

2020-05-06 Thread ChenTao
Fix the following warning:

drivers/power/supply/cw2015_battery.c:96:5: warning:
'cw_update_profile' was not declared. Should it be static?
drivers/power/supply/cw2015_battery.c:712:1: warning:
'cw_bat_pm_ops' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/power/supply/cw2015_battery.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/cw2015_battery.c 
b/drivers/power/supply/cw2015_battery.c
index 8603da6f4593..19f62ea957ee 100644
--- a/drivers/power/supply/cw2015_battery.c
+++ b/drivers/power/supply/cw2015_battery.c
@@ -93,7 +93,7 @@ static int cw_read_word(struct cw_battery *cw_bat, u8 reg, 
u16 *val)
return 0;
 }
 
-int cw_update_profile(struct cw_battery *cw_bat)
+static int cw_update_profile(struct cw_battery *cw_bat)
 {
int ret;
unsigned int reg_val;
@@ -709,7 +709,7 @@ static int __maybe_unused cw_bat_resume(struct device *dev)
return 0;
 }
 
-SIMPLE_DEV_PM_OPS(cw_bat_pm_ops, cw_bat_suspend, cw_bat_resume);
+static SIMPLE_DEV_PM_OPS(cw_bat_pm_ops, cw_bat_suspend, cw_bat_resume);
 
 static int cw_bat_remove(struct i2c_client *client)
 {
-- 
2.22.0



[PATCH -next] net: enetc: Make some symbols static

2020-05-06 Thread ChenTao
Fix the following warning:

drivers/net/ethernet/freescale/enetc/enetc_qos.c:427:20: warning:
symbol 'enetc_act_fwd' was not declared. Should it be static?
drivers/net/ethernet/freescale/enetc/enetc_qos.c:966:20: warning:
symbol 'enetc_check_flow_actions' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/net/ethernet/freescale/enetc/enetc_qos.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c 
b/drivers/net/ethernet/freescale/enetc/enetc_qos.c
index 48e589e9d0f7..172acb602ccb 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c
@@ -424,7 +424,7 @@ struct enetc_psfp {
spinlock_t psfp_lock; /* spinlock for the struct enetc_psfp r/w */
 };
 
-struct actions_fwd enetc_act_fwd[] = {
+static struct actions_fwd enetc_act_fwd[] = {
{
BIT(FLOW_ACTION_GATE),
BIT(FLOW_DISSECTOR_KEY_ETH_ADDRS),
@@ -963,7 +963,8 @@ static int enetc_psfp_hw_set(struct enetc_ndev_priv *priv,
return err;
 }
 
-struct actions_fwd *enetc_check_flow_actions(u64 acts, unsigned int inputkeys)
+static struct actions_fwd *enetc_check_flow_actions(u64 acts,
+   unsigned int inputkeys)
 {
int i;
 
-- 
2.22.0



[PATCH -next] input/keyboard/qt1050: fix unsigned comparison with 0

2020-05-06 Thread ChenTao
Fixes warning because num is u32 and can never be negtative

drivers/input/keyboard/qt1050.c:371:18: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
   if (button.num < 0 || button.num > QT1050_MAX_KEYS - 1)

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/input/keyboard/qt1050.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c
index 403060d05c3b..a9ac99f62e39 100644
--- a/drivers/input/keyboard/qt1050.c
+++ b/drivers/input/keyboard/qt1050.c
@@ -368,7 +368,7 @@ static int qt1050_parse_fw(struct qt1050_priv *ts)
dev_err(dev, "Button without pad number\n");
goto err;
}
-   if (button.num < 0 || button.num > QT1050_MAX_KEYS - 1)
+   if (button.num > QT1050_MAX_KEYS - 1)
goto err;
 
ts->reg_keys |= BIT(button.num);
-- 
2.22.0



[PATCH -next] drm/amdgpu/navi10: fix unsigned comparison with 0

2020-05-05 Thread ChenTao
Fixes warning because size is uint32_t and can never be negtative

drivers/gpu/drm/amd/amdgpu/../powerplay/navi10_ppt.c:1296:12: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
   if (size < 0)

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c 
b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 2184d247a9f7..0c9be864d072 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -1293,8 +1293,6 @@ static int navi10_set_power_profile_mode(struct 
smu_context *smu, long *input, u
}
 
if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
-   if (size < 0)
-   return -EINVAL;
 
ret = smu_update_table(smu,
   SMU_TABLE_ACTIVITY_MONITOR_COEFF, 
WORKLOAD_PPLIB_CUSTOM_BIT,
-- 
2.22.0



[PATCH -next] drm/radeon: fix unsigned comparison with 0

2020-05-04 Thread ChenTao
Fixes warning because pipe is unsigned long and can never be negtative

vers/gpu/drm/radeon/radeon_kms.c:831:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (pipe < 0 || pipe >= rdev->num_crtc) {
drivers/gpu/drm/radeon/radeon_kms.c:857:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (pipe < 0 || pipe >= rdev->num_crtc) {

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
---
 drivers/gpu/drm/radeon/radeon_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 372962358a18..c5d1dc9618a4 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -828,7 +828,7 @@ int radeon_enable_vblank_kms(struct drm_crtc *crtc)
unsigned long irqflags;
int r;
 
-   if (pipe < 0 || pipe >= rdev->num_crtc) {
+   if (pipe >= rdev->num_crtc) {
DRM_ERROR("Invalid crtc %d\n", pipe);
return -EINVAL;
}
@@ -854,7 +854,7 @@ void radeon_disable_vblank_kms(struct drm_crtc *crtc)
struct radeon_device *rdev = dev->dev_private;
unsigned long irqflags;
 
-   if (pipe < 0 || pipe >= rdev->num_crtc) {
+   if (pipe >= rdev->num_crtc) {
DRM_ERROR("Invalid crtc %d\n", pipe);
return;
}
-- 
2.22.0



Re: [PATCH 1/1] interconnect: qcom: Move the static keyword to the front of declaration

2020-04-29 Thread chentao (AS)

Thank you for your review and modification!

On 2020/4/29 18:19, Georgi Djakov wrote:

From: ChenTao 

Fix the following warning:

Move the static keyword to the front of declaration of sdm845_icc_osm_l3
sdm845_aggre1_noc sc7180_icc_osm_l3 sdm845_aggre2_noc sdm845_config_noc
sdm845_dc_noc sdm845_gladiator_noc sdm845_mem_noc sdm845_mmss_noc and
sdm845_system_noc, resolve the following compiler warning that can be
when building with warnings enabled (W=1):

drivers/interconnect/qcom/osm-l3.c:81:1: warning:
  const static struct qcom_icc_desc sdm845_icc_osm_l3 = {
drivers/interconnect/qcom/osm-l3.c:94:1: warning:
  const static struct qcom_icc_desc sc7180_icc_osm_l3 = {
drivers/interconnect/qcom/sdm845.c:195:1: warning:
  const static struct qcom_icc_desc sdm845_aggre1_noc = {
drivers/interconnect/qcom/sdm845.c:223:1: warning:
  const static struct qcom_icc_desc sdm845_aggre2_noc = {
drivers/interconnect/qcom/sdm845.c:284:1: warning:
  const static struct qcom_icc_desc sdm845_config_noc = {
drivers/interconnect/qcom/sdm845.c:300:1: warning:
  const static struct qcom_icc_desc sdm845_dc_noc = {
drivers/interconnect/qcom/sdm845.c:318:1: warning:
  const static struct qcom_icc_desc sdm845_gladiator_noc = {
drivers/interconnect/qcom/sdm845.c:353:1: warning:
  const static struct qcom_icc_desc sdm845_mem_noc = {
drivers/interconnect/qcom/sdm845.c:387:1: warning:
  const static struct qcom_icc_desc sdm845_mmss_noc = {
drivers/interconnect/qcom/sdm845.c:433:1: warning:
  const static struct qcom_icc_desc sdm845_system_noc = {

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
Link: https://lore.kernel.org/r/20200423132142.45174-1-chentao...@huawei.com
Signed-off-by: Georgi Djakov 
---
  drivers/interconnect/qcom/osm-l3.c |  4 ++--
  drivers/interconnect/qcom/sdm845.c | 16 
  2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/interconnect/qcom/osm-l3.c 
b/drivers/interconnect/qcom/osm-l3.c
index a03c6d6833df..96fb9ff5ff2e 100644
--- a/drivers/interconnect/qcom/osm-l3.c
+++ b/drivers/interconnect/qcom/osm-l3.c
@@ -78,7 +78,7 @@ static struct qcom_icc_node *sdm845_osm_l3_nodes[] = {
[SLAVE_OSM_L3] = _osm_l3,
  };
  
-const static struct qcom_icc_desc sdm845_icc_osm_l3 = {

+static const struct qcom_icc_desc sdm845_icc_osm_l3 = {
.nodes = sdm845_osm_l3_nodes,
.num_nodes = ARRAY_SIZE(sdm845_osm_l3_nodes),
  };
@@ -91,7 +91,7 @@ static struct qcom_icc_node *sc7180_osm_l3_nodes[] = {
[SLAVE_OSM_L3] = _osm_l3,
  };
  
-const static struct qcom_icc_desc sc7180_icc_osm_l3 = {

+static const struct qcom_icc_desc sc7180_icc_osm_l3 = {
.nodes = sc7180_osm_l3_nodes,
.num_nodes = ARRAY_SIZE(sc7180_osm_l3_nodes),
  };
diff --git a/drivers/interconnect/qcom/sdm845.c 
b/drivers/interconnect/qcom/sdm845.c
index b013b80caa45..f6c7b969520d 100644
--- a/drivers/interconnect/qcom/sdm845.c
+++ b/drivers/interconnect/qcom/sdm845.c
@@ -192,7 +192,7 @@ static struct qcom_icc_node *aggre1_noc_nodes[] = {
[SLAVE_ANOC_PCIE_A1NOC_SNOC] = _pcie_a1noc_snoc,
  };
  
-const static struct qcom_icc_desc sdm845_aggre1_noc = {

+static const struct qcom_icc_desc sdm845_aggre1_noc = {
.nodes = aggre1_noc_nodes,
.num_nodes = ARRAY_SIZE(aggre1_noc_nodes),
.bcms = aggre1_noc_bcms,
@@ -220,7 +220,7 @@ static struct qcom_icc_node *aggre2_noc_nodes[] = {
[SLAVE_SERVICE_A2NOC] = _aggre2_noc,
  };
  
-const static struct qcom_icc_desc sdm845_aggre2_noc = {

+static const struct qcom_icc_desc sdm845_aggre2_noc = {
.nodes = aggre2_noc_nodes,
.num_nodes = ARRAY_SIZE(aggre2_noc_nodes),
.bcms = aggre2_noc_bcms,
@@ -281,7 +281,7 @@ static struct qcom_icc_node *config_noc_nodes[] = {
[SLAVE_SERVICE_CNOC] = _cnoc,
  };
  
-const static struct qcom_icc_desc sdm845_config_noc = {

+static const struct qcom_icc_desc sdm845_config_noc = {
.nodes = config_noc_nodes,
.num_nodes = ARRAY_SIZE(config_noc_nodes),
.bcms = config_noc_bcms,
@@ -297,7 +297,7 @@ static struct qcom_icc_node *dc_noc_nodes[] = {
[SLAVE_MEM_NOC_CFG] = _memnoc,
  };
  
-const static struct qcom_icc_desc sdm845_dc_noc = {

+static const struct qcom_icc_desc sdm845_dc_noc = {
.nodes = dc_noc_nodes,
.num_nodes = ARRAY_SIZE(dc_noc_nodes),
.bcms = dc_noc_bcms,
@@ -315,7 +315,7 @@ static struct qcom_icc_node *gladiator_noc_nodes[] = {
[SLAVE_SERVICE_GNOC] = _gnoc,
  };
  
-const static struct qcom_icc_desc sdm845_gladiator_noc = {

+static const struct qcom_icc_desc sdm845_gladiator_noc = {
.nodes = gladiator_noc_nodes,
.num_nodes = ARRAY_SIZE(gladiator_noc_nodes),
.bcms = gladiator_noc_bcms,
@@ -350,7 +350,7 @@ static struct qcom_icc_node *mem_noc_nodes[] = {
[SLAVE_EBI1] = ,
  };
  
-const static struct qcom_icc_desc sdm845_mem_noc = {

+static const struct qcom_icc_desc sdm845_mem_noc = {
.nodes = mem_noc_nodes,
.num_nodes = ARRAY_SIZE

[PATCH v2] soc: imx8m: Make imx8m_dsp_ops static

2020-04-28 Thread ChenTao
Fix the following warning:

sound/soc/sof/imx/imx8m.c:95:20: warning:
symbol 'imx8m_dsp_ops' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 
Acked-by: Kai Vehmanen 
Reviewed-by: Daniel Baluta 
---
v1->v2:
- add recipient broo...@kernel.org alsa-de...@alsa-project.org

 sound/soc/sof/imx/imx8m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/imx/imx8m.c b/sound/soc/sof/imx/imx8m.c
index 07451ba4efae..1a5b0f9ebac1 100644
--- a/sound/soc/sof/imx/imx8m.c
+++ b/sound/soc/sof/imx/imx8m.c
@@ -92,7 +92,7 @@ static void imx8m_dsp_handle_request(struct imx_dsp_ipc *ipc)
snd_sof_ipc_msgs_rx(priv->sdev);
 }
 
-struct imx_dsp_ops imx8m_dsp_ops = {
+static struct imx_dsp_ops imx8m_dsp_ops = {
.handle_reply   = imx8m_dsp_handle_reply,
.handle_request = imx8m_dsp_handle_request,
 };
-- 
2.22.0



Re: [PATCH] soc: imx8m: Make imx8m_dsp_ops static

2020-04-28 Thread chentao (AS)
Thanks a lot, i will resend v2 and add  Mark Brown broo...@kernel.org  
alsa-de...@alsa-project.org


On 2020/4/29 0:42, Daniel Baluta wrote:

On Sat, Apr 25, 2020 at 11:03 AM ChenTao  wrote:

Fix the following warning:

sound/soc/sof/imx/imx8m.c:95:20: warning:
symbol 'imx8m_dsp_ops' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: ChenTao 

Reviewed-by: Daniel Baluta 

Can you please resend (picking Acked-by/Reviewed-by tags) and
as Kai said add:

To: Mark Brown (broo...@kernel.org
Cc: alsa-de...@alsa-project.org
.


Re: [PATCH v2] xen-blkback: define pr_fmt macro to avoid the duplication of DRV_PFX

2015-04-01 Thread Chentao (Boby)



On 2015/4/1 23:04, Tao Chen wrote:

Define pr_fmt macro with {xen-blkback: } prefix, then remove all use
of DRV_PFX in the pr sentences. Replace all DPRINTK with pr sentences,
and get rid of DPRINTK macro. It will simplify the code.

And if the pr sentences miss a \n, add it in the end. If the DPRINTK
sentences have redundant \n, remove it. It will format the code.



I'm sorry, I made a mistake in this patch log. It must be changed as below.

And if the pr sentences miss a \n, add it in the end. It will format the 
code.


I apologize for the disturb of wrong patch log. Very looking forward
to your reply.


These all make the readability of the code become better.

Signed-off-by: Tao Chen 
---
v2:
   - Replace all DPRINTK with pr sentences, and get rid of DPRINTK macro.
---
  drivers/block/xen-blkback/blkback.c | 62 ++---
  drivers/block/xen-blkback/common.h  |  6 
  drivers/block/xen-blkback/xenbus.c  | 31 +++
  3 files changed, 49 insertions(+), 50 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c 
b/drivers/block/xen-blkback/blkback.c
index 2a04d34..bd2b3bb 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -34,6 +34,8 @@
   * IN THE SOFTWARE.
   */

+#define pr_fmt(fmt) "xen-blkback: " fmt
+
  #include 
  #include 
  #include 
@@ -211,7 +213,7 @@ static int add_persistent_gnt(struct xen_blkif *blkif,
else if (persistent_gnt->gnt > this->gnt)
new = &((*new)->rb_right);
else {
-   pr_alert_ratelimited(DRV_PFX " trying to add a gref that's 
already in the tree\n");
+   pr_alert_ratelimited("trying to add a gref that's already in 
the tree\n");
return -EINVAL;
}
}
@@ -242,7 +244,7 @@ static struct persistent_gnt *get_persistent_gnt(struct 
xen_blkif *blkif,
node = node->rb_right;
else {
if(test_bit(PERSISTENT_GNT_ACTIVE, data->flags)) {
-   pr_alert_ratelimited(DRV_PFX " requesting a grant 
already in use\n");
+   pr_alert_ratelimited("requesting a grant already in 
use\n");
return NULL;
}
set_bit(PERSISTENT_GNT_ACTIVE, data->flags);
@@ -257,7 +259,7 @@ static void put_persistent_gnt(struct xen_blkif *blkif,
 struct persistent_gnt *persistent_gnt)
  {
if(!test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags))
- pr_alert_ratelimited(DRV_PFX " freeing a grant already 
unused");
+   pr_alert_ratelimited("freeing a grant already unused\n");
set_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt->flags);
clear_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags);
atomic_dec(>persistent_gnt_in_use);
@@ -374,7 +376,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
}

if (work_pending(>persistent_purge_work)) {
-   pr_alert_ratelimited(DRV_PFX "Scheduled work from previous purge is 
still pending, cannot purge list\n");
+   pr_alert_ratelimited("Scheduled work from previous purge is still 
pending, cannot purge list\n");
return;
}

@@ -396,7 +398,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)

total = num_clean;

-   pr_debug(DRV_PFX "Going to purge %u persistent grants\n", num_clean);
+   pr_debug("Going to purge %u persistent grants\n", num_clean);

BUG_ON(!list_empty(>persistent_purge_list));
root = >persistent_gnts;
@@ -428,13 +430,13 @@ purge_list:
 * with the requested num
 */
if (!scan_used && !clean_used) {
-   pr_debug(DRV_PFX "Still missing %u purged frames\n", num_clean);
+   pr_debug("Still missing %u purged frames\n", num_clean);
scan_used = true;
goto purge_list;
}
  finished:
if (!clean_used) {
-   pr_debug(DRV_PFX "Finished scanning for grants to clean, removing 
used flag\n");
+   pr_debug("Finished scanning for grants to clean, removing used 
flag\n");
clean_used = true;
goto purge_list;
}
@@ -444,7 +446,7 @@ finished:

/* We can defer this work */
schedule_work(>persistent_purge_work);
-   pr_debug(DRV_PFX "Purged %u/%u\n", (total - num_clean), total);
+   pr_debug("Purged %u/%u\n", (total - num_clean), total);
return;
  }

@@ -520,20 +522,20 @@ static void xen_vbd_resize(struct xen_blkif *blkif)
struct xenbus_device *dev = xen_blkbk_xenbus(blkif->be);
unsigned long long new_size = vbd_sz(vbd);

-   pr_info(DRV_PFX "VBD Resize: Domid: %d, Device: (%d, %d)\n",
+   pr_info("VBD Resize: Domid: %d, Device: (%d, %d)\n",
   

Re: [PATCH] xen-blkback: define pr_fmt macro to avoid the duplication of DRV_PFX

2015-04-01 Thread Chentao (Boby)

Thanks roger and joe.

I will adopt your suggestions in my v2 patch.

On 2015/3/31 22:57, Roger Pau Monné wrote:

El 31/03/15 a les 23.14, Tao Chen ha escrit:

Define pr_fmt macro with {xen-blkback: } prefix, then remove all use
of DRV_PFX in the pr and DPRINTK sentences. It will simplify the code.

And if the pr sentences miss a \n, add it in the end. If the DPRINTK
sentences have redundant \n, remove it. It will format the code.

These all make the readability of the code become better.


Thanks for the patch.


Signed-off-by: Tao Chen 
---
  drivers/block/xen-blkback/blkback.c | 62 ++---
  drivers/block/xen-blkback/common.h  |  6 
  drivers/block/xen-blkback/xenbus.c  | 18 ++-
  3 files changed, 42 insertions(+), 44 deletions(-)


[...]

diff --git a/drivers/block/xen-blkback/common.h 
b/drivers/block/xen-blkback/common.h
index 375d288..f620b5d 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -44,12 +44,6 @@
  #include 
  #include 

-#define DRV_PFX "xen-blkback:"
-#define DPRINTK(fmt, args...)  \
-   pr_debug(DRV_PFX "(%s:%d) " fmt ".\n",  \
-__func__, __LINE__, ##args)
-
-
  /*
   * This is the maximum number of segments that would be allowed in indirect
   * requests. This value will also be passed to the frontend.
diff --git a/drivers/block/xen-blkback/xenbus.c 
b/drivers/block/xen-blkback/xenbus.c
index b33083e..0dbbfeb 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -14,6 +14,11 @@

  */

+#define pr_fmt(fmt) "xen-blkback: " fmt
+#define DPRINTK(fmt, args...)  \
+   pr_debug("(%s:%d) " fmt ".\n",  \
+   __func__, __LINE__, ##args)
+
  #include 
  #include 
  #include 
@@ -426,14 +431,14 @@ static int xen_vbd_create(struct xen_blkif *blkif, 
blkif_vdev_t handle,
 FMODE_READ : FMODE_WRITE, NULL);

if (IS_ERR(bdev)) {
-   DPRINTK("xen_vbd_create: device %08x could not be opened.\n",
+   DPRINTK("xen_vbd_create: device %08x could not be opened",
vbd->pdevice);
return -ENOENT;
}

vbd->bdev = bdev;
if (vbd->bdev->bd_disk == NULL) {
-   DPRINTK("xen_vbd_create: device %08x doesn't exist.\n",
+   DPRINTK("xen_vbd_create: device %08x doesn't exist",
vbd->pdevice);


IMHO this two above should be made a pr_warn probably...


xen_vbd_free(vbd);
return -ENOENT;
@@ -452,7 +457,7 @@ static int xen_vbd_create(struct xen_blkif *blkif, 
blkif_vdev_t handle,
if (q && blk_queue_secdiscard(q))
vbd->discard_secure = true;

-   DPRINTK("Successful creation of handle=%04x (dom=%u)\n",
+   DPRINTK("Successful creation of handle=%04x (dom=%u)",
handle, blkif->domid);


...and this should be turned into a plain pr_debug. And with that we can
get rid of DPRINTK.

Roger.


.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] xen-blkback: define pr_fmt macro to avoid the duplication of DRV_PFX

2015-04-01 Thread Chentao (Boby)

Thanks roger and joe.

I will adopt your suggestions in my v2 patch.

On 2015/3/31 22:57, Roger Pau Monné wrote:

El 31/03/15 a les 23.14, Tao Chen ha escrit:

Define pr_fmt macro with {xen-blkback: } prefix, then remove all use
of DRV_PFX in the pr and DPRINTK sentences. It will simplify the code.

And if the pr sentences miss a \n, add it in the end. If the DPRINTK
sentences have redundant \n, remove it. It will format the code.

These all make the readability of the code become better.


Thanks for the patch.


Signed-off-by: Tao Chen boby.c...@huawei.com
---
  drivers/block/xen-blkback/blkback.c | 62 ++---
  drivers/block/xen-blkback/common.h  |  6 
  drivers/block/xen-blkback/xenbus.c  | 18 ++-
  3 files changed, 42 insertions(+), 44 deletions(-)


[...]

diff --git a/drivers/block/xen-blkback/common.h 
b/drivers/block/xen-blkback/common.h
index 375d288..f620b5d 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -44,12 +44,6 @@
  #include xen/interface/io/blkif.h
  #include xen/interface/io/protocols.h

-#define DRV_PFX xen-blkback:
-#define DPRINTK(fmt, args...)  \
-   pr_debug(DRV_PFX (%s:%d)  fmt .\n,  \
-__func__, __LINE__, ##args)
-
-
  /*
   * This is the maximum number of segments that would be allowed in indirect
   * requests. This value will also be passed to the frontend.
diff --git a/drivers/block/xen-blkback/xenbus.c 
b/drivers/block/xen-blkback/xenbus.c
index b33083e..0dbbfeb 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -14,6 +14,11 @@

  */

+#define pr_fmt(fmt) xen-blkback:  fmt
+#define DPRINTK(fmt, args...)  \
+   pr_debug((%s:%d)  fmt .\n,  \
+   __func__, __LINE__, ##args)
+
  #include stdarg.h
  #include linux/module.h
  #include linux/kthread.h
@@ -426,14 +431,14 @@ static int xen_vbd_create(struct xen_blkif *blkif, 
blkif_vdev_t handle,
 FMODE_READ : FMODE_WRITE, NULL);

if (IS_ERR(bdev)) {
-   DPRINTK(xen_vbd_create: device %08x could not be opened.\n,
+   DPRINTK(xen_vbd_create: device %08x could not be opened,
vbd-pdevice);
return -ENOENT;
}

vbd-bdev = bdev;
if (vbd-bdev-bd_disk == NULL) {
-   DPRINTK(xen_vbd_create: device %08x doesn't exist.\n,
+   DPRINTK(xen_vbd_create: device %08x doesn't exist,
vbd-pdevice);


IMHO this two above should be made a pr_warn probably...


xen_vbd_free(vbd);
return -ENOENT;
@@ -452,7 +457,7 @@ static int xen_vbd_create(struct xen_blkif *blkif, 
blkif_vdev_t handle,
if (q  blk_queue_secdiscard(q))
vbd-discard_secure = true;

-   DPRINTK(Successful creation of handle=%04x (dom=%u)\n,
+   DPRINTK(Successful creation of handle=%04x (dom=%u),
handle, blkif-domid);


...and this should be turned into a plain pr_debug. And with that we can
get rid of DPRINTK.

Roger.


.



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] xen-blkback: define pr_fmt macro to avoid the duplication of DRV_PFX

2015-04-01 Thread Chentao (Boby)



On 2015/4/1 23:04, Tao Chen wrote:

Define pr_fmt macro with {xen-blkback: } prefix, then remove all use
of DRV_PFX in the pr sentences. Replace all DPRINTK with pr sentences,
and get rid of DPRINTK macro. It will simplify the code.

And if the pr sentences miss a \n, add it in the end. If the DPRINTK
sentences have redundant \n, remove it. It will format the code.



I'm sorry, I made a mistake in this patch log. It must be changed as below.

And if the pr sentences miss a \n, add it in the end. It will format the 
code.


I apologize for the disturb of wrong patch log. Very looking forward
to your reply.


These all make the readability of the code become better.

Signed-off-by: Tao Chen boby.c...@huawei.com
---
v2:
   - Replace all DPRINTK with pr sentences, and get rid of DPRINTK macro.
---
  drivers/block/xen-blkback/blkback.c | 62 ++---
  drivers/block/xen-blkback/common.h  |  6 
  drivers/block/xen-blkback/xenbus.c  | 31 +++
  3 files changed, 49 insertions(+), 50 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c 
b/drivers/block/xen-blkback/blkback.c
index 2a04d34..bd2b3bb 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -34,6 +34,8 @@
   * IN THE SOFTWARE.
   */

+#define pr_fmt(fmt) xen-blkback:  fmt
+
  #include linux/spinlock.h
  #include linux/kthread.h
  #include linux/list.h
@@ -211,7 +213,7 @@ static int add_persistent_gnt(struct xen_blkif *blkif,
else if (persistent_gnt-gnt  this-gnt)
new = ((*new)-rb_right);
else {
-   pr_alert_ratelimited(DRV_PFX  trying to add a gref that's 
already in the tree\n);
+   pr_alert_ratelimited(trying to add a gref that's already in 
the tree\n);
return -EINVAL;
}
}
@@ -242,7 +244,7 @@ static struct persistent_gnt *get_persistent_gnt(struct 
xen_blkif *blkif,
node = node-rb_right;
else {
if(test_bit(PERSISTENT_GNT_ACTIVE, data-flags)) {
-   pr_alert_ratelimited(DRV_PFX  requesting a grant 
already in use\n);
+   pr_alert_ratelimited(requesting a grant already in 
use\n);
return NULL;
}
set_bit(PERSISTENT_GNT_ACTIVE, data-flags);
@@ -257,7 +259,7 @@ static void put_persistent_gnt(struct xen_blkif *blkif,
 struct persistent_gnt *persistent_gnt)
  {
if(!test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt-flags))
- pr_alert_ratelimited(DRV_PFX  freeing a grant already 
unused);
+   pr_alert_ratelimited(freeing a grant already unused\n);
set_bit(PERSISTENT_GNT_WAS_ACTIVE, persistent_gnt-flags);
clear_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt-flags);
atomic_dec(blkif-persistent_gnt_in_use);
@@ -374,7 +376,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
}

if (work_pending(blkif-persistent_purge_work)) {
-   pr_alert_ratelimited(DRV_PFX Scheduled work from previous purge is 
still pending, cannot purge list\n);
+   pr_alert_ratelimited(Scheduled work from previous purge is still 
pending, cannot purge list\n);
return;
}

@@ -396,7 +398,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)

total = num_clean;

-   pr_debug(DRV_PFX Going to purge %u persistent grants\n, num_clean);
+   pr_debug(Going to purge %u persistent grants\n, num_clean);

BUG_ON(!list_empty(blkif-persistent_purge_list));
root = blkif-persistent_gnts;
@@ -428,13 +430,13 @@ purge_list:
 * with the requested num
 */
if (!scan_used  !clean_used) {
-   pr_debug(DRV_PFX Still missing %u purged frames\n, num_clean);
+   pr_debug(Still missing %u purged frames\n, num_clean);
scan_used = true;
goto purge_list;
}
  finished:
if (!clean_used) {
-   pr_debug(DRV_PFX Finished scanning for grants to clean, removing 
used flag\n);
+   pr_debug(Finished scanning for grants to clean, removing used 
flag\n);
clean_used = true;
goto purge_list;
}
@@ -444,7 +446,7 @@ finished:

/* We can defer this work */
schedule_work(blkif-persistent_purge_work);
-   pr_debug(DRV_PFX Purged %u/%u\n, (total - num_clean), total);
+   pr_debug(Purged %u/%u\n, (total - num_clean), total);
return;
  }

@@ -520,20 +522,20 @@ static void xen_vbd_resize(struct xen_blkif *blkif)
struct xenbus_device *dev = xen_blkbk_xenbus(blkif-be);
unsigned long long new_size = vbd_sz(vbd);

-   pr_info(DRV_PFX VBD Resize: Domid: %d, Device: (%d, %d)\n,
+   pr_info(VBD Resize: Domid: 

Re: [PATCH] xen-blkback: enlarge the array size of blkback name

2015-03-26 Thread Chentao (Boby)

You are right, roger. Thanks.

domid is a u16, it will occupy 5 characters at most. So the biggest 
length of blkback name is 8+5+5=18.


At this situation, define BLKBACK_NAME_LEN macro to be 20 is safe.

On 2015/3/26 19:23, Roger Pau Monné wrote:

El 13/03/15 a les 16.52, Tao Chen ha escrit:

The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
(means larger than 100), then the backmost xvd wouldn't be fully shown.

Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
array size of blkback name, so it will be fully shown in any case.

Signed-off-by: Tao Chen 
---
  drivers/block/xen-blkback/xenbus.c | 7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c 
b/drivers/block/xen-blkback/xenbus.c
index e3afe97..0289e21 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -21,6 +21,9 @@
  #include 
  #include "common.h"

+/* Enlarge the array size in order to fully show blkback name. */
+#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)


Any reason to use TASK_COMM_LEN instead of just coding it to 17? Or
maybe 20 to be on the safe side?

Roger.

.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] xen-blkback: enlarge the array size of blkback name

2015-03-26 Thread Chentao (Boby)

You are right, roger. Thanks.

domid is a u16, it will occupy 5 characters at most. So the biggest 
length of blkback name is 8+5+5=18.


At this situation, define BLKBACK_NAME_LEN macro to be 20 is safe.

On 2015/3/26 19:23, Roger Pau Monné wrote:

El 13/03/15 a les 16.52, Tao Chen ha escrit:

The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
(means larger than 100), then the backmost xvd wouldn't be fully shown.

Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
array size of blkback name, so it will be fully shown in any case.

Signed-off-by: Tao Chen boby.c...@huawei.com
---
  drivers/block/xen-blkback/xenbus.c | 7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c 
b/drivers/block/xen-blkback/xenbus.c
index e3afe97..0289e21 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -21,6 +21,9 @@
  #include xen/grant_table.h
  #include common.h

+/* Enlarge the array size in order to fully show blkback name. */
+#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)


Any reason to use TASK_COMM_LEN instead of just coding it to 17? Or
maybe 20 to be on the safe side?

Roger.

.



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] xen-scsiback: use DRV_PFX in the pr macros and DPRINTK

2015-03-09 Thread Chentao (Boby)



On 2015/3/6 20:50, Joe Perches wrote:

On Fri, 2015-03-06 at 17:33 +0800, Chentao (Boby) wrote:

#ifdef pr_fmt
#undef pr_fmt
#endif
#define pr_fmt(fmt) "xen-pvscsi: " fmt


No, just use add
#define pr_fmt(fmt) "xen-pvscsi: " fmt
before the first #include.
The #ifdef/#undef/#endif isn't necessary.


Then replace all DPRINTK with pr_debug.


Yes on this one.



Thanks very much, Joe.





.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] xen-scsiback: define a pr_fmt macro with xen-pvscsi

2015-03-09 Thread Chentao (Boby)



On 2015/3/6 20:53, Juergen Gross wrote:

On 03/06/2015 09:34 PM, Tao Chen wrote:

Add the {xen-pvscsi: } prefix in pr_fmt and remove DPRINTK, then
replace all DPRINTK with pr_debug.

Also fixed up some comments just as eliminate redundant whitespace
and format the code.

These will make the code easier to read.

Signed-off-by: Tao Chen 
---
  drivers/xen/xen-scsiback.c | 72
--
  1 file changed, 37 insertions(+), 35 deletions(-)

diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 9faca6a..919397e 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -69,8 +69,10 @@
  #include 
  #include 

-#define DPRINTK(_f, _a...)\
-pr_debug("(file=%s, line=%d) " _f, __FILE__ , __LINE__ , ## _a)
+#ifdef pr_fmt
+#undef pr_fmt
+#endif
+#define pr_fmt(fmt) "xen-pvscsi: " fmt


Have you looked around in the kernel how pr_fmt() is used normally?
You can spare 3 lines by placing the #define above all #include lines.



Many thanks for pointing out my mistake. I will correct it.



  #define VSCSI_VERSION"v0.1"
  #define VSCSI_NAMELEN32
@@ -271,7 +273,7 @@ static void scsiback_print_status(char
*sense_buffer, int errors,
  {
  struct scsiback_tpg *tpg = pending_req->v2p->tpg;

-pr_err("xen-pvscsi[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x
host=%02x drv=%02x\n",
+pr_err("[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x
drv=%02x\n",
 tpg->tport->tport_name, pending_req->v2p->lun,
 pending_req->cmnd[0], status_byte(errors), msg_byte(errors),
 host_byte(errors), driver_byte(errors));
@@ -427,7 +429,7 @@ static int scsiback_gnttab_data_map_batch(struct
gnttab_map_grant_ref *map,
  BUG_ON(err);
  for (i = 0; i < cnt; i++) {
  if (unlikely(map[i].status != GNTST_okay)) {
-pr_err("xen-pvscsi: invalid buffer -- could not remap
it\n");
+pr_err("invalid buffer -- could not remap it\n");
  map[i].handle = SCSIBACK_INVALID_HANDLE;
  err = -ENOMEM;
  } else {
@@ -449,7 +451,7 @@ static int scsiback_gnttab_data_map_list(struct
vscsibk_pend *pending_req,
  for (i = 0; i < cnt; i++) {
  if (get_free_page(pg + mapcount)) {
  put_free_pages(pg, mapcount);
-pr_err("xen-pvscsi: no grant page\n");
+pr_err("no grant page\n");
  return -ENOMEM;
  }
  gnttab_set_map_op([mapcount], vaddr_page(pg[mapcount]),
@@ -492,7 +494,7 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  return 0;

  if (nr_segments > VSCSIIF_SG_TABLESIZE) {
-DPRINTK("xen-pvscsi: invalid parameter nr_seg = %d\n",
+pr_debug("invalid parameter nr_seg = %d\n",
  ring_req->nr_segments);
  return -EINVAL;
  }
@@ -516,13 +518,13 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  nr_segments += n_segs;
  }
  if (nr_segments > SG_ALL) {
-DPRINTK("xen-pvscsi: invalid nr_seg = %d\n",
+pr_debug("invalid nr_seg = %d\n",
  nr_segments);


Above 2 lines fit into a single one now.



I will correct it.


  return -EINVAL;
  }
  }

-/* free of (sgl) in fast_flush_area()*/
+/* free of (sgl) in fast_flush_area() */
  pending_req->sgl = kmalloc_array(nr_segments,
  sizeof(struct scatterlist), GFP_KERNEL);
  if (!pending_req->sgl)
@@ -679,7 +681,7 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  v2p = scsiback_do_translation(info, );
  if (!v2p) {
  pending_req->v2p = NULL;
-DPRINTK("xen-pvscsi: doesn't exist.\n");
+pr_debug("doesn't exist.\n");


Without the line information this message is pretty meaningless.


For this suggestion, I want to modify this print like below

pr_debug("the v2p of (chn:%d, tgt:%d, lun:%d) doesn't exist.\n",
 vir.chn, vir.tgt, vir.lun);

What do you think, Juergen?




  return -ENODEV;
  }
  pending_req->v2p = v2p;
@@ -690,14 +692,14 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  (pending_req->sc_data_direction != DMA_TO_DEVICE) &&
  (pending_req->sc_data_direction != DMA_FROM_DEVICE) &&
  (pending_req->sc_data_direction != DMA_NONE)) {
-DPRINTK("xen-pvscsi: invalid parameter data_dir = %d\n",
+pr_debug("invalid parameter data_dir = %d\n",
  pending_req->sc_data_direction);
  return -EINVAL;
  }

  pending_req->cmd_len = ring_req->cmd_len;
  if (pending_req->cmd_len > VSCSIIF_MAX_COMMAND_SIZE) {
-DPRINTK("xen-pvscsi: invalid parameter cmd_len = %d\n",
+pr_debug("invalid parameter cmd_len = %d\n",
  pending_req->cmd_len);
  return -EINVAL;
  }
@@ -721,7 +723,7 @@ static int scsiback_do_cmd_fn(struct vscsibk_info
*info)

  if 

Re: [PATCH v3] xen-scsiback: define a pr_fmt macro with xen-pvscsi

2015-03-09 Thread Chentao (Boby)



On 2015/3/6 20:53, Juergen Gross wrote:

On 03/06/2015 09:34 PM, Tao Chen wrote:

Add the {xen-pvscsi: } prefix in pr_fmt and remove DPRINTK, then
replace all DPRINTK with pr_debug.

Also fixed up some comments just as eliminate redundant whitespace
and format the code.

These will make the code easier to read.

Signed-off-by: Tao Chen boby.c...@huawei.com
---
  drivers/xen/xen-scsiback.c | 72
--
  1 file changed, 37 insertions(+), 35 deletions(-)

diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 9faca6a..919397e 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -69,8 +69,10 @@
  #include xen/interface/grant_table.h
  #include xen/interface/io/vscsiif.h

-#define DPRINTK(_f, _a...)\
-pr_debug((file=%s, line=%d)  _f, __FILE__ , __LINE__ , ## _a)
+#ifdef pr_fmt
+#undef pr_fmt
+#endif
+#define pr_fmt(fmt) xen-pvscsi:  fmt


Have you looked around in the kernel how pr_fmt() is used normally?
You can spare 3 lines by placing the #define above all #include lines.



Many thanks for pointing out my mistake. I will correct it.



  #define VSCSI_VERSIONv0.1
  #define VSCSI_NAMELEN32
@@ -271,7 +273,7 @@ static void scsiback_print_status(char
*sense_buffer, int errors,
  {
  struct scsiback_tpg *tpg = pending_req-v2p-tpg;

-pr_err(xen-pvscsi[%s:%d] cmnd[0]=%02x - st=%02x msg=%02x
host=%02x drv=%02x\n,
+pr_err([%s:%d] cmnd[0]=%02x - st=%02x msg=%02x host=%02x
drv=%02x\n,
 tpg-tport-tport_name, pending_req-v2p-lun,
 pending_req-cmnd[0], status_byte(errors), msg_byte(errors),
 host_byte(errors), driver_byte(errors));
@@ -427,7 +429,7 @@ static int scsiback_gnttab_data_map_batch(struct
gnttab_map_grant_ref *map,
  BUG_ON(err);
  for (i = 0; i  cnt; i++) {
  if (unlikely(map[i].status != GNTST_okay)) {
-pr_err(xen-pvscsi: invalid buffer -- could not remap
it\n);
+pr_err(invalid buffer -- could not remap it\n);
  map[i].handle = SCSIBACK_INVALID_HANDLE;
  err = -ENOMEM;
  } else {
@@ -449,7 +451,7 @@ static int scsiback_gnttab_data_map_list(struct
vscsibk_pend *pending_req,
  for (i = 0; i  cnt; i++) {
  if (get_free_page(pg + mapcount)) {
  put_free_pages(pg, mapcount);
-pr_err(xen-pvscsi: no grant page\n);
+pr_err(no grant page\n);
  return -ENOMEM;
  }
  gnttab_set_map_op(map[mapcount], vaddr_page(pg[mapcount]),
@@ -492,7 +494,7 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  return 0;

  if (nr_segments  VSCSIIF_SG_TABLESIZE) {
-DPRINTK(xen-pvscsi: invalid parameter nr_seg = %d\n,
+pr_debug(invalid parameter nr_seg = %d\n,
  ring_req-nr_segments);
  return -EINVAL;
  }
@@ -516,13 +518,13 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  nr_segments += n_segs;
  }
  if (nr_segments  SG_ALL) {
-DPRINTK(xen-pvscsi: invalid nr_seg = %d\n,
+pr_debug(invalid nr_seg = %d\n,
  nr_segments);


Above 2 lines fit into a single one now.



I will correct it.


  return -EINVAL;
  }
  }

-/* free of (sgl) in fast_flush_area()*/
+/* free of (sgl) in fast_flush_area() */
  pending_req-sgl = kmalloc_array(nr_segments,
  sizeof(struct scatterlist), GFP_KERNEL);
  if (!pending_req-sgl)
@@ -679,7 +681,7 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  v2p = scsiback_do_translation(info, vir);
  if (!v2p) {
  pending_req-v2p = NULL;
-DPRINTK(xen-pvscsi: doesn't exist.\n);
+pr_debug(doesn't exist.\n);


Without the line information this message is pretty meaningless.


For this suggestion, I want to modify this print like below

pr_debug(the v2p of (chn:%d, tgt:%d, lun:%d) doesn't exist.\n,
 vir.chn, vir.tgt, vir.lun);

What do you think, Juergen?




  return -ENODEV;
  }
  pending_req-v2p = v2p;
@@ -690,14 +692,14 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  (pending_req-sc_data_direction != DMA_TO_DEVICE) 
  (pending_req-sc_data_direction != DMA_FROM_DEVICE) 
  (pending_req-sc_data_direction != DMA_NONE)) {
-DPRINTK(xen-pvscsi: invalid parameter data_dir = %d\n,
+pr_debug(invalid parameter data_dir = %d\n,
  pending_req-sc_data_direction);
  return -EINVAL;
  }

  pending_req-cmd_len = ring_req-cmd_len;
  if (pending_req-cmd_len  VSCSIIF_MAX_COMMAND_SIZE) {
-DPRINTK(xen-pvscsi: invalid parameter cmd_len = %d\n,
+pr_debug(invalid parameter cmd_len = %d\n,
  pending_req-cmd_len);
  return -EINVAL;
  }
@@ -721,7 +723,7 @@ static int scsiback_do_cmd_fn(struct vscsibk_info
*info)

  if 

Re: [PATCH v2] xen-scsiback: use DRV_PFX in the pr macros and DPRINTK

2015-03-09 Thread Chentao (Boby)



On 2015/3/6 20:50, Joe Perches wrote:

On Fri, 2015-03-06 at 17:33 +0800, Chentao (Boby) wrote:

#ifdef pr_fmt
#undef pr_fmt
#endif
#define pr_fmt(fmt) xen-pvscsi:  fmt


No, just use add
#define pr_fmt(fmt) xen-pvscsi:  fmt
before the first #include.
The #ifdef/#undef/#endif isn't necessary.


Then replace all DPRINTK with pr_debug.


Yes on this one.



Thanks very much, Joe.





.



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] xen-scsiback: use DRV_PFX in the pr macros and DPRINTK

2015-03-06 Thread Chentao (Boby)


On 2015/3/4 18:34, David Vrabel wrote:

On 04/03/15 18:32, Tao Chen wrote:

Defined the string of {xen-pvscsi: } as DRV_PFX, then use it in the pr 
sentences and DPRINTK.
Also fixed up some comments just as eliminate redundant white spaces and format 
the code.
These will make the code easier to read.


I have already said you needed to use:

#define pr_fmt(fmt)

to do this.

David

.



David, I'm sorry because I didn't read your reply in time.

I will accept your advice in my next patch. Many thanks to you.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] xen-scsiback: use DRV_PFX in the pr macros and DPRINTK

2015-03-06 Thread Chentao (Boby)



On 2015/3/5 0:32, Joe Perches wrote:

On Wed, 2015-03-04 at 18:32 +, Tao Chen wrote:

Defined the string of {xen-pvscsi: } as DRV_PFX, then use it in the pr 
sentences and DPRINTK.
Also fixed up some comments just as eliminate redundant white spaces and format 
the code.
These will make the code easier to read.


It'd probaby be better just to use pr_fmt
before any include and remove all the DRV_PRV uses

#define pr_fmt(fmt) "xen-pvscsi: " fmt


diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c

[]

@@ -69,8 +69,10 @@
  #include 
  #include 

+#define DRV_PFX "xen-pvscsi: "
  #define DPRINTK(_f, _a...)\
-   pr_debug("(file=%s, line=%d) " _f, __FILE__ , __LINE__ , ## _a)
+   pr_debug(DRV_PFX "(file=%s, line=%d) " _f,\
+   __FILE__ , __LINE__ , ## _a)


I'd also remove DPRINTK and just use pr_debug directly
as dynamic_debug can emit file and line as desired.



Joe, your suggested code is like below

#ifdef pr_fmt
#undef pr_fmt
#endif
#define pr_fmt(fmt) "xen-pvscsi: " fmt

Then replace all DPRINTK with pr_debug.

Am I right?



@@ -84,7 +86,7 @@ struct ids_tuple {

  struct v2p_entry {
struct ids_tuple v; /* translate from */
-   struct scsiback_tpg *tpg;   /* translate to   */
+   struct scsiback_tpg *tpg;   /* translate to */


superfluous change.



.



I'm sorry, I made a mistake here. I will modify it in my next patch.

Thanks, Joe.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] xen-scsiback: use DRV_PFX in the pr macros and DPRINTK

2015-03-06 Thread Chentao (Boby)



On 2015/3/5 0:32, Joe Perches wrote:

On Wed, 2015-03-04 at 18:32 +, Tao Chen wrote:

Defined the string of {xen-pvscsi: } as DRV_PFX, then use it in the pr 
sentences and DPRINTK.
Also fixed up some comments just as eliminate redundant white spaces and format 
the code.
These will make the code easier to read.


It'd probaby be better just to use pr_fmt
before any include and remove all the DRV_PRV uses

#define pr_fmt(fmt) xen-pvscsi:  fmt


diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c

[]

@@ -69,8 +69,10 @@
  #include xen/interface/grant_table.h
  #include xen/interface/io/vscsiif.h

+#define DRV_PFX xen-pvscsi: 
  #define DPRINTK(_f, _a...)\
-   pr_debug((file=%s, line=%d)  _f, __FILE__ , __LINE__ , ## _a)
+   pr_debug(DRV_PFX (file=%s, line=%d)  _f,\
+   __FILE__ , __LINE__ , ## _a)


I'd also remove DPRINTK and just use pr_debug directly
as dynamic_debug can emit file and line as desired.



Joe, your suggested code is like below

#ifdef pr_fmt
#undef pr_fmt
#endif
#define pr_fmt(fmt) xen-pvscsi:  fmt

Then replace all DPRINTK with pr_debug.

Am I right?



@@ -84,7 +86,7 @@ struct ids_tuple {

  struct v2p_entry {
struct ids_tuple v; /* translate from */
-   struct scsiback_tpg *tpg;   /* translate to   */
+   struct scsiback_tpg *tpg;   /* translate to */


superfluous change.



.



I'm sorry, I made a mistake here. I will modify it in my next patch.

Thanks, Joe.


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] xen-scsiback: use DRV_PFX in the pr macros and DPRINTK

2015-03-06 Thread Chentao (Boby)


On 2015/3/4 18:34, David Vrabel wrote:

On 04/03/15 18:32, Tao Chen wrote:

Defined the string of {xen-pvscsi: } as DRV_PFX, then use it in the pr 
sentences and DPRINTK.
Also fixed up some comments just as eliminate redundant white spaces and format 
the code.
These will make the code easier to read.


I have already said you needed to use:

#define pr_fmt(fmt)

to do this.

David

.



David, I'm sorry because I didn't read your reply in time.

I will accept your advice in my next patch. Many thanks to you.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] xen-scsiback: use DRV_PFX in the pr macros

2015-03-04 Thread Chentao (Boby)

Hi, Juergen.

Thanks for your advice. I will send a v2 patch based on your suggested 
modifications.


On 2015/3/3 17:52, Juergen Gross wrote:

On 03/03/2015 09:37 AM, Tao Chen wrote:

Replace the string of {xen-pvscsi:} in the pr sentences with DRV_PFX,
it makes the code easier to read.


I'm not really convinced this is worth a patch. OTOH I'm not completely
against it. If nobody rejects this and all my further comments are
addressed you can have my:

Acked-by: Juergen Gross 



Signed-off-by: Tao Chen 
---
  drivers/xen/xen-scsiback.c | 67
+++---
  1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 9faca6a..307100d 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -69,6 +69,7 @@
  #include 
  #include 

+#define DRV_PFX "xen-pvscsi:"


Using "xen-pvscsi: " wouldn't delete the white space after the colon in
most messages.



  #define DPRINTK(_f, _a...)\
  pr_debug("(file=%s, line=%d) " _f, __FILE__ , __LINE__ , ## _a)

@@ -84,7 +85,7 @@ struct ids_tuple {

  struct v2p_entry {
  struct ids_tuple v;/* translate from */
-struct scsiback_tpg *tpg;/* translate to   */
+struct scsiback_tpg *tpg;/* translate to */


Unrelated white space change (others as well). Either omit them or
mention them in the commit message.


  unsigned int lun;
  struct kref kref;
  struct list_head l;
@@ -271,7 +272,7 @@ static void scsiback_print_status(char
*sense_buffer, int errors,
  {
  struct scsiback_tpg *tpg = pending_req->v2p->tpg;

-pr_err("xen-pvscsi[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x
host=%02x drv=%02x\n",
+pr_err(DRV_PFX "[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x
host=%02x drv=%02x\n",
 tpg->tport->tport_name, pending_req->v2p->lun,
 pending_req->cmnd[0], status_byte(errors), msg_byte(errors),
 host_byte(errors), driver_byte(errors));
@@ -427,7 +428,7 @@ static int scsiback_gnttab_data_map_batch(struct
gnttab_map_grant_ref *map,
  BUG_ON(err);
  for (i = 0; i < cnt; i++) {
  if (unlikely(map[i].status != GNTST_okay)) {
-pr_err("xen-pvscsi: invalid buffer -- could not remap
it\n");
+pr_err(DRV_PFX "invalid buffer -- could not remap it\n");
  map[i].handle = SCSIBACK_INVALID_HANDLE;
  err = -ENOMEM;
  } else {
@@ -449,7 +450,7 @@ static int scsiback_gnttab_data_map_list(struct
vscsibk_pend *pending_req,
  for (i = 0; i < cnt; i++) {
  if (get_free_page(pg + mapcount)) {
  put_free_pages(pg, mapcount);
-pr_err("xen-pvscsi: no grant page\n");
+pr_err(DRV_PFX "no grant page\n");
  return -ENOMEM;
  }
  gnttab_set_map_op([mapcount], vaddr_page(pg[mapcount]),
@@ -492,7 +493,7 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  return 0;

  if (nr_segments > VSCSIIF_SG_TABLESIZE) {
-DPRINTK("xen-pvscsi: invalid parameter nr_seg = %d\n",
+DPRINTK(DRV_PFX "invalid parameter nr_seg = %d\n",


As DPRINTK already contains the file name, you can omit the prefix.
Alternatively include DRV_PFX in the DPRINTK macro.


  ring_req->nr_segments);
  return -EINVAL;
  }
@@ -516,13 +517,13 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  nr_segments += n_segs;
  }
  if (nr_segments > SG_ALL) {
-DPRINTK("xen-pvscsi: invalid nr_seg = %d\n",
+DPRINTK(DRV_PFX "invalid nr_seg = %d\n",
  nr_segments);
  return -EINVAL;
  }
  }

-/* free of (sgl) in fast_flush_area()*/
+/* free of (sgl) in fast_flush_area() */
  pending_req->sgl = kmalloc_array(nr_segments,
  sizeof(struct scatterlist), GFP_KERNEL);
  if (!pending_req->sgl)
@@ -679,7 +680,7 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  v2p = scsiback_do_translation(info, );
  if (!v2p) {
  pending_req->v2p = NULL;
-DPRINTK("xen-pvscsi: doesn't exist.\n");
+DPRINTK(DRV_PFX "doesn't exist.\n");
  return -ENODEV;
  }
  pending_req->v2p = v2p;
@@ -690,14 +691,14 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  (pending_req->sc_data_direction != DMA_TO_DEVICE) &&
  (pending_req->sc_data_direction != DMA_FROM_DEVICE) &&
  (pending_req->sc_data_direction != DMA_NONE)) {
-DPRINTK("xen-pvscsi: invalid parameter data_dir = %d\n",
+DPRINTK(DRV_PFX "invalid parameter data_dir = %d\n",
  pending_req->sc_data_direction);
  return -EINVAL;
  }

  pending_req->cmd_len = ring_req->cmd_len;
  if (pending_req->cmd_len > VSCSIIF_MAX_COMMAND_SIZE) {
-DPRINTK("xen-pvscsi: invalid parameter cmd_len = %d\n",
+DPRINTK(DRV_PFX "invalid 

Re: [PATCH] xen-scsiback: use DRV_PFX in the pr macros

2015-03-04 Thread Chentao (Boby)

Hi, Juergen.

Thanks for your advice. I will send a v2 patch based on your suggested 
modifications.


On 2015/3/3 17:52, Juergen Gross wrote:

On 03/03/2015 09:37 AM, Tao Chen wrote:

Replace the string of {xen-pvscsi:} in the pr sentences with DRV_PFX,
it makes the code easier to read.


I'm not really convinced this is worth a patch. OTOH I'm not completely
against it. If nobody rejects this and all my further comments are
addressed you can have my:

Acked-by: Juergen Gross jgr...@suse.com



Signed-off-by: Tao Chen boby.c...@huawei.com
---
  drivers/xen/xen-scsiback.c | 67
+++---
  1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 9faca6a..307100d 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -69,6 +69,7 @@
  #include xen/interface/grant_table.h
  #include xen/interface/io/vscsiif.h

+#define DRV_PFX xen-pvscsi:


Using xen-pvscsi:  wouldn't delete the white space after the colon in
most messages.



  #define DPRINTK(_f, _a...)\
  pr_debug((file=%s, line=%d)  _f, __FILE__ , __LINE__ , ## _a)

@@ -84,7 +85,7 @@ struct ids_tuple {

  struct v2p_entry {
  struct ids_tuple v;/* translate from */
-struct scsiback_tpg *tpg;/* translate to   */
+struct scsiback_tpg *tpg;/* translate to */


Unrelated white space change (others as well). Either omit them or
mention them in the commit message.


  unsigned int lun;
  struct kref kref;
  struct list_head l;
@@ -271,7 +272,7 @@ static void scsiback_print_status(char
*sense_buffer, int errors,
  {
  struct scsiback_tpg *tpg = pending_req-v2p-tpg;

-pr_err(xen-pvscsi[%s:%d] cmnd[0]=%02x - st=%02x msg=%02x
host=%02x drv=%02x\n,
+pr_err(DRV_PFX [%s:%d] cmnd[0]=%02x - st=%02x msg=%02x
host=%02x drv=%02x\n,
 tpg-tport-tport_name, pending_req-v2p-lun,
 pending_req-cmnd[0], status_byte(errors), msg_byte(errors),
 host_byte(errors), driver_byte(errors));
@@ -427,7 +428,7 @@ static int scsiback_gnttab_data_map_batch(struct
gnttab_map_grant_ref *map,
  BUG_ON(err);
  for (i = 0; i  cnt; i++) {
  if (unlikely(map[i].status != GNTST_okay)) {
-pr_err(xen-pvscsi: invalid buffer -- could not remap
it\n);
+pr_err(DRV_PFX invalid buffer -- could not remap it\n);
  map[i].handle = SCSIBACK_INVALID_HANDLE;
  err = -ENOMEM;
  } else {
@@ -449,7 +450,7 @@ static int scsiback_gnttab_data_map_list(struct
vscsibk_pend *pending_req,
  for (i = 0; i  cnt; i++) {
  if (get_free_page(pg + mapcount)) {
  put_free_pages(pg, mapcount);
-pr_err(xen-pvscsi: no grant page\n);
+pr_err(DRV_PFX no grant page\n);
  return -ENOMEM;
  }
  gnttab_set_map_op(map[mapcount], vaddr_page(pg[mapcount]),
@@ -492,7 +493,7 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  return 0;

  if (nr_segments  VSCSIIF_SG_TABLESIZE) {
-DPRINTK(xen-pvscsi: invalid parameter nr_seg = %d\n,
+DPRINTK(DRV_PFX invalid parameter nr_seg = %d\n,


As DPRINTK already contains the file name, you can omit the prefix.
Alternatively include DRV_PFX in the DPRINTK macro.


  ring_req-nr_segments);
  return -EINVAL;
  }
@@ -516,13 +517,13 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
  nr_segments += n_segs;
  }
  if (nr_segments  SG_ALL) {
-DPRINTK(xen-pvscsi: invalid nr_seg = %d\n,
+DPRINTK(DRV_PFX invalid nr_seg = %d\n,
  nr_segments);
  return -EINVAL;
  }
  }

-/* free of (sgl) in fast_flush_area()*/
+/* free of (sgl) in fast_flush_area() */
  pending_req-sgl = kmalloc_array(nr_segments,
  sizeof(struct scatterlist), GFP_KERNEL);
  if (!pending_req-sgl)
@@ -679,7 +680,7 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  v2p = scsiback_do_translation(info, vir);
  if (!v2p) {
  pending_req-v2p = NULL;
-DPRINTK(xen-pvscsi: doesn't exist.\n);
+DPRINTK(DRV_PFX doesn't exist.\n);
  return -ENODEV;
  }
  pending_req-v2p = v2p;
@@ -690,14 +691,14 @@ static int prepare_pending_reqs(struct
vscsibk_info *info,
  (pending_req-sc_data_direction != DMA_TO_DEVICE) 
  (pending_req-sc_data_direction != DMA_FROM_DEVICE) 
  (pending_req-sc_data_direction != DMA_NONE)) {
-DPRINTK(xen-pvscsi: invalid parameter data_dir = %d\n,
+DPRINTK(DRV_PFX invalid parameter data_dir = %d\n,
  pending_req-sc_data_direction);
  return -EINVAL;
  }

  pending_req-cmd_len = ring_req-cmd_len;
  if (pending_req-cmd_len  VSCSIIF_MAX_COMMAND_SIZE) {
-DPRINTK(xen-pvscsi: invalid parameter cmd_len = %d\n,
+