diff --git a/bridge/it66121_drv.c b/bridge/it66121_drv.c index 0540961..caa618f 100644 --- a/bridge/it66121_drv.c +++ b/bridge/it66121_drv.c @@ -898,10 +898,7 @@ static int __init it66121_probe(void) return 0; } -static const struct i2c_device_id it66121_ids[] = { - { "it66121", 0 }, - { } -}; +static const struct i2c_device_id it66121_ids[] = { { "it66121", 0 }, {} }; MODULE_DEVICE_TABLE(i2c, it66121_ids); static struct i2c_driver it66121_driver = { diff --git a/fl2000.h b/fl2000.h index 3a3324f..3b5edd9 100644 --- a/fl2000.h +++ b/fl2000.h @@ -39,6 +39,7 @@ #include #include #include +#include #include "fl2000_registers.h" @@ -103,7 +104,7 @@ void fl2000_streaming_destroy(struct usb_interface *interface); /* ... and interface */ int fl2000_streaming_mode_set(struct usb_device *usb_dev, int pixels, u32 bytes_pix); void fl2000_streaming_compress(struct usb_device *usb_dev, void *src, unsigned int height, - unsigned int width, unsigned int pitch); + unsigned int width, unsigned int pitch); int fl2000_streaming_enable(struct usb_device *usb_dev); void fl2000_streaming_disable(struct usb_device *usb_dev); @@ -138,6 +139,6 @@ int fl2000_drm_init(struct usb_device *usb_dev); void fl2000_drm_cleanup(struct usb_device *usb_dev); /* ... and interface */ void fl2000_drm_hotplug(struct usb_device *usb_dev); -bool fl2000_drm_vblank(struct usb_device *usb_dev); +void fl2000_drm_vblank(struct usb_device *usb_dev); #endif /* __FL2000_DRM_H__ */ diff --git a/fl2000_drm.c b/fl2000_drm.c index 2e024bc..1e3427d 100644 --- a/fl2000_drm.c +++ b/fl2000_drm.c @@ -24,8 +24,8 @@ static const u32 fl2000_pixel_formats[] = { DRM_FORMAT_XRGB8888, }; -/* IT66121 HDMI bridge driver name*/ -static const char *const fl2000_supported_bridge = "it66121"; +/* TODO: This has to come from driver parameters */ +static char *fl2000_supported_bridge = "it66121"; /* Maximum pixel clock set to 500MHz. It is hard to get more or less precise PLL configuration for * higher clock @@ -93,6 +93,7 @@ struct fl2000_drm_if { struct drm_device drm; struct drm_simple_display_pipe pipe; struct usb_device *usb_dev; + bool vblank_enabled; }; DEFINE_DRM_GEM_DMA_FOPS(fl2000_drm_driver_fops); @@ -340,6 +341,26 @@ static void fl2000_display_update(struct drm_simple_display_pipe *pipe, } } +static int fl2000_display_enable_vblank(struct drm_simple_display_pipe *pipe) +{ + struct drm_crtc *crtc = &pipe->crtc; + struct drm_device *drm = crtc->dev; + struct fl2000_drm_if *drm_if = container_of(drm, struct fl2000_drm_if, drm); + + drm_if->vblank_enabled = true; + + return 0; +} + +static void fl2000_display_disable_vblank(struct drm_simple_display_pipe *pipe) +{ + struct drm_crtc *crtc = &pipe->crtc; + struct drm_device *drm = crtc->dev; + struct fl2000_drm_if *drm_if = container_of(drm, struct fl2000_drm_if, drm); + + drm_if->vblank_enabled = false; +} + /* Logical pipe management (no HW configuration here) */ static const struct drm_simple_display_pipe_funcs fl2000_display_funcs = { .mode_valid = fl2000_display_mode_valid, @@ -420,25 +441,32 @@ void fl2000_drm_hotplug(struct usb_device *usb_dev) return; } - drm_kms_helper_hotplug_event(drm_if->drm); + drm_kms_helper_hotplug_event(&drm_if->drm); } -bool fl2000_drm_vblank(struct usb_device *usb_dev) +void fl2000_drm_vblank(struct usb_device *usb_dev) { + int ret; struct fl2000_drm_if *drm_if; + struct drm_crtc *crtc; drm_if = dev_get_drvdata(&usb_dev->dev); if (!drm_if) { dev_err(&usb_dev->dev, "Cannot find DRM structure!"); - return false; + return; } - drm_crtc_handle_vblank(drm_if->crtc); + if (!drm_if->vblank_enabled) + return; + + crtc = &drm_if->pipe.crtc; + ret = drm_crtc_handle_vblank(crtc); + if (ret) + dev_err(&usb_dev->dev, "Cannot handle vblank event (%d)", ret); } static int fl2000_drm_modeset_init(struct drm_device *drm) { - return 0; } @@ -452,6 +480,12 @@ static int fl2000_drm_bind(struct device *master) dev_info(master, "Binding FL2000 master"); + drm_if = dev_get_drvdata(&usb_dev->dev); + if (!drm_if) { + dev_err(&usb_dev->dev, "Cannot find DRM structure!"); + return -ENODEV; + } + /* Attach bridge */ ret = component_bind_all(master, &drm_if->pipe); if (ret) { @@ -459,6 +493,7 @@ static int fl2000_drm_bind(struct device *master) return ret; } + drm = &drm_if->drm; drm_mode_config_reset(drm); fl2000_reset(usb_dev); @@ -481,11 +516,18 @@ static void fl2000_drm_unbind(struct device *master) { /* It is assumed that master is FL2000 USB device */ struct usb_device *usb_dev = to_usb_device(master); - struct fl2000_drm_if *drm_if = res; - struct drm_device *drm = &drm_if->drm; + struct fl2000_drm_if *drm_if; + struct drm_device *drm; dev_info(master, "Unbinding FL2000 master"); + drm_if = dev_get_drvdata(&usb_dev->dev); + if (!drm_if) { + dev_err(&usb_dev->dev, "Cannot find DRM structure!"); + return; + } + + drm = &drm_if->drm; drm_atomic_helper_shutdown(drm); /* Detach bridge */ @@ -502,26 +544,25 @@ static struct component_master_ops fl2000_master_ops = { /** * Will only allocate structures on 'probe' function call. There is still no bridge at this moment, * so registration of the device and modesetting does not make any sense. - * + * * We do not configure DMA mask here because we link DRM device to the USB device provided. * We also do not set up polling because connect/disconnect events are provided in interrupts. - * - * @param interface USB interface to attach DRM device to + * + * @param usb_dev USB device structure + * * @return 0 on success, negative value on error */ -int fl2000_drm_init(struct usb_interface *interface) +int fl2000_drm_init(struct usb_device *usb_dev) { int ret; struct fl2000_drm_if *drm_if; struct drm_device *drm; struct drm_mode_config *mode_config; struct component_match *match = NULL; - struct usb_device *usb_dev = interface_to_usbdev(interface); - /* DRM device is allocated together with private data structure and attached to the device */ drm_if = devm_drm_dev_alloc(&usb_dev->dev, &fl2000_drm_driver, struct fl2000_drm_if, drm); if (IS_ERR(drm_if)) { - dev_err(&interface->dev, "Cannot allocate DRM structure (%ld)", PTR_ERR(drm_if)); + dev_err(&usb_dev->dev, "Cannot allocate DRM structure (%ld)", PTR_ERR(drm_if)); return (int)PTR_ERR(drm_if); } drm = &drm_if->drm; @@ -530,7 +571,7 @@ int fl2000_drm_init(struct usb_interface *interface) /* Static mode configuration that won't change */ ret = drmm_mode_config_init(drm); if (ret) { - dev_err(&interface->dev, "Cannot initialize DRM mode (%d)", ret); + dev_err(&usb_dev->dev, "Cannot initialize DRM mode (%d)", ret); drm_dev_put(drm); return ret; } @@ -546,7 +587,7 @@ int fl2000_drm_init(struct usb_interface *interface) fl2000_pixel_formats, ARRAY_SIZE(fl2000_pixel_formats), NULL, NULL); if (ret) { - dev_err(&interface->dev, "Cannot configure simple display pipe (%d)", ret); + dev_err(&usb_dev->dev, "Cannot configure simple display pipe (%d)", ret); drm_mode_config_cleanup(drm); drm_dev_put(drm); return ret; @@ -555,7 +596,8 @@ int fl2000_drm_init(struct usb_interface *interface) /* We support vblanks */ ret = drm_vblank_init(drm, drm->mode_config.num_crtc); if (ret) { - dev_err(&interface->dev, "Failed to initialize %d vblank(s) (%d)", drm->mode_config.num_crtc, ret); + dev_err(&usb_dev->dev, "Failed to initialize %d vblank(s) (%d)", + drm->mode_config.num_crtc, ret); drm_mode_config_cleanup(drm); drm_dev_put(drm); return ret; @@ -565,20 +607,20 @@ int fl2000_drm_init(struct usb_interface *interface) drm_encoder_helper_add(&drm_if->pipe.encoder, &fl2000_encoder_funcs); /* Register supported HDMI bridge as a component with match by name */ - ret = component_match_add(&usb_dev->dev, &match, component_compare_dev_name, fl2000_supported_bridge); - if (ret) { - dev_err(&interface->dev, "Cannot add component match! (%d)", ret); + component_match_add(&usb_dev->dev, &match, component_compare_dev_name, + fl2000_supported_bridge); + if (!match) { + dev_err(&usb_dev->dev, "Cannot find supported HDMI bridge!"); drm_mode_config_cleanup(drm); drm_dev_put(drm); - return ret; + return -ENODEV; } - - /* Register component master - component bind/unbind functions will complete the registration - * and initializtion of DRM device chain + /* Register component master - component bind/unbind functions will complete the + * registration and initializtion of DRM device chain */ ret = component_master_add_with_match(&usb_dev->dev, &fl2000_master_ops, match); if (ret) { - dev_err(&interface->dev, "Cannot register component master (%d)", ret); + dev_err(&usb_dev->dev, "Cannot register component master (%d)", ret); drm_mode_config_cleanup(drm); drm_dev_put(drm); return ret; @@ -589,13 +631,20 @@ int fl2000_drm_init(struct usb_interface *interface) return 0; } -void fl2000_drm_cleanup(struct usb_interface *interface) +void fl2000_drm_cleanup(struct usb_device *usb_dev) { - struct usb_device *usb_dev = interface_to_usbdev(interface); + struct drm_device *drm; + struct fl2000_drm_if *drm_if = dev_get_drvdata(&usb_dev->dev); + + if (!drm_if) { + dev_err(&usb_dev->dev, "Cannot find DRM structure!"); + return; + } dev_set_drvdata(&usb_dev->dev, NULL); component_master_del(&usb_dev->dev, &fl2000_master_ops); + drm = &drm_if->drm; drm_mode_config_cleanup(drm); drm_dev_put(drm); } diff --git a/fl2000_drv.c b/fl2000_drv.c index f9442e3..649247a 100644 --- a/fl2000_drv.c +++ b/fl2000_drv.c @@ -8,26 +8,29 @@ #define USB_DRIVER_NAME "fl2000_usb" -#define USB_VENDOR_FRESCO_LOGIC 0x1D5C -#define USB_PRODUCT_FL2000 0x2000 +#define FL2000_USB_VENDOR 0x1D5C +#define FL2000_USB_PRODUCT 0x2000 +#define FL2000_USB_INTERFACE(ifnum, api_addr) \ + { \ + USB_DEVICE_INTERFACE_NUMBER(FL2000_USB_VENDOR, FL2000_USB_PRODUCT, ifnum), \ + .driver_info = (kernel_ulong_t)(api_addr) \ + } -struct fl2000_if_api -{ - int(*create)(struct usb_interface *interface); - void(*destroy)(struct usb_interface *interface); +struct fl2000_if_api { + int (*create)(struct usb_interface *interface); + void (*destroy)(struct usb_interface *interface); }; static int fl2000_avcontrol_create(struct usb_interface *interface) { - struct usb_device *usb_dev = interface_to_usbdev(interface); - struct component_match *match = NULL; int ret; /* This seem to be needed to workaround buggy implementation of EPs */ ret = usb_set_interface(usb_dev, FL2000_USBIF_AVCONTROL, 1); if (ret) { - dev_err(&interface->dev, "Cannot set streaming interface for bulk transfers (%d)", ret); + dev_err(&interface->dev, "Cannot set streaming interface for bulk transfers (%d)", + ret); return ret; } @@ -80,9 +83,9 @@ static const struct fl2000_if_api fl2000_interrupt = { }; static const struct usb_device_id fl2000_id_table[] = { - { USB_DEVICE_INTERFACE_NUMBER(USB_VENDOR_FRESCO_LOGIC, USB_PRODUCT_FL2000, FL2000_USBIF_AVCONTROL), .driver_info = &fl2000_avcontrol }, - { USB_DEVICE_INTERFACE_NUMBER(USB_VENDOR_FRESCO_LOGIC, USB_PRODUCT_FL2000, FL2000_USBIF_STREAMING), .driver_info = &fl2000_streaming }, - { USB_DEVICE_INTERFACE_NUMBER(USB_VENDOR_FRESCO_LOGIC, USB_PRODUCT_FL2000, FL2000_USBIF_INTERRUPT), .driver_info = &fl2000_interrupt }, + FL2000_USB_INTERFACE(FL2000_USBIF_AVCONTROL, &fl2000_avcontrol), + FL2000_USB_INTERFACE(FL2000_USBIF_STREAMING, &fl2000_streaming), + FL2000_USB_INTERFACE(FL2000_USBIF_INTERRUPT, &fl2000_interrupt), {}, }; MODULE_DEVICE_TABLE(usb, fl2000_id_table); @@ -105,16 +108,16 @@ static int fl2000_probe(struct usb_interface *interface, const struct usb_device static void fl2000_disconnect(struct usb_interface *interface) { - const struct usb_device_id *usb_match_id;; + const struct usb_device_id *id; const struct fl2000_if_api *api; - usb_match_id = usb_match_id(interface, fl2000_id_table); - if (!usb_match_id) { + id = usb_match_id(interface, fl2000_id_table); + if (!id) { dev_err(&interface->dev, "Cannot find matching USB ID"); return; } - api = (const struct fl2000_if_api *)usb_match_id->driver_info; + api = (const struct fl2000_if_api *)id->driver_info; if (api && api->destroy) api->destroy(interface); } diff --git a/fl2000_i2c.c b/fl2000_i2c.c index d15873b..bde9250 100644 --- a/fl2000_i2c.c +++ b/fl2000_i2c.c @@ -119,7 +119,6 @@ int fl2000_i2c_init(struct usb_device *usb_dev) { int ret; struct i2c_adapter *adapter; - u8 usb_path[32]; /* Adapter must be allocated before anything else */ adapter = devres_alloc(fl2000_i2c_adapter_release, sizeof(*adapter), GFP_KERNEL); diff --git a/fl2000_interrupt.c b/fl2000_interrupt.c index 245ceab..2284266 100644 --- a/fl2000_interrupt.c +++ b/fl2000_interrupt.c @@ -15,20 +15,21 @@ struct fl2000_interrupt { static void fl2000_intr_work(struct work_struct *work) { - struct fl2000_interrupt *intr = container_of(work, struct fl2000_intr, work); + struct fl2000_interrupt *intr = container_of(work, struct fl2000_interrupt, work); struct usb_interface *interface = intr->interface; struct usb_device *usb_dev = interface_to_usbdev(interface); int ret; /* Receive interrupt message */ - ret = usb_interrupt_msg(usb_dev, usb_rcvintpipe(usb_dev, INTERRUPT_EP), &intr->buf, sizeof(intr->buf), NULL, 0); + ret = usb_interrupt_msg(usb_dev, usb_rcvintpipe(usb_dev, INTERRUPT_EP), &intr->buf, + sizeof(intr->buf), NULL, 0); if (ret) { dev_err(&interface->dev, "Sending interrupt message failed (%d)", ret); /* TODO: Signal fault to system and start shutdown of usb_dev */ return; } - ret = fl2000_check_interrupt(intr->usb_dev); + ret = fl2000_check_interrupt(usb_dev); if (ret < 0) { dev_err(&interface->dev, "Checking interrupt message failed (%d)", ret); /* TODO: Signal fault to system and start shutdown of usb_dev */ @@ -37,7 +38,7 @@ static void fl2000_intr_work(struct work_struct *work) fl2000_drm_hotplug(usb_dev); } - queue_work(intr->work_queue, &intr->work); + queue_work(intr->work_queue, &intr->work); } static void fl2000_intr_release(struct device *dev, void *res) @@ -52,9 +53,9 @@ static void fl2000_intr_release(struct device *dev, void *res) /** * fl2000_enable_interrupt() - interrupt processing start - * + * * @usb_dev: USB device - * + * * @returns: Operation result */ int fl2000_enable_interrupt(struct usb_device *usb_dev) @@ -74,7 +75,7 @@ int fl2000_enable_interrupt(struct usb_device *usb_dev) * fl2000_disable_interrupt() - interrupt processing stop * * @usb_dev: USB device - * + * * @returns: Operation result */ int fl2000_disable_interrupt(struct usb_device *usb_dev) @@ -87,19 +88,18 @@ int fl2000_disable_interrupt(struct usb_device *usb_dev) return -ENODEV; } - return cancel_work_sync(intr->work_queue, &intr->work); + return cancel_work_sync(&intr->work); } /** * fl2000_interrupt_create() - interrupt processing context creation - * + * * @interface: USB interrupt transfers interface - * + * * @returns: Operation result */ int fl2000_interrupt_create(struct usb_interface *interface) { - int ret; struct fl2000_interrupt *intr; struct usb_device *usb_dev = interface_to_usbdev(interface); @@ -110,7 +110,7 @@ int fl2000_interrupt_create(struct usb_interface *interface) } intr->interface = interface; - + /* This possibly involves reading I2C registers, etc. so better to schedule a work queue */ INIT_WORK(&intr->work, &fl2000_intr_work); intr->work_queue = create_workqueue("fl2000_interrupt"); @@ -127,7 +127,7 @@ int fl2000_interrupt_create(struct usb_interface *interface) /** * fl2000_interrupt_destroy() - interrupt processing context destruction - * + * * @interface: USB interrupt transfers interface */ void fl2000_interrupt_destroy(struct usb_interface *interface) diff --git a/fl2000_registers.c b/fl2000_registers.c index a0d3129..fc4186c 100644 --- a/fl2000_registers.c +++ b/fl2000_registers.c @@ -304,10 +304,11 @@ int fl2000_enable_interrupts(struct usb_device *usb_dev) */ int fl2000_check_interrupt(struct usb_device *usb_dev) { + int ret; struct regmap *regmap = dev_get_regmap(&usb_dev->dev, NULL); union fl2000_vga_status_reg status; bool sink_event; - int ret; + u32 mask = 0; /* Process interrupt */ ret = regmap_read(regmap, FL2000_VGA_STATUS_REG, &status.val); @@ -393,7 +394,7 @@ int fl2000_regmap_init(struct usb_device *usb_dev) regmap = devm_regmap_init(&usb_dev->dev, NULL, usb_dev, &fl2000_regmap_config); if (IS_ERR(regmap)) - return PTR_ERR(regmap); + return PTR_ERR(regmap); return 0; } diff --git a/fl2000_streaming.c b/fl2000_streaming.c index 82f2fe7..18ff0fb 100644 --- a/fl2000_streaming.c +++ b/fl2000_streaming.c @@ -142,6 +142,7 @@ static int fl2000_get_buffers(struct list_head *buffers_list, unsigned int size) if (!list_empty(buffers_list)) { /* Try fixing non-empty list putting buffers back */ fl2000_put_buffers(buffers_list); + } for (int i = 0; i < FL2000_SB_NUM; i++) { cur_sb = fl2000_alloc_sb(size); @@ -165,14 +166,17 @@ static void fl2000_data_completion(struct urb *urb); /* TODO: use anchors more wisely */ static int fl2000_send_stream(struct usb_device *usb_dev, struct fl2000_stream *stream) { - if (stream->enabled) do { + do { int ret; struct fl2000_stream_buf *cur_sb; struct fl2000_stream_buf *last_sb; - struct urb *data_urb; + struct urb *urb; + + if (!stream->enabled) + break; - data_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!data_urb) { + urb = usb_alloc_urb(0, GFP_KERNEL); + if (!urb) { dev_err(&usb_dev->dev, "Data URB allocation error"); return -ENOMEM; } @@ -184,15 +188,18 @@ static int fl2000_send_stream(struct usb_device *usb_dev, struct fl2000_stream * */ if (list_empty(&stream->transmit_list)) { if (list_empty(&stream->wait_list)) - last_sb = list_last_entry(&stream->render_list, struct fl2000_stream_buf, list); + last_sb = list_last_entry(&stream->render_list, + struct fl2000_stream_buf, list); else - last_sb = list_last_entry(&stream->wait_list, struct fl2000_stream_buf, list); + last_sb = list_last_entry(&stream->wait_list, + struct fl2000_stream_buf, list); cur_sb = list_first_entry(&stream->render_list, struct fl2000_stream_buf, - list); + list); if (cur_sb && last_sb) /* Both non-NULL */ memcpy(cur_sb->vaddr, last_sb->vaddr, stream->buf_size); } else { - cur_sb = list_first_entry(&stream->transmit_list, struct fl2000_stream_buf, list); + cur_sb = list_first_entry(&stream->transmit_list, struct fl2000_stream_buf, + list); } list_move_tail(&cur_sb->list, &stream->wait_list); spin_unlock(&stream->list_lock); @@ -200,14 +207,14 @@ static int fl2000_send_stream(struct usb_device *usb_dev, struct fl2000_stream * /* Endpoint 1 bulk out. We store pointer to current stream buffer structure in * transfer_buffer field of URB which is unused due to SGT */ - usb_fill_bulk_urb(data_urb, usb_dev, usb_sndbulkpipe(usb_dev, STREAMING_EP), cur_sb, - (int)stream->buf_size, fl2000_data_completion, stream); - data_urb->interval = 0; - data_urb->sg = cur_sb->sgt.sgl; - data_urb->num_sgs = cur_sb->sgt.nents; - data_urb->transfer_flags |= URB_ZERO_PACKET; - - usb_anchor_urb(data_urb, &stream->anchor); + usb_fill_bulk_urb(urb, usb_dev, usb_sndbulkpipe(usb_dev, STREAMING_EP), cur_sb, + (int)stream->buf_size, fl2000_data_completion, stream); + urb->interval = 0; + urb->sg = cur_sb->sgt.sgl; + urb->num_sgs = cur_sb->sgt.nents; + urb->transfer_flags |= URB_ZERO_PACKET; + + usb_anchor_urb(urb, &stream->anchor); ret = usb_submit_urb(urb, GFP_KERNEL); if (ret) { dev_err(&usb_dev->dev, "Data URB error %d", ret); @@ -216,10 +223,12 @@ static int fl2000_send_stream(struct usb_device *usb_dev, struct fl2000_stream * list_move_tail(&cur_sb->list, &stream->render_list); spin_unlock(&stream->list_lock); - usb_unanchor_urb(data_urb); - usb_free_urb(data_urb); + usb_unanchor_urb(urb); + usb_free_urb(urb); - /* NOTE: actually in some cases we can try and resend the URB (-EAGAIN, some -ENOMEM) */ + /* NOTE: actually in some cases we can try and resend the URB after sleep + * e.g. -EAGAIN, few attempts on -ENOMEM... We will need work for this + */ return ret; } } while (atomic_dec_and_test(&stream->urb_cnt)); @@ -238,7 +247,7 @@ static void fl2000_data_completion(struct urb *urb) list_move_tail(&cur_sb->list, &stream->render_list); spin_unlock(&stream->list_lock); - atomic_inc(stream->urb_cnt); + atomic_inc(&stream->urb_cnt); fl2000_drm_vblank(usb_dev); @@ -275,16 +284,14 @@ static void fl2000_streaming_release(struct device *dev, void *res) { struct fl2000_stream *stream = res; - UNUSED(dev); - - fl2000_streaming_disable(stream); + fl2000_streaming_disable(to_usb_device(dev)); fl2000_put_buffers(&stream->render_list); } /** * fl2000_streaming_compress() - compress XRGB888 data to RGB565 or RGB888 - * + * * @usb_dev: USB device * @src: Source buffer * @height: Image height @@ -292,20 +299,20 @@ static void fl2000_streaming_release(struct device *dev, void *res) * @pitch: Image pitch */ void fl2000_streaming_compress(struct usb_device *usb_dev, void *src, unsigned int height, - unsigned int width, unsigned int pitch) + unsigned int width, unsigned int pitch) { struct fl2000_stream_buf *cur_sb; void *dst; u32 dst_line_len; struct fl2000_stream *stream; - stream = devres_find(&usb_dev->dev, fl2000_stream_release, NULL, NULL); + stream = devres_find(&usb_dev->dev, fl2000_streaming_release, NULL, NULL); if (!stream) { dev_err(&usb_dev->dev, "Cannot find streaming context"); return; } - if (list_empty(&stream->render_list) + if (list_empty(&stream->render_list)) return; spin_lock_irq(&stream->list_lock); @@ -335,11 +342,11 @@ void fl2000_streaming_compress(struct usb_device *usb_dev, void *src, unsigned i /** * fl2000_streaming_mode_set() - streaming mode setup - * + * * @usb_dev: USB device * @pixels: Number of pixels in a line * @bytes_pix: Bytes per pixel - * + * * @returns: Operation result */ int fl2000_streaming_mode_set(struct usb_device *usb_dev, int pixels, u32 bytes_pix) @@ -348,7 +355,7 @@ int fl2000_streaming_mode_set(struct usb_device *usb_dev, int pixels, u32 bytes_ unsigned int size; struct fl2000_stream *stream; - stream = devres_find(&usb_dev->dev, fl2000_stream_release, NULL, NULL); + stream = devres_find(&usb_dev->dev, fl2000_streaming_release, NULL, NULL); if (!stream) { dev_err(&usb_dev->dev, "Cannot find streaming context"); return -ENODEV; @@ -376,9 +383,9 @@ int fl2000_streaming_mode_set(struct usb_device *usb_dev, int pixels, u32 bytes_ /** * fl2000_streaming_enable() - streaming processing start - * + * * @usb_dev: USB device - * + * * @returns: Operation result */ int fl2000_streaming_enable(struct usb_device *usb_dev) @@ -386,7 +393,7 @@ int fl2000_streaming_enable(struct usb_device *usb_dev) int ret; struct fl2000_stream *stream; - stream = devres_find(&usb_dev->dev, fl2000_stream_release, NULL, NULL); + stream = devres_find(&usb_dev->dev, fl2000_streaming_release, NULL, NULL); if (!stream) { dev_err(&usb_dev->dev, "Cannot find streaming context"); return -ENODEV; @@ -411,7 +418,7 @@ int fl2000_streaming_enable(struct usb_device *usb_dev) /** * fl2000_streaming_disable() - streaming processing stop - * + * * @usb_dev: USB device */ void fl2000_streaming_disable(struct usb_device *usb_dev) @@ -419,10 +426,10 @@ void fl2000_streaming_disable(struct usb_device *usb_dev) struct fl2000_stream_buf *cur_sb; struct fl2000_stream *stream; - stream = devres_find(&usb_dev->dev, fl2000_stream_release, NULL, NULL); + stream = devres_find(&usb_dev->dev, fl2000_streaming_release, NULL, NULL); if (!stream) { dev_err(&usb_dev->dev, "Cannot find streaming context"); - return -ENODEV; + return; } stream->enabled = false; @@ -446,17 +453,16 @@ void fl2000_streaming_disable(struct usb_device *usb_dev) /** * fl2000_streaming_create() - streaming processing context creation - * + * * It shall not initiate any USB transfers. URB is not allocated here because we do not know the * stream requirements yet. - * + * * @interface: streaming transfers interface - * + * * @returns: Operation result */ int fl2000_streaming_create(struct usb_interface *interface) { - int ret; struct fl2000_stream *stream; struct usb_device *usb_dev = interface_to_usbdev(interface); @@ -472,7 +478,7 @@ int fl2000_streaming_create(struct usb_interface *interface) spin_lock_init(&stream->list_lock); init_usb_anchor(&stream->anchor); - stream->urb_cnt = ATOMIC_INIT(FL2000_SB_MIN); + atomic_set(&stream->urb_cnt, FL2000_SB_MIN); stream->enabled = false; devres_add(&usb_dev->dev, stream); @@ -482,7 +488,7 @@ int fl2000_streaming_create(struct usb_interface *interface) /** * fl2000_streaming_destroy() - streaming processing context destruction - * + * * @interface: streaming transfers interface */ void fl2000_streaming_destroy(struct usb_interface *interface)