Date:2011-07-07 01:50:53 (9 years 2 months ago)
Author:Werner Almesberger
Commit:b003725a33d5181611edf5d00e80e40563d277ab
Message:atusb: adjusted dev_* severity levels

The driver should now be quiet after initialization unless there's
some problem.

Signed-off-by: Werner Almesberger <werner@almesberger.net>
Files: drivers/spi/atusb.c (21 diffs)

Change Details

drivers/spi/atusb.c
1515 * - check URB killing in atusb_disconnect for races
1616 * - switch from bulk to interrupt endpoint
1717 * - implement buffer read without extra copy
18 * - decrease debug chatter
1918 * - harmonize indentation style
2019 * - mv atusb.c ../ieee802.15.4/spi_atusb.c, or maybe atrf_atusb.c or such
2120 * - check module load/unload
21 * - review dev_* severity levels
2222 */
2323
2424#include <linux/kernel.h>
...... 
165165{
166166    struct urb *urb = (void *) data;
167167
168    printk(KERN_INFO "atusb_timer\n");
168    dev_vdbg(&urb->dev->dev, "atusb_timer\n");
169169    atusb_async_finish(urb);
170170}
171171
...... 
237237    retval = usb_submit_urb(urb, GFP_KERNEL);
238238    if (!retval)
239239        return 0;
240    dev_info(&dev->dev, "failed submitting read urb, error %d",
240    dev_warn(&dev->dev, "failed submitting read urb, error %d",
241241        retval);
242242    retval = retval == -ENOMEM ? retval : -EIO;
243243
...... 
255255static int atusb_read1(struct atusb_local *atusb,
256256    uint8_t tx, uint8_t *rx, int len)
257257{
258    dev_info(&atusb->udev->dev, "atusb_read1: tx = 0x%x\n", tx);
258    dev_dbg(&atusb->udev->dev, "atusb_read1: tx = 0x%x\n", tx);
259259    return submit_control_msg(atusb,
260260        ATUSB_SPI_READ1, ATUSB_FROM_DEV, tx, 0,
261261        rx, 1, atusb_ctrl_cb, atusb);
...... 
264264static int atusb_read_fb(struct atusb_local *atusb,
265265    uint8_t tx, uint8_t *rx0, uint8_t *rx, int len)
266266{
267    dev_info(&atusb->udev->dev, "atusb_read_fb: tx = 0x%x\n", tx);
267    dev_dbg(&atusb->udev->dev, "atusb_read_fb: tx = 0x%x\n", tx);
268268    return submit_control_msg(atusb,
269269        ATUSB_SPI_READ1, ATUSB_FROM_DEV, tx, 0,
270270        atusb->buffer, len+1, atusb_read_fb_cb, atusb);
...... 
275275{
276276    usb_complete_t cb = atusb_ctrl_cb;
277277
278    dev_info(&atusb->udev->dev, "atusb_write: tx[0] = 0x%x\n", tx0);
279    dev_info(&atusb->udev->dev, "atusb_write: tx[1] = 0x%x\n", tx1);
278    dev_dbg(&atusb->udev->dev,
279        "atusb_write: tx0 = 0x%x tx1 = 0x%x\n", tx0, tx1);
280280
281281    /*
282282     * The AT86RF230 driver sometimes requires a transceiver state
...... 
317317    n = 0;
318318    list_for_each_entry(xfer, &msg->transfers, transfer_list) {
319319        if (n == ARRAY_SIZE(x)) {
320            dev_info(&atusb->udev->dev, "too many transfers\n");
320            dev_err(&atusb->udev->dev, "too many transfers\n");
321321            return -EINVAL;
322322        }
323323        x[n] = xfer;
...... 
334334        goto bad_req;
335335    if (n == 1) {
336336        if (rx) {
337            dev_info(&atusb->udev->dev, "read 1\n");
337            dev_dbg(&atusb->udev->dev, "read 1\n");
338338            retval = atusb_read1(atusb, tx[0], rx+1, len-1);
339339        } else {
340            dev_info(&atusb->udev->dev, "write 2\n");
340            dev_dbg(&atusb->udev->dev, "write 2\n");
341341            /*
342342             * Don't take our clock away !! ;-)
343343             */
...... 
353353        if (x[0]->rx_buf) {
354354            if (x[1]->tx_buf || !x[1]->rx_buf)
355355                goto bad_req;
356            dev_info(&atusb->udev->dev, "read 1+\n");
356            dev_dbg(&atusb->udev->dev, "read 1+\n");
357357            retval = atusb_read_fb(atusb, tx[0], rx+1,
358358                x[1]->rx_buf, x[1]->len);
359359        } else {
360360            if (!x[1]->tx_buf ||x[1]->rx_buf)
361361                goto bad_req;
362            dev_info(&atusb->udev->dev, "write 2+n\n");
362            dev_dbg(&atusb->udev->dev, "write 2+n\n");
363363            retval = atusb_write(atusb, tx[0], tx[1],
364364                x[1]->tx_buf, x[1]->len);
365365        }
...... 
367367    return retval;
368368
369369bad_req:
370    dev_info(&atusb->udev->dev, "unrecognized request:\n");
370    dev_err(&atusb->udev->dev, "unrecognized request:\n");
371371    list_for_each_entry(xfer, &msg->transfers, transfer_list)
372        dev_info(&atusb->udev->dev, "%stx %srx len %u\n",
372        dev_err(&atusb->udev->dev, "%stx %srx len %u\n",
373373            xfer->tx_buf ? "" : "!", xfer->rx_buf ? " " : "!",
374374            xfer->len);
375375    return -EINVAL;
...... 
395395{
396396    struct atusb_local *atusb = urb->context;
397397
398    printk(KERN_INFO "atusb_irq (%d)\n", urb->status);
398    dev_dbg(&urb->dev->dev, "atusb_irq (%d)\n", urb->status);
399399    usb_free_urb(urb);
400400    atusb->irq_urb = NULL;
401401    tasklet_schedule(&atusb->task);
...... 
409409
410410    BUG_ON(atusb->irq_urb);
411411
412    printk(KERN_INFO "atusb_arm_interrupt\n");
412    dev_vdbg(&dev->dev, "atusb_arm_interrupt\n");
413413    urb = usb_alloc_urb(0, GFP_KERNEL);
414414    if (!urb) {
415415        dev_err(&dev->dev,
...... 
436436{
437437    struct atusb_local *atusb = irq_data_get_irq_chip_data(data);
438438
439    printk(KERN_INFO "atusb_irq_mask\n");
439    dev_vdbg(&atusb->udev->dev, "atusb_irq_mask\n");
440440    tasklet_disable_nosync(&atusb->task);
441441}
442442
...... 
444444{
445445    struct atusb_local *atusb = irq_data_get_irq_chip_data(data);
446446
447    printk(KERN_INFO "atusb_irq_unmask\n");
447    dev_vdbg(&atusb->udev->dev, "atusb_irq_unmask\n");
448448    tasklet_enable(&atusb->task);
449449}
450450
...... 
452452{
453453    struct atusb_local *atusb = irq_data_get_irq_chip_data(data);
454454
455    printk(KERN_INFO "atusb_irq_ack\n");
455    dev_vdbg(&atusb->udev->dev, "atusb_irq_ack\n");
456456    atusb_arm_interrupt(atusb);
457457}
458458
...... 
477477        ATUSB_RF_RESET, ATUSB_TO_DEV, 0, 0,
478478        NULL, 0, 1000);
479479    if (retval < 0) {
480        dev_info(&atusb->udev->dev,
480        dev_err(&atusb->udev->dev,
481481            "%s: error doing reset retval = %d\n",
482482            __func__, retval);
483483    }
...... 
525525        ATUSB_BUILD, ATUSB_FROM_DEV, 0, 0,
526526        build, ATUSB_BUILD_SIZE, 1000);
527527    if (retval < 0) {
528        dev_info(&dev->dev,
528        dev_err(&dev->dev,
529529            "failed submitting urb for ATUSB_BUILD, error %d\n",
530530            retval);
531531        return retval == -ENOMEM ? retval : -EIO;
...... 
571571     */
572572    if (interface->cur_altsetting->desc.bInterfaceClass !=
573573        USB_CLASS_VENDOR_SPEC) {
574        dev_info(&udev->dev,
574        dev_dbg(&udev->dev,
575575            "Ignoring interface with class 0x%02x\n",
576576            interface->cur_altsetting->desc.bInterfaceClass);
577577        return -ENODEV;
...... 
596596
597597    atusb->slave_irq = irq_alloc_desc(numa_node_id());
598598    if (atusb->slave_irq < 0) {
599        dev_info(&udev->dev, "can't allocate slave irq\n");
599        dev_err(&udev->dev, "can't allocate slave irq\n");
600600        retval = -ENXIO;
601601        goto err_free;
602602    }
...... 
609609
610610    retval = spi_register_master(master);
611611    if (retval < 0) {
612        dev_info(&udev->dev, "can't register spi master\n");
612        dev_err(&udev->dev, "can't register spi master\n");
613613        goto err_slave_irq;
614614    }
615615
...... 
632632
633633    atusb->spi = spi_new_device(master, &board_info);
634634    if (!atusb->spi) {
635        dev_info(&udev->dev, "can't create new device for %s\n",
635        dev_err(&udev->dev, "can't create new device for %s\n",
636636            board_info.modalias);
637637        goto err_master;
638638    }

Archive Download the corresponding diff file



interactive