Commit 509cd826 authored by Joe Perches's avatar Joe Perches Committed by Mauro Carvalho Chehab

[media] media: earthsoft: logging neatening

Use dev_err instead of pt1_printk
o reduce object code size
o remove now unused pt1_printk macro

Neaten dev_<level> uses in pt3
o add missing newlines
o align arguments
o remove unnecessary OOM messages as there's a generic one
o typo fixes in messages
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 30934dd3
...@@ -109,9 +109,6 @@ struct pt1_adapter { ...@@ -109,9 +109,6 @@ struct pt1_adapter {
int sleep; int sleep;
}; };
#define pt1_printk(level, pt1, format, arg...) \
dev_printk(level, &(pt1)->pdev->dev, format, ##arg)
static void pt1_write_reg(struct pt1 *pt1, int reg, u32 data) static void pt1_write_reg(struct pt1 *pt1, int reg, u32 data)
{ {
writel(data, pt1->regs + reg * 4); writel(data, pt1->regs + reg * 4);
...@@ -154,7 +151,7 @@ static int pt1_sync(struct pt1 *pt1) ...@@ -154,7 +151,7 @@ static int pt1_sync(struct pt1 *pt1)
return 0; return 0;
pt1_write_reg(pt1, 0, 0x00000008); pt1_write_reg(pt1, 0, 0x00000008);
} }
pt1_printk(KERN_ERR, pt1, "could not sync\n"); dev_err(&pt1->pdev->dev, "could not sync\n");
return -EIO; return -EIO;
} }
...@@ -179,7 +176,7 @@ static int pt1_unlock(struct pt1 *pt1) ...@@ -179,7 +176,7 @@ static int pt1_unlock(struct pt1 *pt1)
return 0; return 0;
schedule_timeout_uninterruptible((HZ + 999) / 1000); schedule_timeout_uninterruptible((HZ + 999) / 1000);
} }
pt1_printk(KERN_ERR, pt1, "could not unlock\n"); dev_err(&pt1->pdev->dev, "could not unlock\n");
return -EIO; return -EIO;
} }
...@@ -193,7 +190,7 @@ static int pt1_reset_pci(struct pt1 *pt1) ...@@ -193,7 +190,7 @@ static int pt1_reset_pci(struct pt1 *pt1)
return 0; return 0;
schedule_timeout_uninterruptible((HZ + 999) / 1000); schedule_timeout_uninterruptible((HZ + 999) / 1000);
} }
pt1_printk(KERN_ERR, pt1, "could not reset PCI\n"); dev_err(&pt1->pdev->dev, "could not reset PCI\n");
return -EIO; return -EIO;
} }
...@@ -207,7 +204,7 @@ static int pt1_reset_ram(struct pt1 *pt1) ...@@ -207,7 +204,7 @@ static int pt1_reset_ram(struct pt1 *pt1)
return 0; return 0;
schedule_timeout_uninterruptible((HZ + 999) / 1000); schedule_timeout_uninterruptible((HZ + 999) / 1000);
} }
pt1_printk(KERN_ERR, pt1, "could not reset RAM\n"); dev_err(&pt1->pdev->dev, "could not reset RAM\n");
return -EIO; return -EIO;
} }
...@@ -224,7 +221,7 @@ static int pt1_do_enable_ram(struct pt1 *pt1) ...@@ -224,7 +221,7 @@ static int pt1_do_enable_ram(struct pt1 *pt1)
} }
schedule_timeout_uninterruptible((HZ + 999) / 1000); schedule_timeout_uninterruptible((HZ + 999) / 1000);
} }
pt1_printk(KERN_ERR, pt1, "could not enable RAM\n"); dev_err(&pt1->pdev->dev, "could not enable RAM\n");
return -EIO; return -EIO;
} }
......
...@@ -255,7 +255,7 @@ static int pt3_fe_init(struct pt3_board *pt3) ...@@ -255,7 +255,7 @@ static int pt3_fe_init(struct pt3_board *pt3)
pt3_i2c_reset(pt3); pt3_i2c_reset(pt3);
ret = pt3_init_all_demods(pt3); ret = pt3_init_all_demods(pt3);
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, "Failed to init demod chips."); dev_warn(&pt3->pdev->dev, "Failed to init demod chips\n");
return ret; return ret;
} }
...@@ -271,7 +271,7 @@ static int pt3_fe_init(struct pt3_board *pt3) ...@@ -271,7 +271,7 @@ static int pt3_fe_init(struct pt3_board *pt3)
init0_ter, ARRAY_SIZE(init0_ter)); init0_ter, ARRAY_SIZE(init0_ter));
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, dev_warn(&pt3->pdev->dev,
"demod[%d] faild in init sequence0.", i); "demod[%d] failed in init sequence0\n", i);
return ret; return ret;
} }
ret = fe->ops.init(fe); ret = fe->ops.init(fe);
...@@ -282,7 +282,7 @@ static int pt3_fe_init(struct pt3_board *pt3) ...@@ -282,7 +282,7 @@ static int pt3_fe_init(struct pt3_board *pt3)
usleep_range(2000, 4000); usleep_range(2000, 4000);
ret = pt3_set_tuner_power(pt3, true, false); ret = pt3_set_tuner_power(pt3, true, false);
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, "Failed to control tuner module."); dev_warn(&pt3->pdev->dev, "Failed to control tuner module\n");
return ret; return ret;
} }
...@@ -297,7 +297,7 @@ static int pt3_fe_init(struct pt3_board *pt3) ...@@ -297,7 +297,7 @@ static int pt3_fe_init(struct pt3_board *pt3)
cfg_ter, ARRAY_SIZE(cfg_ter)); cfg_ter, ARRAY_SIZE(cfg_ter));
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, dev_warn(&pt3->pdev->dev,
"demod[%d] faild in init sequence1.", i); "demod[%d] failed in init sequence1\n", i);
return ret; return ret;
} }
} }
...@@ -311,19 +311,19 @@ static int pt3_fe_init(struct pt3_board *pt3) ...@@ -311,19 +311,19 @@ static int pt3_fe_init(struct pt3_board *pt3)
ret = fe->ops.tuner_ops.init(fe); ret = fe->ops.tuner_ops.init(fe);
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, dev_warn(&pt3->pdev->dev,
"Failed to init SAT-tuner[%d].", i); "Failed to init SAT-tuner[%d]\n", i);
return ret; return ret;
} }
} }
ret = pt3_init_all_mxl301rf(pt3); ret = pt3_init_all_mxl301rf(pt3);
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, "Failed to init TERR-tuners."); dev_warn(&pt3->pdev->dev, "Failed to init TERR-tuners\n");
return ret; return ret;
} }
ret = pt3_set_tuner_power(pt3, true, true); ret = pt3_set_tuner_power(pt3, true, true);
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, "Failed to control tuner module."); dev_warn(&pt3->pdev->dev, "Failed to control tuner module\n");
return ret; return ret;
} }
...@@ -344,7 +344,7 @@ static int pt3_fe_init(struct pt3_board *pt3) ...@@ -344,7 +344,7 @@ static int pt3_fe_init(struct pt3_board *pt3)
} }
if (ret < 0) { if (ret < 0) {
dev_warn(&pt3->pdev->dev, dev_warn(&pt3->pdev->dev,
"Failed in initial tuning of tuner[%d].", i); "Failed in initial tuning of tuner[%d]\n", i);
return ret; return ret;
} }
} }
...@@ -366,7 +366,7 @@ static int pt3_fe_init(struct pt3_board *pt3) ...@@ -366,7 +366,7 @@ static int pt3_fe_init(struct pt3_board *pt3)
fe->ops.set_lna = &pt3_set_lna; fe->ops.set_lna = &pt3_set_lna;
} }
if (i < PT3_NUM_FE) { if (i < PT3_NUM_FE) {
dev_warn(&pt3->pdev->dev, "FE[%d] failed to standby.", i); dev_warn(&pt3->pdev->dev, "FE[%d] failed to standby\n", i);
return ret; return ret;
} }
return 0; return 0;
...@@ -453,8 +453,8 @@ static int pt3_fetch_thread(void *data) ...@@ -453,8 +453,8 @@ static int pt3_fetch_thread(void *data)
pt3_init_dmabuf(adap); pt3_init_dmabuf(adap);
adap->num_discard = PT3_INITIAL_BUF_DROPS; adap->num_discard = PT3_INITIAL_BUF_DROPS;
dev_dbg(adap->dvb_adap.device, dev_dbg(adap->dvb_adap.device, "PT3: [%s] started\n",
"PT3: [%s] started.\n", adap->thread->comm); adap->thread->comm);
set_freezable(); set_freezable();
while (!kthread_freezable_should_stop(&was_frozen)) { while (!kthread_freezable_should_stop(&was_frozen)) {
if (was_frozen) if (was_frozen)
...@@ -468,8 +468,8 @@ static int pt3_fetch_thread(void *data) ...@@ -468,8 +468,8 @@ static int pt3_fetch_thread(void *data)
PT3_FETCH_DELAY_DELTA * NSEC_PER_MSEC, PT3_FETCH_DELAY_DELTA * NSEC_PER_MSEC,
HRTIMER_MODE_REL); HRTIMER_MODE_REL);
} }
dev_dbg(adap->dvb_adap.device, dev_dbg(adap->dvb_adap.device, "PT3: [%s] exited\n",
"PT3: [%s] exited.\n", adap->thread->comm); adap->thread->comm);
adap->thread = NULL; adap->thread = NULL;
return 0; return 0;
} }
...@@ -485,8 +485,8 @@ static int pt3_start_streaming(struct pt3_adapter *adap) ...@@ -485,8 +485,8 @@ static int pt3_start_streaming(struct pt3_adapter *adap)
int ret = PTR_ERR(thread); int ret = PTR_ERR(thread);
dev_warn(adap->dvb_adap.device, dev_warn(adap->dvb_adap.device,
"PT3 (adap:%d, dmx:%d): failed to start kthread.\n", "PT3 (adap:%d, dmx:%d): failed to start kthread\n",
adap->dvb_adap.num, adap->dmxdev.dvbdev->id); adap->dvb_adap.num, adap->dmxdev.dvbdev->id);
return ret; return ret;
} }
adap->thread = thread; adap->thread = thread;
...@@ -501,8 +501,8 @@ static int pt3_stop_streaming(struct pt3_adapter *adap) ...@@ -501,8 +501,8 @@ static int pt3_stop_streaming(struct pt3_adapter *adap)
ret = pt3_stop_dma(adap); ret = pt3_stop_dma(adap);
if (ret) if (ret)
dev_warn(adap->dvb_adap.device, dev_warn(adap->dvb_adap.device,
"PT3: failed to stop streaming of adap:%d/FE:%d\n", "PT3: failed to stop streaming of adap:%d/FE:%d\n",
adap->dvb_adap.num, adap->fe->id); adap->dvb_adap.num, adap->fe->id);
/* kill the fetching thread */ /* kill the fetching thread */
ret = kthread_stop(adap->thread); ret = kthread_stop(adap->thread);
...@@ -522,8 +522,8 @@ static int pt3_start_feed(struct dvb_demux_feed *feed) ...@@ -522,8 +522,8 @@ static int pt3_start_feed(struct dvb_demux_feed *feed)
return 0; return 0;
if (adap->num_feeds != 1) { if (adap->num_feeds != 1) {
dev_warn(adap->dvb_adap.device, dev_warn(adap->dvb_adap.device,
"%s: unmatched start/stop_feed in adap:%i/dmx:%i.\n", "%s: unmatched start/stop_feed in adap:%i/dmx:%i\n",
__func__, adap->dvb_adap.num, adap->dmxdev.dvbdev->id); __func__, adap->dvb_adap.num, adap->dmxdev.dvbdev->id);
adap->num_feeds = 1; adap->num_feeds = 1;
} }
...@@ -553,10 +553,9 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index) ...@@ -553,10 +553,9 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index)
struct dvb_adapter *da; struct dvb_adapter *da;
adap = kzalloc(sizeof(*adap), GFP_KERNEL); adap = kzalloc(sizeof(*adap), GFP_KERNEL);
if (!adap) { if (!adap)
dev_err(&pt3->pdev->dev, "failed to alloc mem for adapter.\n");
return -ENOMEM; return -ENOMEM;
}
pt3->adaps[index] = adap; pt3->adaps[index] = adap;
adap->adap_idx = index; adap->adap_idx = index;
...@@ -565,7 +564,7 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index) ...@@ -565,7 +564,7 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index)
THIS_MODULE, &pt3->pdev->dev, adapter_nr); THIS_MODULE, &pt3->pdev->dev, adapter_nr);
if (ret < 0) { if (ret < 0) {
dev_err(&pt3->pdev->dev, dev_err(&pt3->pdev->dev,
"failed to register adapter dev.\n"); "failed to register adapter dev\n");
goto err_mem; goto err_mem;
} }
da = &adap->dvb_adap; da = &adap->dvb_adap;
...@@ -581,7 +580,7 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index) ...@@ -581,7 +580,7 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index)
adap->demux.stop_feed = pt3_stop_feed; adap->demux.stop_feed = pt3_stop_feed;
ret = dvb_dmx_init(&adap->demux); ret = dvb_dmx_init(&adap->demux);
if (ret < 0) { if (ret < 0) {
dev_err(&pt3->pdev->dev, "failed to init dmx dev.\n"); dev_err(&pt3->pdev->dev, "failed to init dmx dev\n");
goto err_adap; goto err_adap;
} }
...@@ -589,13 +588,13 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index) ...@@ -589,13 +588,13 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index)
adap->dmxdev.demux = &adap->demux.dmx; adap->dmxdev.demux = &adap->demux.dmx;
ret = dvb_dmxdev_init(&adap->dmxdev, da); ret = dvb_dmxdev_init(&adap->dmxdev, da);
if (ret < 0) { if (ret < 0) {
dev_err(&pt3->pdev->dev, "failed to init dmxdev.\n"); dev_err(&pt3->pdev->dev, "failed to init dmxdev\n");
goto err_demux; goto err_demux;
} }
ret = pt3_alloc_dmabuf(adap); ret = pt3_alloc_dmabuf(adap);
if (ret) { if (ret) {
dev_err(&pt3->pdev->dev, "failed to alloc DMA buffers.\n"); dev_err(&pt3->pdev->dev, "failed to alloc DMA buffers\n");
goto err_dmabuf; goto err_dmabuf;
} }
...@@ -695,7 +694,7 @@ static int pt3_resume(struct device *dev) ...@@ -695,7 +694,7 @@ static int pt3_resume(struct device *dev)
dvb_frontend_resume(adap->fe); dvb_frontend_resume(adap->fe);
ret = pt3_alloc_dmabuf(adap); ret = pt3_alloc_dmabuf(adap);
if (ret) { if (ret) {
dev_err(&pt3->pdev->dev, "failed to alloc DMA bufs.\n"); dev_err(&pt3->pdev->dev, "failed to alloc DMA bufs\n");
continue; continue;
} }
if (adap->num_feeds > 0) if (adap->num_feeds > 0)
...@@ -753,15 +752,14 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -753,15 +752,14 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret == 0) if (ret == 0)
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
else { else {
dev_err(&pdev->dev, "Failed to set DMA mask.\n"); dev_err(&pdev->dev, "Failed to set DMA mask\n");
goto err_release_regions; goto err_release_regions;
} }
dev_info(&pdev->dev, "Use 32bit DMA.\n"); dev_info(&pdev->dev, "Use 32bit DMA\n");
} }
pt3 = kzalloc(sizeof(*pt3), GFP_KERNEL); pt3 = kzalloc(sizeof(*pt3), GFP_KERNEL);
if (!pt3) { if (!pt3) {
dev_err(&pdev->dev, "Failed to alloc mem for this dev.\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_release_regions; goto err_release_regions;
} }
...@@ -771,15 +769,15 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -771,15 +769,15 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pt3->regs[0] = pci_ioremap_bar(pdev, 0); pt3->regs[0] = pci_ioremap_bar(pdev, 0);
pt3->regs[1] = pci_ioremap_bar(pdev, 2); pt3->regs[1] = pci_ioremap_bar(pdev, 2);
if (pt3->regs[0] == NULL || pt3->regs[1] == NULL) { if (pt3->regs[0] == NULL || pt3->regs[1] == NULL) {
dev_err(&pdev->dev, "Failed to ioremap.\n"); dev_err(&pdev->dev, "Failed to ioremap\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_kfree; goto err_kfree;
} }
ver = ioread32(pt3->regs[0] + REG_VERSION); ver = ioread32(pt3->regs[0] + REG_VERSION);
if ((ver >> 16) != 0x0301) { if ((ver >> 16) != 0x0301) {
dev_warn(&pdev->dev, "PT%d, I/F-ver.:%d not supported", dev_warn(&pdev->dev, "PT%d, I/F-ver.:%d not supported\n",
ver >> 24, (ver & 0x00ff0000) >> 16); ver >> 24, (ver & 0x00ff0000) >> 16);
ret = -ENODEV; ret = -ENODEV;
goto err_iounmap; goto err_iounmap;
} }
...@@ -788,7 +786,6 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -788,7 +786,6 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pt3->i2c_buf = kmalloc(sizeof(*pt3->i2c_buf), GFP_KERNEL); pt3->i2c_buf = kmalloc(sizeof(*pt3->i2c_buf), GFP_KERNEL);
if (pt3->i2c_buf == NULL) { if (pt3->i2c_buf == NULL) {
dev_err(&pdev->dev, "Failed to alloc mem for i2c.\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_iounmap; goto err_iounmap;
} }
...@@ -801,7 +798,7 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -801,7 +798,7 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
i2c_set_adapdata(i2c, pt3); i2c_set_adapdata(i2c, pt3);
ret = i2c_add_adapter(i2c); ret = i2c_add_adapter(i2c);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Failed to add i2c adapter.\n"); dev_err(&pdev->dev, "Failed to add i2c adapter\n");
goto err_i2cbuf; goto err_i2cbuf;
} }
...@@ -815,20 +812,20 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -815,20 +812,20 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
break; break;
} }
if (i < PT3_NUM_FE) { if (i < PT3_NUM_FE) {
dev_err(&pdev->dev, "Failed to create FE%d.\n", i); dev_err(&pdev->dev, "Failed to create FE%d\n", i);
goto err_cleanup_adapters; goto err_cleanup_adapters;
} }
ret = pt3_fe_init(pt3); ret = pt3_fe_init(pt3);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Failed to init frontends.\n"); dev_err(&pdev->dev, "Failed to init frontends\n");
i = PT3_NUM_FE - 1; i = PT3_NUM_FE - 1;
goto err_cleanup_adapters; goto err_cleanup_adapters;
} }
dev_info(&pdev->dev, dev_info(&pdev->dev,
"successfully init'ed PT%d (fw:0x%02x, I/F:0x%02x).\n", "successfully init'ed PT%d (fw:0x%02x, I/F:0x%02x)\n",
ver >> 24, (ver >> 8) & 0xff, (ver >> 16) & 0xff); ver >> 24, (ver >> 8) & 0xff, (ver >> 16) & 0xff);
return 0; return 0;
err_cleanup_adapters: err_cleanup_adapters:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment