diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-05 18:16:23 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-05 18:16:23 -0700 |
commit | c6a677c6f37bb7abc85ba7e3465e82b9f7eb1d91 (patch) | |
tree | 9d0d4bb2e150837297cddc5be7f1b4950e9ab228 /drivers/staging/most | |
parent | e87d51ac61f88ae44fe14b34abe08566032d726b (diff) | |
parent | 11270059e8d0b6f80801fac910c4ef751ca05c4c (diff) |
Merge tag 'staging-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO updates from Greg KH:
"Here is the big staging tree update for 4.12-rc1.
It's a big one, adding about 350k new lines of crap^Wcode, mostly all
in a big dump of media drivers from Intel. But there's other new
drivers in here as well, yet-another-wifi driver, new IIO drivers, and
a new crypto accelerator.
We also deleted a bunch of stuff, mostly in patch cleanups, but also
the Android ION code has shrunk a lot, and the Android low memory
killer driver was finally deleted, much to the celebration of the -mm
developers.
All of these have been in linux-next with a few build issues that will
show up when you merge to your tree"
Merge conflicts in the new rtl8723bs driver (due to the wifi changes
this merge window) handled as per linux-next, courtesy of Stephen
Rothwell.
* tag 'staging-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1182 commits)
staging: fsl-mc/dpio: add cpu <--> LE conversion for dpaa2_fd
staging: ks7010: remove line continuations in quoted strings
staging: vt6656: use tabs instead of spaces
staging: android: ion: Fix unnecessary initialization of static variable
staging: media: atomisp: fix range checking on clk_num
staging: media: atomisp: fix misspelled word in comment
staging: media: atomisp: kmap() can't fail
staging: atomisp: remove #ifdef for runtime PM functions
staging: atomisp: satm include directory is gone
atomisp: remove some more unused files
atomisp: remove hmm_load/store/clear indirections
atomisp: kill off mmgr_free
atomisp: clean up the hmm init/cleanup indirections
atomisp: handle allocation calls before init in the hmm layer
staging: fsl-dpaa2/eth: Add maintainer for Ethernet driver
staging: fsl-dpaa2/eth: Add TODO file
staging: fsl-dpaa2/eth: Add trace points
staging: fsl-dpaa2/eth: Add driver specific stats
staging: fsl-dpaa2/eth: Add ethtool support
staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driver
...
Diffstat (limited to 'drivers/staging/most')
-rw-r--r-- | drivers/staging/most/aim-cdev/cdev.c | 16 | ||||
-rw-r--r-- | drivers/staging/most/aim-sound/sound.c | 2 | ||||
-rw-r--r-- | drivers/staging/most/hdm-dim2/dim2_hal.c | 7 | ||||
-rw-r--r-- | drivers/staging/most/hdm-usb/hdm_usb.c | 39 | ||||
-rw-r--r-- | drivers/staging/most/mostcore/core.c | 163 |
5 files changed, 102 insertions, 125 deletions
diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index 7f51024dc5eb..1e5cbc893496 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -99,11 +99,16 @@ static void destroy_cdev(struct aim_channel *c) device_destroy(aim_class, c->devno); cdev_del(&c->cdev); - kfifo_free(&c->fifo); spin_lock_irqsave(&ch_list_lock, flags); list_del(&c->list); spin_unlock_irqrestore(&ch_list_lock, flags); +} + +static void destroy_channel(struct aim_channel *c) +{ ida_simple_remove(&minor_id, MINOR(c->devno)); + kfifo_free(&c->fifo); + kfree(c); } /** @@ -170,9 +175,8 @@ static int aim_close(struct inode *inode, struct file *filp) stop_channel(c); mutex_unlock(&c->io_mutex); } else { - destroy_cdev(c); mutex_unlock(&c->io_mutex); - kfree(c); + destroy_channel(c); } return 0; } @@ -337,14 +341,14 @@ static int aim_disconnect_channel(struct most_interface *iface, int channel_id) spin_lock(&c->unlink); c->dev = NULL; spin_unlock(&c->unlink); + destroy_cdev(c); if (c->access_ref) { stop_channel(c); wake_up_interruptible(&c->wq); mutex_unlock(&c->io_mutex); } else { - destroy_cdev(c); mutex_unlock(&c->io_mutex); - kfree(c); + destroy_channel(c); } return 0; } @@ -546,7 +550,7 @@ static void __exit mod_exit(void) list_for_each_entry_safe(c, tmp, &channel_list, list) { destroy_cdev(c); - kfree(c); + destroy_channel(c); } class_destroy(aim_class); unregister_chrdev_region(aim_devno, 1); diff --git a/drivers/staging/most/aim-sound/sound.c b/drivers/staging/most/aim-sound/sound.c index e4198e5e064b..ea1366a44008 100644 --- a/drivers/staging/most/aim-sound/sound.c +++ b/drivers/staging/most/aim-sound/sound.c @@ -429,7 +429,7 @@ static int pcm_trigger(struct snd_pcm_substream *substream, int cmd) return 0; default: - pr_info("pcm_trigger(), invalid\n"); + pr_info("%s(), invalid\n", __func__); return -EINVAL; } return 0; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 0b9816ce1761..d604ec09df28 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -18,6 +18,7 @@ #include "dim2_errors.h" #include "dim2_reg.h" #include <linux/stddef.h> +#include <linux/kernel.h> /* * Size factor for isochronous DBR buffer. @@ -49,7 +50,7 @@ #define DBR_SIZE (16 * 1024) /* specified by IP */ #define DBR_BLOCK_SIZE (DBR_SIZE / 32 / DBR_MAP_SIZE) -#define ROUND_UP_TO(x, d) (((x) + (d) - 1) / (d) * (d)) +#define ROUND_UP_TO(x, d) (DIV_ROUND_UP(x, (d)) * (d)) /* -------------------------------------------------------------------------- */ /* generic helper functions and macros */ @@ -117,7 +118,7 @@ static int alloc_dbr(u16 size) return DBR_SIZE; /* out of memory */ for (i = 0; i < DBR_MAP_SIZE; i++) { - u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE; + u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE); u32 mask = ~((~(u32)0) << blocks); do { @@ -137,7 +138,7 @@ static int alloc_dbr(u16 size) static void free_dbr(int offs, int size) { int block_idx = offs / DBR_BLOCK_SIZE; - u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE; + u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE); u32 mask = ~((~(u32)0) << blocks); mask <<= block_idx % 32; diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c index 2bfea9b48366..a95b5910d9fc 100644 --- a/drivers/staging/most/hdm-usb/hdm_usb.c +++ b/drivers/staging/most/hdm-usb/hdm_usb.c @@ -281,7 +281,6 @@ static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) struct most_channel_config *conf = &mdev->conf[channel]; unsigned int frame_size = get_stream_frame_size(conf); unsigned int j, num_frames; - u16 rd_addr, wr_addr; if (!frame_size) return -EIO; @@ -293,13 +292,10 @@ static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo) return -EIO; } - for (j = 1; j < num_frames; j++) { - wr_addr = (num_frames - j) * USB_MTU; - rd_addr = (num_frames - j) * frame_size; - memmove(mbo->virt_address + wr_addr, - mbo->virt_address + rd_addr, + for (j = num_frames - 1; j > 0; j--) + memmove(mbo->virt_address + j * USB_MTU, + mbo->virt_address + j * frame_size, frame_size); - } mbo->buffer_length = num_frames * USB_MTU; return 0; } @@ -649,8 +645,6 @@ static int hdm_configure_channel(struct most_interface *iface, int channel, { unsigned int num_frames; unsigned int frame_size; - unsigned int temp_size; - unsigned int tail_space; struct most_dev *mdev = to_mdev(iface); struct device *dev = &mdev->usb_device->dev; @@ -685,7 +679,6 @@ static int hdm_configure_channel(struct most_interface *iface, int channel, } mdev->padding_active[channel] = true; - temp_size = conf->buffer_size; frame_size = get_stream_frame_size(conf); if (frame_size == 0 || frame_size > USB_MTU) { @@ -693,25 +686,19 @@ static int hdm_configure_channel(struct most_interface *iface, int channel, return -EINVAL; } + num_frames = conf->buffer_size / frame_size; + if (conf->buffer_size % frame_size) { - u16 tmp_val; - - tmp_val = conf->buffer_size / frame_size; - conf->buffer_size = tmp_val * frame_size; - dev_notice(dev, - "Channel %d - rounding buffer size to %d bytes, channel config says %d bytes\n", - channel, - conf->buffer_size, - temp_size); - } + u16 old_size = conf->buffer_size; - num_frames = conf->buffer_size / frame_size; - tail_space = num_frames * (USB_MTU - frame_size); - temp_size += tail_space; + conf->buffer_size = num_frames * frame_size; + dev_warn(dev, "%s: fixed buffer size (%d -> %d)\n", + mdev->suffix[channel], old_size, conf->buffer_size); + } /* calculate extra length to comply w/ HW padding */ - conf->extra_len = (DIV_ROUND_UP(temp_size, USB_MTU) * USB_MTU) - - conf->buffer_size; + conf->extra_len = num_frames * (USB_MTU - frame_size); + exit: mdev->conf[channel] = *conf; if (conf->data_type == MOST_CH_ASYNC) { @@ -1018,7 +1005,7 @@ static ssize_t store_value(struct most_dci_obj *dci_obj, err = drci_wr_reg(usb_dev, dci_obj->reg_addr, val); else if (!strcmp(name, "sync_ep")) err = start_sync_ep(usb_dev, val); - else if (!get_static_reg_addr(ro_regs, name, ®_addr)) + else if (!get_static_reg_addr(rw_regs, name, ®_addr)) err = drci_wr_reg(usb_dev, reg_addr, val); else return -EFAULT; diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index 191404bc5906..675b2a9e66c1 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -127,10 +127,6 @@ struct most_c_attr { #define to_channel_attr(a) container_of(a, struct most_c_attr, attr) -#define MOST_CHNL_ATTR(_name, _mode, _show, _store) \ - struct most_c_attr most_chnl_attr_##_name = \ - __ATTR(_name, _mode, _show, _store) - /** * channel_attr_show - show function of channel object * @kobj: pointer to its kobject @@ -256,7 +252,7 @@ static void most_channel_release(struct kobject *kobj) kfree(c); } -static ssize_t show_available_directions(struct most_c_obj *c, +static ssize_t available_directions_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { @@ -271,7 +267,7 @@ static ssize_t show_available_directions(struct most_c_obj *c, return strlen(buf); } -static ssize_t show_available_datatypes(struct most_c_obj *c, +static ssize_t available_datatypes_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { @@ -290,10 +286,9 @@ static ssize_t show_available_datatypes(struct most_c_obj *c, return strlen(buf); } -static -ssize_t show_number_of_packet_buffers(struct most_c_obj *c, - struct most_c_attr *attr, - char *buf) +static ssize_t number_of_packet_buffers_show(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) { unsigned int i = c->channel_id; @@ -301,10 +296,9 @@ ssize_t show_number_of_packet_buffers(struct most_c_obj *c, c->iface->channel_vector[i].num_buffers_packet); } -static -ssize_t show_number_of_stream_buffers(struct most_c_obj *c, - struct most_c_attr *attr, - char *buf) +static ssize_t number_of_stream_buffers_show(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) { unsigned int i = c->channel_id; @@ -312,10 +306,9 @@ ssize_t show_number_of_stream_buffers(struct most_c_obj *c, c->iface->channel_vector[i].num_buffers_streaming); } -static -ssize_t show_size_of_packet_buffer(struct most_c_obj *c, - struct most_c_attr *attr, - char *buf) +static ssize_t size_of_packet_buffer_show(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) { unsigned int i = c->channel_id; @@ -323,10 +316,9 @@ ssize_t show_size_of_packet_buffer(struct most_c_obj *c, c->iface->channel_vector[i].buffer_size_packet); } -static -ssize_t show_size_of_stream_buffer(struct most_c_obj *c, - struct most_c_attr *attr, - char *buf) +static ssize_t size_of_stream_buffer_show(struct most_c_obj *c, + struct most_c_attr *attr, + char *buf) { unsigned int i = c->channel_id; @@ -334,32 +326,21 @@ ssize_t show_size_of_stream_buffer(struct most_c_obj *c, c->iface->channel_vector[i].buffer_size_streaming); } -static ssize_t show_channel_starving(struct most_c_obj *c, +static ssize_t channel_starving_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving); } -#define create_show_channel_attribute(val) \ - static MOST_CHNL_ATTR(val, 0444, show_##val, NULL) - -create_show_channel_attribute(available_directions); -create_show_channel_attribute(available_datatypes); -create_show_channel_attribute(number_of_packet_buffers); -create_show_channel_attribute(number_of_stream_buffers); -create_show_channel_attribute(size_of_stream_buffer); -create_show_channel_attribute(size_of_packet_buffer); -create_show_channel_attribute(channel_starving); - -static ssize_t show_set_number_of_buffers(struct most_c_obj *c, +static ssize_t set_number_of_buffers_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers); } -static ssize_t store_set_number_of_buffers(struct most_c_obj *c, +static ssize_t set_number_of_buffers_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -371,14 +352,14 @@ static ssize_t store_set_number_of_buffers(struct most_c_obj *c, return count; } -static ssize_t show_set_buffer_size(struct most_c_obj *c, +static ssize_t set_buffer_size_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size); } -static ssize_t store_set_buffer_size(struct most_c_obj *c, +static ssize_t set_buffer_size_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -390,7 +371,7 @@ static ssize_t store_set_buffer_size(struct most_c_obj *c, return count; } -static ssize_t show_set_direction(struct most_c_obj *c, +static ssize_t set_direction_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { @@ -401,7 +382,7 @@ static ssize_t show_set_direction(struct most_c_obj *c, return snprintf(buf, PAGE_SIZE, "unconfigured\n"); } -static ssize_t store_set_direction(struct most_c_obj *c, +static ssize_t set_direction_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -421,7 +402,7 @@ static ssize_t store_set_direction(struct most_c_obj *c, return count; } -static ssize_t show_set_datatype(struct most_c_obj *c, +static ssize_t set_datatype_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { @@ -434,7 +415,7 @@ static ssize_t show_set_datatype(struct most_c_obj *c, return snprintf(buf, PAGE_SIZE, "unconfigured\n"); } -static ssize_t store_set_datatype(struct most_c_obj *c, +static ssize_t set_datatype_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -455,14 +436,14 @@ static ssize_t store_set_datatype(struct most_c_obj *c, return count; } -static ssize_t show_set_subbuffer_size(struct most_c_obj *c, +static ssize_t set_subbuffer_size_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size); } -static ssize_t store_set_subbuffer_size(struct most_c_obj *c, +static ssize_t set_subbuffer_size_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -474,14 +455,14 @@ static ssize_t store_set_subbuffer_size(struct most_c_obj *c, return count; } -static ssize_t show_set_packets_per_xact(struct most_c_obj *c, +static ssize_t set_packets_per_xact_show(struct most_c_obj *c, struct most_c_attr *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.packets_per_xact); } -static ssize_t store_set_packets_per_xact(struct most_c_obj *c, +static ssize_t set_packets_per_xact_store(struct most_c_obj *c, struct most_c_attr *attr, const char *buf, size_t count) @@ -493,33 +474,39 @@ static ssize_t store_set_packets_per_xact(struct most_c_obj *c, return count; } -#define create_channel_attribute(value) \ - static MOST_CHNL_ATTR(value, 0644, show_##value, store_##value) - -create_channel_attribute(set_buffer_size); -create_channel_attribute(set_number_of_buffers); -create_channel_attribute(set_direction); -create_channel_attribute(set_datatype); -create_channel_attribute(set_subbuffer_size); -create_channel_attribute(set_packets_per_xact); +static struct most_c_attr most_c_attrs[] = { + __ATTR_RO(available_directions), + __ATTR_RO(available_datatypes), + __ATTR_RO(number_of_packet_buffers), + __ATTR_RO(number_of_stream_buffers), + __ATTR_RO(size_of_stream_buffer), + __ATTR_RO(size_of_packet_buffer), + __ATTR_RO(channel_starving), + __ATTR_RW(set_buffer_size), + __ATTR_RW(set_number_of_buffers), + __ATTR_RW(set_direction), + __ATTR_RW(set_datatype), + __ATTR_RW(set_subbuffer_size), + __ATTR_RW(set_packets_per_xact), +}; /** * most_channel_def_attrs - array of default attributes of channel object */ static struct attribute *most_channel_def_attrs[] = { - &most_chnl_attr_available_directions.attr, - &most_chnl_attr_available_datatypes.attr, - &most_chnl_attr_number_of_packet_buffers.attr, - &most_chnl_attr_number_of_stream_buffers.attr, - &most_chnl_attr_size_of_packet_buffer.attr, - &most_chnl_attr_size_of_stream_buffer.attr, - &most_chnl_attr_set_number_of_buffers.attr, - &most_chnl_attr_set_buffer_size.attr, - &most_chnl_attr_set_direction.attr, - &most_chnl_attr_set_datatype.attr, - &most_chnl_attr_set_subbuffer_size.attr, - &most_chnl_attr_set_packets_per_xact.attr, - &most_chnl_attr_channel_starving.attr, + &most_c_attrs[0].attr, + &most_c_attrs[1].attr, + &most_c_attrs[2].attr, + &most_c_attrs[3].attr, + &most_c_attrs[4].attr, + &most_c_attrs[5].attr, + &most_c_attrs[6].attr, + &most_c_attrs[7].attr, + &most_c_attrs[8].attr, + &most_c_attrs[9].attr, + &most_c_attrs[10].attr, + &most_c_attrs[11].attr, + &most_c_attrs[12].attr, NULL, }; @@ -562,9 +549,6 @@ create_most_c_obj(const char *name, struct kobject *parent) /* ___ ___ * ___I N S T A N C E___ */ -#define MOST_INST_ATTR(_name, _mode, _show, _store) \ - struct most_inst_attribute most_inst_attr_##_name = \ - __ATTR(_name, _mode, _show, _store) static struct list_head instance_list; @@ -652,7 +636,7 @@ static void most_inst_release(struct kobject *kobj) kfree(inst); } -static ssize_t show_description(struct most_inst_obj *instance_obj, +static ssize_t description_show(struct most_inst_obj *instance_obj, struct most_inst_attribute *attr, char *buf) { @@ -660,7 +644,7 @@ static ssize_t show_description(struct most_inst_obj *instance_obj, instance_obj->iface->description); } -static ssize_t show_interface(struct most_inst_obj *instance_obj, +static ssize_t interface_show(struct most_inst_obj *instance_obj, struct most_inst_attribute *attr, char *buf) { @@ -687,11 +671,11 @@ static ssize_t show_interface(struct most_inst_obj *instance_obj, return snprintf(buf, PAGE_SIZE, "unknown\n"); } -#define create_inst_attribute(value) \ - static MOST_INST_ATTR(value, 0444, show_##value, NULL) +static struct most_inst_attribute most_inst_attr_description = + __ATTR_RO(description); -create_inst_attribute(description); -create_inst_attribute(interface); +static struct most_inst_attribute most_inst_attr_interface = + __ATTR_RO(interface); static struct attribute *most_inst_def_attrs[] = { &most_inst_attr_description.attr, @@ -847,9 +831,9 @@ static void most_aim_release(struct kobject *kobj) kfree(aim_obj); } -static ssize_t add_link_show(struct most_aim_obj *aim_obj, - struct most_aim_attribute *attr, - char *buf) +static ssize_t links_show(struct most_aim_obj *aim_obj, + struct most_aim_attribute *attr, + char *buf) { struct most_c_obj *c; struct most_inst_obj *i; @@ -943,7 +927,7 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch) } /** - * store_add_link - store() function for add_link attribute + * add_link_store - store() function for add_link attribute * @aim_obj: pointer to AIM object * @attr: its attributes * @buf: buffer @@ -1013,11 +997,8 @@ static ssize_t add_link_store(struct most_aim_obj *aim_obj, return len; } -static struct most_aim_attribute most_aim_attr_add_link = - __ATTR_RW(add_link); - /** - * store_remove_link - store function for remove_link attribute + * remove_link_store - store function for remove_link attribute * @aim_obj: pointer to AIM object * @attr: its attributes * @buf: buffer @@ -1056,12 +1037,16 @@ static ssize_t remove_link_store(struct most_aim_obj *aim_obj, return len; } -static struct most_aim_attribute most_aim_attr_remove_link = - __ATTR_WO(remove_link); +static struct most_aim_attribute most_aim_attrs[] = { + __ATTR_RO(links), + __ATTR_WO(add_link), + __ATTR_WO(remove_link), +}; static struct attribute *most_aim_def_attrs[] = { - &most_aim_attr_add_link.attr, - &most_aim_attr_remove_link.attr, + &most_aim_attrs[0].attr, + &most_aim_attrs[1].attr, + &most_aim_attrs[2].attr, NULL, }; |