Re: [PATCH 1/3] megaraid_sas: Convert dev_printk to dev_<level>

From: Johannes Thumshirn
Date: Tue Oct 27 2015 - 06:25:57 EST


On Tue, 2015-10-27 at 16:26 +0800, Weidong Wang wrote:
> Reduce object size a little by using dev_<level>
> calls instead of dev_printk(KERN_<LEVEL>.
>
> Signed-off-by: Weidong Wang <wangweidong1@xxxxxxxxxx>
> ---
> Âdrivers/scsi/megaraid/megaraid_sas_base.c | 68 +++++++++++++++----
> ------------
> Â1 file changed, 34 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index eaa81e5..ed9846d 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -1884,7 +1884,7 @@ static int
> megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
> Â cmd = megasas_get_cmd(instance);
> Â
> Â if (!cmd) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_get_ld_vf_affiliation_111:"
> + dev_dbg(&instance->pdev->dev,
> "megasas_get_ld_vf_affiliation_111:"
> Â ÂÂÂÂÂÂÂ"Failed to get cmd for scsi%d\n",
> Â instance->host->host_no);
> Â return -ENOMEM;
> @@ -1908,7 +1908,7 @@ static int
> megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
> Â ÂÂÂÂÂsizeof(struct
> MR_LD_VF_AFFILIATION_111),
> Â ÂÂÂÂÂ&new_affiliation_111_h)
> ;
> Â if (!new_affiliation_111) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "SR-IOV: Couldn't allocate "
> + dev_dbg(&instance->pdev->dev, "SR-IOV:
> Couldn't allocate "
> Â ÂÂÂÂÂÂÂ"memory for new affiliation for
> scsi%d\n",
> Â ÂÂÂÂÂÂÂinstance->host->host_no);
> Â megasas_return_cmd(instance, cmd);
> @@ -1995,7 +1995,7 @@ static int
> megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
> Â cmd = megasas_get_cmd(instance);
> Â
> Â if (!cmd) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_get_ld_vf_affiliation12: "
> + dev_dbg(&instance->pdev->dev,
> "megasas_get_ld_vf_affiliation12: "
> Â ÂÂÂÂÂÂÂ"Failed to get cmd for scsi%d\n",
> Â ÂÂÂÂÂÂÂinstance->host->host_no);
> Â return -ENOMEM;
> @@ -2020,7 +2020,7 @@ static int
> megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
> Â ÂÂÂÂÂsizeof(struct
> MR_LD_VF_AFFILIATION),
> Â ÂÂÂÂÂ&new_affiliation_h);
> Â if (!new_affiliation) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "SR-IOV: Couldn't allocate "
> + dev_dbg(&instance->pdev->dev, "SR-IOV:
> Couldn't allocate "
> Â ÂÂÂÂÂÂÂ"memory for new affiliation for
> scsi%d\n",
> Â ÂÂÂÂÂÂÂinstance->host->host_no);
> Â megasas_return_cmd(instance, cmd);
> @@ -2174,7 +2174,7 @@ int megasas_sriov_start_heartbeat(struct
> megasas_instance *instance,
> Â cmd = megasas_get_cmd(instance);
> Â
> Â if (!cmd) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_sriov_start_heartbeat: "
> + dev_dbg(&instance->pdev->dev,
> "megasas_sriov_start_heartbeat: "
> Â ÂÂÂÂÂÂÂ"Failed to get cmd for scsi%d\n",
> Â ÂÂÂÂÂÂÂinstance->host->host_no);
> Â return -ENOMEM;
> @@ -2188,7 +2188,7 @@ int megasas_sriov_start_heartbeat(struct
> megasas_instance *instance,
> Â ÂÂÂÂÂÂsizeof(struct
> MR_CTRL_HB_HOST_MEM),
> Â ÂÂÂÂÂÂ&instance-
> >hb_host_mem_h);
> Â if (!instance->hb_host_mem) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "SR-IOV: Couldn't allocate"
> + dev_dbg(&instance->pdev->dev, "SR-IOV:
> Couldn't allocate"
> Â ÂÂÂÂÂÂÂ" memory for heartbeat host memory
> for scsi%d\n",
> Â ÂÂÂÂÂÂÂinstance->host->host_no);
> Â retval = -ENOMEM;
> @@ -2922,7 +2922,7 @@ megasas_complete_cmd(struct megasas_instance
> *instance, struct megasas_cmd *cmd,
> Â break;
> Â
> Â default:
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "MFI FW status %#x\n",
> + dev_dbg(&instance->pdev->dev, "MFI FW status
> %#x\n",
> Â ÂÂÂÂÂÂÂhdr->cmd_status);
> Â cmd->scmd->result = DID_ERROR << 16;
> Â break;
> @@ -3332,7 +3332,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
> Â switch (fw_state) {
> Â
> Â case MFI_STATE_FAULT:
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "FW in FAULT state!!\n");
> + dev_dbg(&instance->pdev->dev, "FW in FAULT
> state!!\n");
> Â if (ocr) {
> Â max_wait = MEGASAS_RESET_WAIT_TIME;
> Â cur_state = MFI_STATE_FAULT;
> @@ -3471,7 +3471,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
> Â break;
> Â
> Â default:
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "Unknown state 0x%x\n",
> + dev_dbg(&instance->pdev->dev, "Unknown state
> 0x%x\n",
> Â ÂÂÂÂÂÂÂfw_state);
> Â return -ENODEV;
> Â }
> @@ -3493,7 +3493,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
> Â Â* Return error if fw_state hasn't changed after
> max_wait
> Â Â*/
> Â if (curr_abs_state == abs_state) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "FW state [%d] hasn't changed "
> + dev_dbg(&instance->pdev->dev, "FW state [%d]
> hasn't changed "
> Â ÂÂÂÂÂÂÂ"in %d secs\n", fw_state, max_wait);
> Â return -ENODEV;
> Â }
> @@ -3595,7 +3595,7 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)
> Â instance->pdev, total_sz,
> 256, 0);
> Â
> Â if (!instance->frame_dma_pool) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed
> to setup frame pool\n");
> + dev_dbg(&instance->pdev->dev, "failed to setup frame
> pool\n");
> Â return -ENOMEM;
> Â }
> Â
> @@ -3603,7 +3603,7 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)
> Â ÂÂÂinstance->pdev,
> 128, 4, 0);
> Â
> Â if (!instance->sense_dma_pool) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed
> to setup sense pool\n");
> + dev_dbg(&instance->pdev->dev, "failed to setup sense
> pool\n");
> Â
> Â pci_pool_destroy(instance->frame_dma_pool);
> Â instance->frame_dma_pool = NULL;
> @@ -3631,7 +3631,7 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)
> Â Â* whatever has been allocated
> Â Â*/
> Â if (!cmd->frame || !cmd->sense) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "pci_pool_alloc failed\n");
> + dev_dbg(&instance->pdev->dev,
> "pci_pool_alloc failed\n");
> Â megasas_teardown_frame_pool(instance);
> Â return -ENOMEM;
> Â }
> @@ -3710,7 +3710,7 @@ int megasas_alloc_cmds(struct megasas_instance
> *instance)
> Â instance->cmd_list = kcalloc(max_cmd, sizeof(struct
> megasas_cmd*), GFP_KERNEL);
> Â
> Â if (!instance->cmd_list) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "out of
> memory\n");
> + dev_dbg(&instance->pdev->dev, "out of memory\n");
> Â return -ENOMEM;
> Â }
> Â
> @@ -3746,7 +3746,7 @@ int megasas_alloc_cmds(struct megasas_instance
> *instance)
> Â Â* Create a frame pool and assign one frame to each cmd
> Â Â*/
> Â if (megasas_create_frame_pool(instance)) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error
> creating frame DMA pool\n");
> + dev_dbg(&instance->pdev->dev, "Error creating frame
> DMA pool\n");
> Â megasas_free_cmds(instance);
> Â }
> Â
> @@ -3775,7 +3775,7 @@ megasas_get_pd_list(struct megasas_instance
> *instance)
> Â cmd = megasas_get_cmd(instance);
> Â
> Â if (!cmd) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "(get_pd_list): Failed to get cmd\n");
> + dev_dbg(&instance->pdev->dev, "(get_pd_list): Failed
> to get cmd\n");
> Â return -ENOMEM;
> Â }
> Â
> @@ -3785,7 +3785,7 @@ megasas_get_pd_list(struct megasas_instance
> *instance)
> Â ÂÂMEGASAS_MAX_PD * sizeof(struct MR_PD_LIST),
> &ci_h);
> Â
> Â if (!ci) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed
> to alloc mem for pd_list\n");
> + dev_dbg(&instance->pdev->dev, "Failed to alloc mem
> for pd_list\n");
> Â megasas_return_cmd(instance, cmd);
> Â return -ENOMEM;
> Â }
> @@ -3870,7 +3870,7 @@ megasas_get_ld_list(struct megasas_instance
> *instance)
> Â cmd = megasas_get_cmd(instance);
> Â
> Â if (!cmd) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_get_ld_list: Failed to get cmd\n");
> + dev_dbg(&instance->pdev->dev, "megasas_get_ld_list:
> Failed to get cmd\n");
> Â return -ENOMEM;
> Â }
> Â
> @@ -3881,7 +3881,7 @@ megasas_get_ld_list(struct megasas_instance
> *instance)
> Â &ci_h);
> Â
> Â if (!ci) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed
> to alloc mem in get_ld_list\n");
> + dev_dbg(&instance->pdev->dev, "Failed to alloc mem
> in get_ld_list\n");
> Â megasas_return_cmd(instance, cmd);
> Â return -ENOMEM;
> Â }
> @@ -4094,7 +4094,7 @@ megasas_get_ctrl_info(struct megasas_instance
> *instance)
> Â cmd = megasas_get_cmd(instance);
> Â
> Â if (!cmd) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed
> to get a free cmd\n");
> + dev_dbg(&instance->pdev->dev, "Failed to get a free
> cmd\n");
> Â return -ENOMEM;
> Â }
> Â
> @@ -4104,7 +4104,7 @@ megasas_get_ctrl_info(struct megasas_instance
> *instance)
> Â ÂÂsizeof(struct megasas_ctrl_info),
> &ci_h);
> Â
> Â if (!ci) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed
> to alloc mem for ctrl info\n");
> + dev_dbg(&instance->pdev->dev, "Failed to alloc mem
> for ctrl info\n");
> Â megasas_return_cmd(instance, cmd);
> Â return -ENOMEM;
> Â }
> @@ -4341,7 +4341,7 @@ megasas_init_adapter_mfi(struct
> megasas_instance *instance)
> Â ÂÂÂÂÂ&instance-
> >reply_queue_h);
> Â
> Â if (!instance->reply_queue) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of
> DMA mem for reply queue\n");
> + dev_dbg(&instance->pdev->dev, "Out of DMA mem for
> reply queue\n");
> Â goto fail_reply_queue;
> Â }
> Â
> @@ -4504,7 +4504,7 @@ static int megasas_init_fw(struct
> megasas_instance *instance)
> Â instance->bar = find_first_bit(&bar_list, sizeof(unsigned
> long));
> Â if (pci_request_selected_regions(instance->pdev, instance-
> >bar,
> Â Â"megasas: LSI")) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO
> memory region busy!\n");
> + dev_dbg(&instance->pdev->dev, "IO memory region
> busy!\n");
> Â return -EBUSY;
> Â }
> Â
> @@ -4512,7 +4512,7 @@ static int megasas_init_fw(struct
> megasas_instance *instance)
> Â instance->reg_set = ioremap_nocache(base_addr, 8192);
> Â
> Â if (!instance->reg_set) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed
> to map IO mem\n");
> + dev_dbg(&instance->pdev->dev, "Failed to map IO
> mem\n");
> Â goto fail_ioremap;
> Â }
> Â
> @@ -4958,7 +4958,7 @@ megasas_register_aen(struct megasas_instance
> *instance, u32 seq_num,
> Â ÂÂae
> n_cmd, 30);
> Â
> Â if (ret_val) {
> - dev_printk(KERN_DEBUG, &instance-
> >pdev->dev, "Failed to abort "
> + dev_dbg(&instance->pdev->dev,
> "Failed to abort "
> Â ÂÂÂÂÂÂÂ"previous AEN command\n");
> Â return ret_val;
> Â }
> @@ -5204,7 +5204,7 @@ static int megasas_probe_one(struct pci_dev
> *pdev,
> Â ÂÂÂÂÂÂÂsizeof(struct megasas_instance));
> Â
> Â if (!host) {
> - dev_printk(KERN_DEBUG, &pdev->dev, "scsi_host_alloc
> failed\n");
> + dev_dbg(&pdev->dev, "scsi_host_alloc failed\n");
> Â goto fail_alloc_instance;
> Â }
> Â
> @@ -5224,7 +5224,7 @@ static int megasas_probe_one(struct pci_dev
> *pdev,
> Â instance->ctrl_context = (void
> *)__get_free_pages(GFP_KERNEL,
> Â instance->ctrl_context_pages);
> Â if (!instance->ctrl_context) {
> - dev_printk(KERN_DEBUG, &pdev->dev, "Failed
> to allocate "
> + dev_dbg(&pdev->dev, "Failed to allocate "
> Â ÂÂÂÂÂÂÂ"memory for Fusion context info\n");
> Â goto fail_alloc_dma_buf;
> Â }
> @@ -5243,7 +5243,7 @@ static int megasas_probe_one(struct pci_dev
> *pdev,
> Â ÂÂÂÂÂ&instance->consumer_h);
> Â
> Â if (!instance->producer || !instance->consumer) {
> - dev_printk(KERN_DEBUG, &pdev->dev, "Failed
> to allocate"
> + dev_dbg(&pdev->dev, "Failed to allocate"
> Â ÂÂÂÂÂÂÂ"memory for producer, consumer\n");
> Â goto fail_alloc_dma_buf;
> Â }
> @@ -5290,7 +5290,7 @@ static int megasas_probe_one(struct pci_dev
> *pdev,
> Â ÂÂÂÂ&instance-
> >evt_detail_h);
> Â
> Â if (!instance->evt_detail) {
> - dev_printk(KERN_DEBUG, &pdev->dev, "Failed to
> allocate memory for "
> + dev_dbg(&pdev->dev, "Failed to allocate memory for "
> Â ÂÂÂÂÂÂÂ"event detail structure\n");
> Â goto fail_alloc_dma_buf;
> Â }
> @@ -5397,7 +5397,7 @@ static int megasas_probe_one(struct pci_dev
> *pdev,
> Â Â* Initiate AEN (Asynchronous Event Notification)
> Â Â*/
> Â if (megasas_start_aen(instance)) {
> - dev_printk(KERN_DEBUG, &pdev->dev, "start aen
> failed\n");
> + dev_dbg(&pdev->dev, "start aen failed\n");
> Â goto fail_start_aen;
> Â }
> Â
> @@ -5973,14 +5973,14 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
> Â memset(kbuff_arr, 0, sizeof(kbuff_arr));
> Â
> Â if (ioc->sge_count > MAX_IOCTL_SGE) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "SGE
> count [%d] >ÂÂmax limit [%d]\n",
> + dev_dbg(&instance->pdev->dev, "SGE count [%d] >ÂÂmax
> limit [%d]\n",
> Â ÂÂÂÂÂÂÂioc->sge_count, MAX_IOCTL_SGE);
> Â return -EINVAL;
> Â }
> Â
> Â cmd = megasas_get_cmd(instance);
> Â if (!cmd) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed
> to get a cmd packet\n");
> + dev_dbg(&instance->pdev->dev, "Failed to get a cmd
> packet\n");
> Â return -ENOMEM;
> Â }
> Â
> @@ -6025,7 +6025,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
> Â ÂÂÂÂioc-
> >sgl[i].iov_len,
> Â ÂÂÂÂ&buf_handle,
> GFP_KERNEL);
> Â if (!kbuff_arr[i]) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "Failed to alloc "
> + dev_dbg(&instance->pdev->dev, "Failed to
> alloc "
> Â ÂÂÂÂÂÂÂ"kernel SGL buffer for IOCTL\n");
> Â error = -ENOMEM;
> Â goto out;
> @@ -6111,7 +6111,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
> Â Â*/
> Â if (copy_to_user(&user_ioc->frame.hdr.cmd_status,
> Â Â&cmd->frame->hdr.cmd_status, sizeof(u8))) {
> - dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error
> copying out cmd_status\n");
> + dev_dbg(&instance->pdev->dev, "Error copying out
> cmd_status\n");
> Â error = -EFAULT;
> Â }
> Â

Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>

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