mfd: rtsx: Using pcr_dbg replace dev_dbg
authorMicky Ching <micky_ching@realsil.com.cn>
Wed, 25 Feb 2015 05:50:16 +0000 (13:50 +0800)
committerLee Jones <lee.jones@linaro.org>
Tue, 3 Mar 2015 16:41:21 +0000 (16:41 +0000)
pcr_dbg is a wrapper of dev_dbg, which can save some code,
and help to enable/disable debug message static.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/rtl8411.c
drivers/mfd/rts5209.c
drivers/mfd/rts5227.c
drivers/mfd/rts5229.c
drivers/mfd/rts5249.c
drivers/mfd/rtsx_pcr.c

index fdd34c883d868b96df11064b86933ab9c0172c35..b3ae6592014a0214b505df0b829f670877fe9c46 100644 (file)
@@ -53,7 +53,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr *pcr)
        u8 reg3 = 0;
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg1);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
 
        if (!rtsx_vendor_setting_valid(reg1))
                return;
@@ -65,7 +65,7 @@ static void rtl8411_fetch_vendor_settings(struct rtsx_pcr *pcr)
        pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg1);
 
        rtsx_pci_read_config_byte(pcr, PCR_SETTING_REG3, &reg3);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
        pcr->sd30_drive_sel_3v3 = rtl8411_reg_to_sd30_drive_sel_3v3(reg3);
 }
 
@@ -74,7 +74,7 @@ static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr *pcr)
        u32 reg = 0;
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
        if (!rtsx_vendor_setting_valid(reg))
                return;
@@ -260,9 +260,8 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
                rtsx_pci_write_register(pcr, CARD_PWR_CTL,
                                BPP_POWER_MASK, BPP_POWER_OFF);
 
-               dev_dbg(&(pcr->pci->dev),
-                               "After CD deglitch, card_exist = 0x%x\n",
-                               card_exist);
+               pcr_dbg(pcr, "After CD deglitch, card_exist = 0x%x\n",
+                       card_exist);
        }
 
        if (card_exist & MS_EXIST) {
index cb04174a8924b0279fccb697706f9227b6869e15..373e253c33df945544a9c6ce6caac564d1647bbc 100644 (file)
@@ -38,7 +38,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr *pcr)
        u32 reg;
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
        if (rts5209_vendor_setting1_valid(reg)) {
                if (rts5209_reg_check_ms_pmos(reg))
@@ -47,7 +47,7 @@ static void rts5209_fetch_vendor_settings(struct rtsx_pcr *pcr)
        }
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
 
        if (rts5209_vendor_setting2_valid(reg)) {
                pcr->sd30_drive_sel_1v8 =
index 0c0283154ab56e770dc4c2217c1dfdc83825c54e..ce012d78ce2a0fe45ac78e52c6d17bb0a91f8632 100644 (file)
@@ -63,7 +63,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr)
        u32 reg;
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
        if (!rtsx_vendor_setting_valid(reg))
                return;
@@ -74,7 +74,7 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr)
        pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
        pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
        if (rtsx_reg_check_reverse_socket(reg))
                pcr->flags |= PCR_REVERSE_SOCKET;
index 6353f5df087aa41bb11653b69593ea3eb56abd8b..ace45384ec8bc2893f9c1ff2bb4ea6cb027e2a23 100644 (file)
@@ -38,7 +38,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr *pcr)
        u32 reg;
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
        if (!rtsx_vendor_setting_valid(reg))
                return;
@@ -50,7 +50,7 @@ static void rts5229_fetch_vendor_settings(struct rtsx_pcr *pcr)
        pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
        pcr->sd30_drive_sel_3v3 =
                map_sd_drive(rtsx_reg_to_sd30_drive_sel_3v3(reg));
 }
index d1ff32f742ba6f0d7b00cb2c5da9332591f8aa30..eb2d5866f7195296999b5d9afb11ae2eb707d862 100644 (file)
@@ -70,7 +70,7 @@ static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr)
        u32 reg;
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
 
        if (!rtsx_vendor_setting_valid(reg)) {
                pcr_dbg(pcr, "skip fetch vendor setting\n");
@@ -83,7 +83,7 @@ static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr)
        pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg);
 
        rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG2, &reg);
-       dev_dbg(&(pcr->pci->dev), "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
+       pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg);
        pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
        if (rtsx_reg_check_reverse_socket(reg))
                pcr->flags |= PCR_REVERSE_SOCKET;
index 433cb41cf556874dd44a2a6d7f7e27538f751197..a66540a4907995bfd7b0dec0e0511c7c090ac1b6 100644 (file)
@@ -316,8 +316,7 @@ int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout)
        timeleft = wait_for_completion_interruptible_timeout(
                        &trans_done, msecs_to_jiffies(timeout));
        if (timeleft <= 0) {
-               dev_dbg(&(pcr->pci->dev), "Timeout (%s %d)\n",
-                               __func__, __LINE__);
+               pcr_dbg(pcr, "Timeout (%s %d)\n", __func__, __LINE__);
                err = -ETIMEDOUT;
                goto finish_send_cmd;
        }
@@ -353,8 +352,7 @@ static void rtsx_pci_add_sg_tbl(struct rtsx_pcr *pcr,
        u64 val;
        u8 option = SG_VALID | SG_TRANS_DATA;
 
-       dev_dbg(&(pcr->pci->dev), "DMA addr: 0x%x, Len: 0x%x\n",
-                       (unsigned int)addr, len);
+       pcr_dbg(pcr, "DMA addr: 0x%x, Len: 0x%x\n", (unsigned int)addr, len);
 
        if (end)
                option |= SG_END;
@@ -369,11 +367,11 @@ int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
 {
        int err = 0, count;
 
-       dev_dbg(&(pcr->pci->dev), "--> %s: num_sg = %d\n", __func__, num_sg);
+       pcr_dbg(pcr, "--> %s: num_sg = %d\n", __func__, num_sg);
        count = rtsx_pci_dma_map_sg(pcr, sglist, num_sg, read);
        if (count < 1)
                return -EINVAL;
-       dev_dbg(&(pcr->pci->dev), "DMA mapping count: %d\n", count);
+       pcr_dbg(pcr, "DMA mapping count: %d\n", count);
 
        err = rtsx_pci_dma_transfer(pcr, sglist, count, read, timeout);
 
@@ -447,8 +445,7 @@ int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
        timeleft = wait_for_completion_interruptible_timeout(
                        &trans_done, msecs_to_jiffies(timeout));
        if (timeleft <= 0) {
-               dev_dbg(&(pcr->pci->dev), "Timeout (%s %d)\n",
-                               __func__, __LINE__);
+               pcr_dbg(pcr, "Timeout (%s %d)\n", __func__, __LINE__);
                err = -ETIMEDOUT;
                goto out;
        }
@@ -622,7 +619,7 @@ static void rtsx_pci_enable_bus_int(struct rtsx_pcr *pcr)
        /* Enable Bus Interrupt */
        rtsx_pci_writel(pcr, RTSX_BIER, pcr->bier);
 
-       dev_dbg(&(pcr->pci->dev), "RTSX_BIER: 0x%08x\n", pcr->bier);
+       pcr_dbg(pcr, "RTSX_BIER: 0x%08x\n", pcr->bier);
 }
 
 static inline u8 double_ssc_depth(u8 depth)
@@ -668,14 +665,13 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
                return err;
 
        card_clock /= 1000000;
-       dev_dbg(&(pcr->pci->dev), "Switch card clock to %dMHz\n", card_clock);
+       pcr_dbg(pcr, "Switch card clock to %dMHz\n", card_clock);
 
        clk = card_clock;
        if (!initial_mode && double_clk)
                clk = card_clock * 2;
-       dev_dbg(&(pcr->pci->dev),
-                       "Internal SSC clock: %dMHz (cur_clock = %d)\n",
-                       clk, pcr->cur_clock);
+       pcr_dbg(pcr, "Internal SSC clock: %dMHz (cur_clock = %d)\n",
+               clk, pcr->cur_clock);
 
        if (clk == pcr->cur_clock)
                return 0;
@@ -704,14 +700,14 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
                }
                div++;
        }
-       dev_dbg(&(pcr->pci->dev), "n = %d, div = %d\n", n, div);
+       pcr_dbg(pcr, "n = %d, div = %d\n", n, div);
 
        ssc_depth = depth[ssc_depth];
        if (double_clk)
                ssc_depth = double_ssc_depth(ssc_depth);
 
        ssc_depth = revise_ssc_depth(ssc_depth, div);
-       dev_dbg(&(pcr->pci->dev), "ssc_depth = %d\n", ssc_depth);
+       pcr_dbg(pcr, "ssc_depth = %d\n", ssc_depth);
 
        rtsx_pci_init_cmd(pcr);
        rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CLK_CTL,
@@ -833,13 +829,13 @@ static void rtsx_pci_card_detect(struct work_struct *work)
        dwork = to_delayed_work(work);
        pcr = container_of(dwork, struct rtsx_pcr, carddet_work);
 
-       dev_dbg(&(pcr->pci->dev), "--> %s\n", __func__);
+       pcr_dbg(pcr, "--> %s\n", __func__);
 
        mutex_lock(&pcr->pcr_mutex);
        spin_lock_irqsave(&pcr->lock, flags);
 
        irq_status = rtsx_pci_readl(pcr, RTSX_BIPR);
-       dev_dbg(&(pcr->pci->dev), "irq_status: 0x%08x\n", irq_status);
+       pcr_dbg(pcr, "irq_status: 0x%08x\n", irq_status);
 
        irq_status &= CARD_EXIST;
        card_inserted = pcr->card_inserted & irq_status;
@@ -850,9 +846,8 @@ static void rtsx_pci_card_detect(struct work_struct *work)
        spin_unlock_irqrestore(&pcr->lock, flags);
 
        if (card_inserted || card_removed) {
-               dev_dbg(&(pcr->pci->dev),
-                               "card_inserted: 0x%x, card_removed: 0x%x\n",
-                               card_inserted, card_removed);
+               pcr_dbg(pcr, "card_inserted: 0x%x, card_removed: 0x%x\n",
+                       card_inserted, card_removed);
 
                if (pcr->ops->cd_deglitch)
                        card_inserted = pcr->ops->cd_deglitch(pcr);
@@ -960,7 +955,7 @@ static void rtsx_pci_idle_work(struct work_struct *work)
        struct delayed_work *dwork = to_delayed_work(work);
        struct rtsx_pcr *pcr = container_of(dwork, struct rtsx_pcr, idle_work);
 
-       dev_dbg(&(pcr->pci->dev), "--> %s\n", __func__);
+       pcr_dbg(pcr, "--> %s\n", __func__);
 
        mutex_lock(&pcr->pcr_mutex);
 
@@ -1128,7 +1123,7 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
                break;
        }
 
-       dev_dbg(&(pcr->pci->dev), "PID: 0x%04x, IC version: 0x%02x\n",
+       pcr_dbg(pcr, "PID: 0x%04x, IC version: 0x%02x\n",
                        PCI_PID(pcr), pcr->ic_version);
 
        pcr->slots = kcalloc(pcr->num_slots, sizeof(struct rtsx_slot),
@@ -1139,14 +1134,14 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
        if (pcr->ops->fetch_vendor_settings)
                pcr->ops->fetch_vendor_settings(pcr);
 
-       dev_dbg(&(pcr->pci->dev), "pcr->aspm_en = 0x%x\n", pcr->aspm_en);
-       dev_dbg(&(pcr->pci->dev), "pcr->sd30_drive_sel_1v8 = 0x%x\n",
+       pcr_dbg(pcr, "pcr->aspm_en = 0x%x\n", pcr->aspm_en);
+       pcr_dbg(pcr, "pcr->sd30_drive_sel_1v8 = 0x%x\n",
                        pcr->sd30_drive_sel_1v8);
-       dev_dbg(&(pcr->pci->dev), "pcr->sd30_drive_sel_3v3 = 0x%x\n",
+       pcr_dbg(pcr, "pcr->sd30_drive_sel_3v3 = 0x%x\n",
                        pcr->sd30_drive_sel_3v3);
-       dev_dbg(&(pcr->pci->dev), "pcr->card_drive_sel = 0x%x\n",
+       pcr_dbg(pcr, "pcr->card_drive_sel = 0x%x\n",
                        pcr->card_drive_sel);
-       dev_dbg(&(pcr->pci->dev), "pcr->flags = 0x%x\n", pcr->flags);
+       pcr_dbg(pcr, "pcr->flags = 0x%x\n", pcr->flags);
 
        pcr->state = PDEV_STAT_IDLE;
        err = rtsx_pci_init_hw(pcr);