Re: pull-request: vmbus 2017-01-13
On Wed, Jan 18, 2017 at 02:57:13PM -0800, Stephen Hemminger wrote: > On Sat, 14 Jan 2017 14:16:07 +0100 > Greg KHwrote: > > > On Fri, Jan 13, 2017 at 11:45:21AM -0800, Stephen Hemminger wrote: > > > Here is an update with cleanups based on recent changes. > > > > > > The following changes since commit > > > b0f2d7d546d37697d3f50753904f6f0c549b62bc: > > > > > > VME: Remove node entry from vme_driver (2017-01-11 09:21:41 +0100) > > > > > > are available in the git repository at: > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/vmbus-next > > > > That's a random branch, not a signed tag :( > > > > Why not just send these as patches? > > I was using pull request so that there were no conflicts. Why would there be any conflicts? > Also makes it easier for others to get all of them for testing. Ok, but who is testing this stuff? :) > I don't see others using signed-tags (bluetooth, ipsec, intel drivers) > though it would have been better to use a more obvious branch name. I can't speak for those subsystems, but I know I require signed tags to pull from, as does other maintainers (Linus, arm developers, etc.) so perhaps those subsystems need to get on the ball... thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/9] VC04_SERVICES: Add top level compat ioctl handler
On Thu, 2017-01-19 at 02:01 +0300, Dan Carpenter wrote: > On Wed, Jan 18, 2017 at 07:04:46AM -0800, Michael Zoran wrote: > > Add the top level compat ioctl handler as a placeholder > > for adding additional handlers. > > > > The ioctls are first filtered and forwarded to the > > regular ioctl handler if the ioctl does not require > > any extra compatibility processing. > > > > Signed-off-by: Michael Zoran> > --- > > .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 73 > > ++ > > 1 file changed, 73 insertions(+) > > > > diff --git > > a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > > index 0525211bcd65..9ade2f63606b 100644 > > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > > @@ -1206,6 +1206,76 @@ vchiq_ioctl(struct file *file, unsigned int > > What the heck??? I feel you're trying to gaslight me now. > > It's unfortunate that this is right at the start of the series > because > I've already met my quota of nonsense code and I won't be reviewing > the > rest until v2 comes out. > > regards, > dan carpenter > This whole driver is a chicken and egg problem. The existing code is so hard to read and maintain, that it's hard to improve it in a incremental way. Yet, trowing large sections out the door is too hard to get seriously reviewed as well... I would like to think that what I've submitted is an improvement on the existing stuff. I'm sorry you feel that no changes are possible unless all the issues are fixed at once. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 00/18] *** SUBJECT HERE ***
On Wed, Jan 18, 2017 at 04:44:32PM -0700, k...@exchange.microsoft.com wrote: > From: K. Y. Srinivasan"interesting" subject :( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[greybus-dev] [PATCH] staging: greybus: loopback_test: use octal permissions instead of symbolic
checkpatch.pl warning: Symbolic permissions are not preferred. Consider using octal permissions. Signed-off-by: Igor Pylypiv--- drivers/staging/greybus/tools/loopback_test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c index 5312b2a..18d7a3d 100644 --- a/drivers/staging/greybus/tools/loopback_test.c +++ b/drivers/staging/greybus/tools/loopback_test.c @@ -521,7 +521,6 @@ static int log_results(struct loopback_test *t) int fd, i, len, ret; struct tm tm; time_t local_time; - mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; char file_name[MAX_SYSFS_PATH]; char data[CSV_MAX_LINE]; @@ -538,7 +537,7 @@ static int log_results(struct loopback_test *t) snprintf(file_name, sizeof(file_name), "%s_%d_%d.csv", t->test_name, t->size, t->iteration_max); - fd = open(file_name, O_WRONLY | O_CREAT | O_APPEND, mode); + fd = open(file_name, O_WRONLY | O_CREAT | O_APPEND, 0644); if (fd < 0) { fprintf(stderr, "unable to open %s for appendation\n", file_name); abort(); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 16/24] media: Add i.MX media core driver
On 01/14/2017 02:42 PM, Steve Longerbeam wrote: +/* parse inputs property from a sensor node */ +static void of_parse_sensor_inputs(struct imx_media_dev *imxmd, + struct imx_media_subdev *sensor, + struct device_node *sensor_np) +{ + struct imx_media_sensor_input *sinput = >input; + int ret, i; + + for (i = 0; i < IMX_MEDIA_MAX_SENSOR_INPUTS; i++) { + const char *input_name; + u32 val; + + ret = of_property_read_u32_index(sensor_np, "inputs", i, ); + if (ret) + break; + + sinput->value[i] = val; + + ret = of_property_read_string_index(sensor_np, "input-names", + i, _name); + /* +* if input-names not provided, they will be set using +* the subdev name once the sensor is known during +* async bind +*/ + if (!ret) + strncpy(sinput->name[i], input_name, + sizeof(sinput->name[i])); + } + + sinput->num = i; + + /* if no inputs provided just assume a single input */ + if (sinput->num == 0) + sinput->num = 1; +} This should be parsed by the sensor driver, not imx-media. you're probably right. I'll submit a patch for adv7180.c. Actually, the problem here is that this parses an input routing value to pass to s_routing, and an input name string. There would need to be another subdev callback, maybe enum_imput, that would return this information for the bridge driver, if this info were to be parsed and maintained by the sensor. But this info should really be known and parsed by the bridge anyway, because as the header for s_routing states, "An i2c device shouldn't know about whether an input pin is connected to a Composite connector, because on another board or platform it might be connected to something else entirely. The calling driver is responsible for mapping a user-level input to the right pins on the i2c device." Steve ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: pull-request: vmbus 2017-01-13
On Sat, 14 Jan 2017 14:16:07 +0100 Greg KHwrote: > On Fri, Jan 13, 2017 at 11:45:21AM -0800, Stephen Hemminger wrote: > > Here is an update with cleanups based on recent changes. > > > > The following changes since commit b0f2d7d546d37697d3f50753904f6f0c549b62bc: > > > > VME: Remove node entry from vme_driver (2017-01-11 09:21:41 +0100) > > > > are available in the git repository at: > > > > git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/vmbus-next > > That's a random branch, not a signed tag :( > > Why not just send these as patches? I was using pull request so that there were no conflicts. Also makes it easier for others to get all of them for testing. I don't see others using signed-tags (bluetooth, ipsec, intel drivers) though it would have been better to use a more obvious branch name. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] scsi: storvsc: Add support for FC lightweight host.
On Wed, Jan 18, 2017 at 03:28:58PM -0500, Cathy Avery wrote: > Enable FC lightweight host option so that the luns exposed by > the driver may be manually scanned. > > Signed-off-by: Cathy Avery> --- > drivers/scsi/storvsc_drv.c | 6 +- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c > index 888e16e..fc1d6ba 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -1882,6 +1882,7 @@ static struct hv_driver storvsc_drv = { > static struct fc_function_template fc_transport_functions = { > .show_host_node_name = 1, > .show_host_port_name = 1, > + .lightweight_transport = 1, > }; > #endif > > @@ -1906,11 +1907,6 @@ static int __init storvsc_drv_init(void) > fc_transport_template = fc_attach_transport(_transport_functions); > if (!fc_transport_template) > return -ENODEV; > - > - /* > - * Install Hyper-V specific timeout handler. > - */ > - fc_transport_template->eh_timed_out = storvsc_eh_timed_out; I don't undestand how removing this is related. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] iio: trigger: free trigger resource correctly
On Wed, Jan 18, 2017 at 12:56:29PM +0300, Dan Carpenter wrote: > On Tue, Jan 17, 2017 at 07:00:28PM -0800, Alison Schofield wrote: > > Using iio_trigger_put() to free a trigger leads to release of > > a resource we never held. Replace with iio_trigger_free(). > > They're basically the same except iio_trigger_put() puts the module and > the device and free only puts the device. > > I've looked at this briefly, but I can't figure out how iio_trigger_get/ > iio_trigger_put is supposed to be used. There isn't any documentation. > I'm trying to review this code, but I can't figure out where we *are* > supposed to be doing the put. > > For example, iio_device_unregister_trigger_consumer() takes a put, but > iio_device_register_trigger_consumer() doesn't do a get... It's all > very confusing. > > You seem like you know what's going on. Can we get some documentation? > Dan, Although I'm comfortable within the bounds of this fix (pair the alloc & free's and do not _put the module resource we never _get'd) beyond that, not so much. I'm just figuring it out myself. linux-iio experts...pointers, help? alisons > > > > Signed-off-by: Alison Schofield> > --- > > Patches to use devm_* funcs are ready to follow this for > > the interrupt & bfin-timer triggers. > > > > drivers/iio/trigger/iio-trig-interrupt.c | 4 ++-- > > drivers/iio/trigger/iio-trig-sysfs.c | 2 +- > > drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 4 ++-- > > 3 files changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/iio/trigger/iio-trig-interrupt.c > > b/drivers/iio/trigger/iio-trig-interrupt.c > > index 572bc6f..b18e50d 100644 > > --- a/drivers/iio/trigger/iio-trig-interrupt.c > > +++ b/drivers/iio/trigger/iio-trig-interrupt.c > > @@ -84,7 +84,7 @@ static int iio_interrupt_trigger_probe(struct > > platform_device *pdev) > > error_free_trig_info: > > kfree(trig_info); > > error_put_trigger: > > - iio_trigger_put(trig); > > + iio_trigger_free(trig); > > > We could rename this label. > > regards, > dan carpenter > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/9] VC04_SERVICES: Add top level compat ioctl handler
On Wed, Jan 18, 2017 at 07:04:46AM -0800, Michael Zoran wrote: > Add the top level compat ioctl handler as a placeholder > for adding additional handlers. > > The ioctls are first filtered and forwarded to the > regular ioctl handler if the ioctl does not require > any extra compatibility processing. > > Signed-off-by: Michael Zoran> --- > .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 73 > ++ > 1 file changed, 73 insertions(+) > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > index 0525211bcd65..9ade2f63606b 100644 > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > @@ -1206,6 +1206,76 @@ vchiq_ioctl(struct file *file, unsigned int cmd, > unsigned long arg) > return ret; > } > > +#if defined(CONFIG_COMPAT) > + > +static long > +vchiq_ioctl_compat_internal( > + struct file *file, > + unsigned int cmd, > + unsigned long arg) Align these with the open parenthesis. > +{ > + VCHIQ_INSTANCE_T instance = file->private_data; > + VCHIQ_STATUS_T status = VCHIQ_SUCCESS; > + VCHIQ_SERVICE_T *service = NULL; > + long ret = 0; > + > + DEBUG_INITIALISE(g_state.local) What a horrible little macro... > + > + vchiq_log_trace(vchiq_arm_log_level, > + "vchiq_ioctl_compat - instance %pK, cmd %s, arg %lx", > + instance, > + ((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) && > + (_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ? > + ioctl_names[_IOC_NR(cmd)] : "", arg); > + > + switch (cmd) { > + default: > + ret = -ENOTTY; > + break; > + } Ugh... > + > + if (service) > + unlock_service(service); More ugh... > + > + if (ret == 0) { What the heck??? I feel you're trying to gaslight me now. It's unfortunate that this is right at the start of the series because I've already met my quota of nonsense code and I won't be reviewing the rest until v2 comes out. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next] net: Remove usage of net_device last_rx member
From: Tobias KlauserDate: Wed, 18 Jan 2017 17:45:01 +0100 > The network stack no longer uses the last_rx member of struct net_device > since the bonding driver switched to use its own private last_rx in > commit 9f242738376d ("bonding: use last_arp_rx in slave_last_rx()"). > > However, some drivers still (ab)use the field for their own purposes and > some driver just update it without actually using it. > > Previously, there was an accompanying comment for the last_rx member > added in commit 4dc89133f49b ("net: add a comment on netdev->last_rx") > which asked drivers not to update is, unless really needed. However, > this commend was removed in commit f8ff080dacec ("bonding: remove > useless updating of slave->dev->last_rx"), so some drivers added later > on still did update last_rx. > > Remove all usage of last_rx and switch three drivers (sky2, atp and > smc91c92_cs) which actually read and write it to use their own private > copy in netdev_priv. > > Compile-tested with allyesconfig and allmodconfig on x86 and arm. > > Cc: Eric Dumazet > Cc: Jay Vosburgh > Cc: Veaceslav Falico > Cc: Andy Gospodarek > Cc: Mirko Lindner > Cc: Stephen Hemminger > Signed-off-by: Tobias Klauser Applied, thanks. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] scsi: scsi_transport_fc: Provide a lightweight option for Virtual FC Hosts.
The patch provides a means to offer a lightweight option to the current FC transport class. The new option is selected by a driver when it indicates it wants the lightweight transport via fc_function_template. Signed-off-by: Cathy Avery--- drivers/scsi/scsi_transport_fc.c | 125 +-- include/scsi/scsi_transport_fc.h | 1 + 2 files changed, 122 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 03577bd..4adc669 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -50,6 +50,15 @@ static int fc_bsg_hostadd(struct Scsi_Host *, struct fc_host_attrs *); static int fc_bsg_rportadd(struct Scsi_Host *, struct fc_rport *); static void fc_bsg_remove(struct request_queue *); static void fc_bsg_goose_queue(struct fc_rport *); +static int fc_host_lw_setup(struct Scsi_Host *, struct fc_host_attrs *); +static int fc_host_hw_setup(struct Scsi_Host *, struct fc_host_attrs *); +static int fc_host_hw_remove(struct fc_host_attrs *); +static struct scsi_transport_template * + fc_attach_lw_transport(struct fc_function_template *); +static struct scsi_transport_template * + fc_attach_hw_transport(struct fc_function_template *); +static void fc_remove_lw_host(struct Scsi_Host *); +static void fc_remove_hw_host(struct Scsi_Host *, struct fc_host_attrs *); /* * Module Parameters @@ -352,6 +361,10 @@ struct fc_internal { #define to_fc_internal(tmpl) container_of(tmpl, struct fc_internal, t) + +static void fc_release_lw_transport(struct fc_internal *); +static void fc_release_hw_transport(struct fc_internal *); + static int fc_target_setup(struct transport_container *tc, struct device *dev, struct device *cdev) { @@ -387,7 +400,26 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev, { struct Scsi_Host *shost = dev_to_shost(dev); struct fc_host_attrs *fc_host = shost_to_fc_host(shost); + struct fc_internal *i = to_fc_internal(shost->transportt); + + if (i->f->lightweight_transport) + return fc_host_lw_setup(shost, fc_host); + + return fc_host_hw_setup(shost, fc_host); +} + +static int fc_host_lw_setup(struct Scsi_Host *shost, + struct fc_host_attrs *fc_host) +{ + fc_host->node_name = -1; + fc_host->port_name = -1; + + return 0; +} +static int fc_host_hw_setup(struct Scsi_Host *shost, + struct fc_host_attrs *fc_host) +{ /* * Set default values easily detected by the midlayer as * failure cases. The scsi lldd is responsible for initializing @@ -468,7 +500,16 @@ static int fc_host_remove(struct transport_container *tc, struct device *dev, { struct Scsi_Host *shost = dev_to_shost(dev); struct fc_host_attrs *fc_host = shost_to_fc_host(shost); + struct fc_internal *i = to_fc_internal(shost->transportt); + + if (i->f->lightweight_transport) + return 0; + return fc_host_hw_remove(fc_host); +} + +static int fc_host_hw_remove(struct fc_host_attrs *fc_host) +{ fc_bsg_remove(fc_host->rqst_q); return 0; } @@ -2175,6 +2216,49 @@ static int fc_it_nexus_response(struct Scsi_Host *shost, u64 nexus, int result) struct scsi_transport_template * fc_attach_transport(struct fc_function_template *ft) { + if (ft->lightweight_transport) + return fc_attach_lw_transport(ft); + + return fc_attach_hw_transport(ft); +} +EXPORT_SYMBOL(fc_attach_transport); + + +struct scsi_transport_template * +fc_attach_lw_transport(struct fc_function_template *ft) +{ + int count; + struct fc_internal *i; + + i = kzalloc(sizeof(struct fc_internal), + GFP_KERNEL); + + if (unlikely(!i)) + return NULL; + + i->t.host_attrs.ac.attrs = >host_attrs[0]; + i->t.host_attrs.ac.class = _host_class.class; + i->t.host_attrs.ac.match = fc_host_match; + i->t.host_size = sizeof(struct fc_host_attrs); + transport_container_register(>t.host_attrs); + + i->f = ft; + + count = 0; + SETUP_HOST_ATTRIBUTE_RD(node_name); + SETUP_HOST_ATTRIBUTE_RD(port_name); + + BUG_ON(count > FC_HOST_NUM_ATTRS); + + i->host_attrs[count] = NULL; + + return >t; +} + + +struct scsi_transport_template * +fc_attach_hw_transport(struct fc_function_template *ft) +{ int count; struct fc_internal *i = kzalloc(sizeof(struct fc_internal), GFP_KERNEL); @@ -2318,12 +2402,27 @@ fc_attach_transport(struct fc_function_template *ft) return >t; } -EXPORT_SYMBOL(fc_attach_transport); void fc_release_transport(struct scsi_transport_template *t) { struct fc_internal *i = to_fc_internal(t); + if (i->f->lightweight_transport) +
[PATCH 2/2] scsi: storvsc: Add support for FC lightweight host.
Enable FC lightweight host option so that the luns exposed by the driver may be manually scanned. Signed-off-by: Cathy Avery--- drivers/scsi/storvsc_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 888e16e..fc1d6ba 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1882,6 +1882,7 @@ static struct hv_driver storvsc_drv = { static struct fc_function_template fc_transport_functions = { .show_host_node_name = 1, .show_host_port_name = 1, + .lightweight_transport = 1, }; #endif @@ -1906,11 +1907,6 @@ static int __init storvsc_drv_init(void) fc_transport_template = fc_attach_transport(_transport_functions); if (!fc_transport_template) return -ENODEV; - - /* -* Install Hyper-V specific timeout handler. -*/ - fc_transport_template->eh_timed_out = storvsc_eh_timed_out; #endif ret = vmbus_driver_register(_drv); -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] scsi: Create a lightweight FC Transport option for Virtual FC Hosts.
Currently virtual FC hosts or lightweight hosts are not able to be manually scanned via sysfs due to the fact that they do not contain the complete characteristic set associated with a normal FC host ( missing rports, vports, etc ) and are not consistent with the current FC transport model. Patch 1: The patch provides a lightweight option to the current FC transport class. The new option is selected by a driver when it indicates it wants the lightweight transport in fc_function_template. Patch 2: storvsc elects using the new lightweight FC host option. Cathy Avery (2): scsi: scsi_transport_fc: Provide a lightweight option for Virtual FC Hosts. scsi: storvsc: Add support for FC lightweight host. drivers/scsi/scsi_transport_fc.c | 125 +-- drivers/scsi/storvsc_drv.c | 6 +- include/scsi/scsi_transport_fc.h | 1 + 3 files changed, 123 insertions(+), 9 deletions(-) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 0/4] Cleanup greybus audio driver
On Wed, Jan 18, 2017 at 10:51:49PM +0530, Vaibhav Agarwal wrote: > This patch series include following cleanup changes in GB Audio driver. > - Avoid unnecessary checks for le32 variables > - Initialize sig_bits before configuring hw_params > - Remove junk codec register mapping > - Ensure proper byte ordering > > Next task is to enable build for GB codec driver. However this requires > pushing some changes in ASoC framework. Possibly in another two weeks > (based on my freetime), I'll try to submit those changes to ASoC mailing > list. And once the same are accepted there, I'll share relevant patches > for GB Audio codec driver as well. > > Changes from v2: > - patch 1/4 > - Update commit message - Mark Greer > - Move le32_to_cpu change to patch 4/4 - Mark Greer > - patch 3/4 > - Remove junk codec register related definitions in .h file - Mark Greer > - patch 4/4 > - Ensure byte order for the variable missed out in v1/v2 - Mark Greer > > Changes from v1: > - Include review comments from Dan For all four patches: Acked-by: Mark Greer___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next] net: Remove usage of net_device last_rx member
Tobias Klauserwrote: >The network stack no longer uses the last_rx member of struct net_device >since the bonding driver switched to use its own private last_rx in >commit 9f242738376d ("bonding: use last_arp_rx in slave_last_rx()"). > >However, some drivers still (ab)use the field for their own purposes and >some driver just update it without actually using it. > >Previously, there was an accompanying comment for the last_rx member >added in commit 4dc89133f49b ("net: add a comment on netdev->last_rx") >which asked drivers not to update is, unless really needed. However, >this commend was removed in commit f8ff080dacec ("bonding: remove >useless updating of slave->dev->last_rx"), so some drivers added later >on still did update last_rx. > >Remove all usage of last_rx and switch three drivers (sky2, atp and >smc91c92_cs) which actually read and write it to use their own private >copy in netdev_priv. > >Compile-tested with allyesconfig and allmodconfig on x86 and arm. Reviewed-by: Jay Vosburgh ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/9] VC04_SERVICES: Add compat ioctl data structures
On Wed, 2017-01-18 at 18:23 +0100, Greg KH wrote: > On Wed, Jan 18, 2017 at 09:18:43AM -0800, Michael Zoran wrote: > > On Wed, 2017-01-18 at 18:13 +0100, Greg KH wrote: > > > On Wed, Jan 18, 2017 at 07:04:45AM -0800, Michael Zoran wrote: > > > > This change adds the compatibility data structures for > > > > compatibility > > > > ioctls and defines compatibility ioctl definitions for the > > > > ioctls > > > > that have changed. > > > > > > > > Signed-off-by: Michael Zoran> > > > --- > > > > .../interface/vchiq_arm/vchiq_ioctl.h | 96 > > > > ++ > > > > 1 file changed, 96 insertions(+) > > > > > > > > diff --git > > > > a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl > > > > .h > > > > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl > > > > .h > > > > index 6137ae9de1c1..1681b7792ef2 100644 > > > > --- > > > > a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl > > > > .h > > > > +++ > > > > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl > > > > .h > > > > @@ -35,6 +35,9 @@ > > > > #define VCHIQ_IOCTLS_H > > > > > > > > #include > > > > +#if defined(CONFIG_COMPAT) > > > > +#include > > > > +#endif > > > > > > Are you sure this ifdef is needed? > > > > > > thanks, > > > > > > greg k-h > > > > You're correct, that specific ifdef isn't necessary. I think the > > one > > around the structure definitions is necessary through. > > Really? Do other compat structures have it in their .h files? > Yes it is necessary to prevent a break, but it appears that most of the other drivers in the kernel either put the compat structures directly in the .c file of the driver or they put it in a header that's just for compat. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 3/4] staging: greybus: audio: Cleanup junk codec registers
From: Vaibhav AgarwalDummy codec register were initially added while populating dummy codec mixer controls until module topology parser was available. Now, these dummy registers are nowhere used and thus can be safely removed. Since ASoC framework requires a valid callback for both read & write register APIS, currently empty placeholders are kept to avoid panic. Later, register mapping logic can be defined: 1. Assuming fixed number of maximum modules connected and register bits corresponds to basic info of each module OR 2. With a logic to dynamically grow register_cache_size based on codec modules added/removed. Signed-off-by: Vaibhav Agarwal Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_codec.c | 39 ++--- drivers/staging/greybus/audio_codec.h | 46 --- 2 files changed, 2 insertions(+), 83 deletions(-) diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index b9d66278ff87..30941f9e380d 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -1026,47 +1026,16 @@ static int gbcodec_remove(struct snd_soc_codec *codec) return 0; } -static u8 gbcodec_reg[GBCODEC_REG_COUNT] = { - [GBCODEC_CTL_REG] = GBCODEC_CTL_REG_DEFAULT, - [GBCODEC_MUTE_REG] = GBCODEC_MUTE_REG_DEFAULT, - [GBCODEC_PB_LVOL_REG] = GBCODEC_PB_VOL_REG_DEFAULT, - [GBCODEC_PB_RVOL_REG] = GBCODEC_PB_VOL_REG_DEFAULT, - [GBCODEC_CAP_LVOL_REG] = GBCODEC_CAP_VOL_REG_DEFAULT, - [GBCODEC_CAP_RVOL_REG] = GBCODEC_CAP_VOL_REG_DEFAULT, - [GBCODEC_APB1_MUX_REG] = GBCODEC_APB1_MUX_REG_DEFAULT, - [GBCODEC_APB2_MUX_REG] = GBCODEC_APB2_MUX_REG_DEFAULT, -}; - static int gbcodec_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value) { - int ret = 0; - - if (reg == SND_SOC_NOPM) - return 0; - - BUG_ON(reg >= GBCODEC_REG_COUNT); - - gbcodec_reg[reg] = value; - dev_dbg(codec->dev, "reg[%d] = 0x%x\n", reg, value); - - return ret; + return 0; } static unsigned int gbcodec_read(struct snd_soc_codec *codec, unsigned int reg) { - unsigned int val = 0; - - if (reg == SND_SOC_NOPM) - return 0; - - BUG_ON(reg >= GBCODEC_REG_COUNT); - - val = gbcodec_reg[reg]; - dev_dbg(codec->dev, "reg[%d] = 0x%x\n", reg, val); - - return val; + return 0; } static struct snd_soc_codec_driver soc_codec_dev_gbaudio = { @@ -1076,10 +1045,6 @@ static struct snd_soc_codec_driver soc_codec_dev_gbaudio = { .read = gbcodec_read, .write = gbcodec_write, - .reg_cache_size = GBCODEC_REG_COUNT, - .reg_cache_default = gbcodec_reg_defaults, - .reg_word_size = 1, - .idle_bias_off = true, .ignore_pmdown_time = 1, }; diff --git a/drivers/staging/greybus/audio_codec.h b/drivers/staging/greybus/audio_codec.h index 62fd93939a1f..6fb064c69a36 100644 --- a/drivers/staging/greybus/audio_codec.h +++ b/drivers/staging/greybus/audio_codec.h @@ -24,18 +24,6 @@ enum { NUM_CODEC_DAIS, }; -enum gbcodec_reg_index { - GBCODEC_CTL_REG, - GBCODEC_MUTE_REG, - GBCODEC_PB_LVOL_REG, - GBCODEC_PB_RVOL_REG, - GBCODEC_CAP_LVOL_REG, - GBCODEC_CAP_RVOL_REG, - GBCODEC_APB1_MUX_REG, - GBCODEC_APB2_MUX_REG, - GBCODEC_REG_COUNT -}; - /* device_type should be same as defined in audio.h (Android media layer) */ enum { GBAUDIO_DEVICE_NONE = 0x0, @@ -51,42 +39,9 @@ enum { GBAUDIO_DEVICE_IN_WIRED_HEADSET = GBAUDIO_DEVICE_BIT_IN | 0x10, }; -/* bit 0-SPK, 1-HP, 2-DAC, - * 4-MIC, 5-HSMIC, 6-MIC2 - */ -#define GBCODEC_CTL_REG_DEFAULT0x00 - -/* bit 0,1 - APB1-PB-L/R - * bit 2,3 - APB2-PB-L/R - * bit 4,5 - APB1-Cap-L/R - * bit 6,7 - APB2-Cap-L/R - */ -#defineGBCODEC_MUTE_REG_DEFAULT0x00 - -/* 0-127 steps */ -#defineGBCODEC_PB_VOL_REG_DEFAULT 0x00 -#defineGBCODEC_CAP_VOL_REG_DEFAULT 0x00 - -/* bit 0,1,2 - PB stereo, left, right - * bit 8,9,10 - Cap stereo, left, right - */ -#define GBCODEC_APB1_MUX_REG_DEFAULT 0x00 -#define GBCODEC_APB2_MUX_REG_DEFAULT 0x00 - #define GBCODEC_JACK_MASK 0x #define GBCODEC_JACK_BUTTON_MASK 0x -static const u8 gbcodec_reg_defaults[GBCODEC_REG_COUNT] = { - GBCODEC_CTL_REG_DEFAULT, - GBCODEC_MUTE_REG_DEFAULT, - GBCODEC_PB_VOL_REG_DEFAULT, - GBCODEC_PB_VOL_REG_DEFAULT, - GBCODEC_CAP_VOL_REG_DEFAULT, - GBCODEC_CAP_VOL_REG_DEFAULT, - GBCODEC_APB1_MUX_REG_DEFAULT, - GBCODEC_APB2_MUX_REG_DEFAULT, -}; - enum gbaudio_codec_state { GBAUDIO_CODEC_SHUTDOWN = 0, GBAUDIO_CODEC_STARTUP, @@ -116,7 +71,6 @@ struct
Re: [PATCH net-next] net: Remove usage of net_device last_rx member
On Wed, 2017-01-18 at 17:45 +0100, Tobias Klauser wrote: > The network stack no longer uses the last_rx member of struct net_device > since the bonding driver switched to use its own private last_rx in > commit 9f242738376d ("bonding: use last_arp_rx in slave_last_rx()"). > > However, some drivers still (ab)use the field for their own purposes and > some driver just update it without actually using it. > > Previously, there was an accompanying comment for the last_rx member > added in commit 4dc89133f49b ("net: add a comment on netdev->last_rx") > which asked drivers not to update is, unless really needed. However, > this commend was removed in commit f8ff080dacec ("bonding: remove > useless updating of slave->dev->last_rx"), so some drivers added later > on still did update last_rx. > > Remove all usage of last_rx and switch three drivers (sky2, atp and > smc91c92_cs) which actually read and write it to use their own private > copy in netdev_priv. > > Compile-tested with allyesconfig and allmodconfig on x86 and arm. SGTM, thanks a lot for doing this Tobias. Acked-by: Eric Dumazet___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/9] VC04_SERVICES: Add compat ioctl data structures
On Wed, Jan 18, 2017 at 09:18:43AM -0800, Michael Zoran wrote: > On Wed, 2017-01-18 at 18:13 +0100, Greg KH wrote: > > On Wed, Jan 18, 2017 at 07:04:45AM -0800, Michael Zoran wrote: > > > This change adds the compatibility data structures for > > > compatibility > > > ioctls and defines compatibility ioctl definitions for the ioctls > > > that have changed. > > > > > > Signed-off-by: Michael Zoran> > > --- > > > .../interface/vchiq_arm/vchiq_ioctl.h | 96 > > > ++ > > > 1 file changed, 96 insertions(+) > > > > > > diff --git > > > a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > > index 6137ae9de1c1..1681b7792ef2 100644 > > > --- > > > a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > > +++ > > > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > > @@ -35,6 +35,9 @@ > > > #define VCHIQ_IOCTLS_H > > > > > > #include > > > +#if defined(CONFIG_COMPAT) > > > +#include > > > +#endif > > > > Are you sure this ifdef is needed? > > > > thanks, > > > > greg k-h > > You're correct, that specific ifdef isn't necessary. I think the one > around the structure definitions is necessary through. Really? Do other compat structures have it in their .h files? > I'm more then willing to incorporate removing it into a V2 version of > this series, but I would like to get as much feedback as possible on > the set so that I can make all the needed changes at once. Sure, that's fine, I'll review them tomorrow... thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/4] staging: greybus: audio: Avoid less than zero check for le32 variable
mixer control->info call back function checks for -ve values to rebase min and max values. However, le32 variable is used to fetch values from GB module FW. Thus negative value checking is not required. Fix this!! Signed-off-by: Vaibhav Agarwal--- drivers/staging/greybus/audio_topology.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index 3001a4971c06..ee2113eb899e 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -371,12 +371,8 @@ static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = data->vcount; - uinfo->value.integer.min = 0; - if (info->value.integer.min < 0 && - (uinfo->type == SNDRV_CTL_ELEM_TYPE_INTEGER)) - uinfo->value.integer.max = platform_max - platform_min; - else - uinfo->value.integer.max = platform_max; + uinfo->value.integer.min = platform_min; + uinfo->value.integer.max = platform_max; return 0; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 2/4] staging: greybus: audio: Initialize sig_bits before configuring hwparams
From: Vaibhav AgarwalUninitialized variable sig_bits was used while configuring stream params for codec module. These params are used to configure PCM settings for APBridgeA. Usually, this is dependent on codec capability and thus populated via codec dai_driver definition. In our case, it is fixed to 16 based on the data format, container supported. Signed-off-by: Vaibhav Agarwal Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_codec.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index f8862c6d7102..b9d66278ff87 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -496,6 +496,11 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream, gb_pm_runtime_put_noidle(bundle); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + sig_bits = dai->driver->playback.sig_bits; + else + sig_bits = dai->driver->capture.sig_bits; + params->state = GBAUDIO_CODEC_HWPARAMS; params->format = format; params->rate = rate; @@ -689,6 +694,7 @@ static struct snd_soc_dai_driver gbaudio_dai[] = { .rate_min = 48000, .channels_min = 1, .channels_max = 2, + .sig_bits = 16, }, .capture = { .stream_name = "I2S 0 Capture", @@ -698,6 +704,7 @@ static struct snd_soc_dai_driver gbaudio_dai[] = { .rate_min = 48000, .channels_min = 1, .channels_max = 2, + .sig_bits = 16, }, .ops = _dai_ops, }, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 4/4] staging: greybus: audio: Ensure proper byte order
From: Vaibhav AgarwalProper byte order was completely disregarded for multi byte data shared between AP and module (and APB1). Fix this. Signed-off-by: Vaibhav Agarwal Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_module.c | 2 +- drivers/staging/greybus/audio_topology.c | 94 +--- 2 files changed, 51 insertions(+), 45 deletions(-) diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index 17a9948b1ba1..094c3be79b33 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -134,7 +134,7 @@ static int gbaudio_request_stream(struct gbaudio_module_info *module, struct gb_audio_streaming_event_request *req) { dev_warn(module->dev, "Audio Event received: cport: %u, event: %u\n", -req->data_cport, req->event); +le16_to_cpu(req->data_cport), req->event); return 0; } diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index ee2113eb899e..07fac3948f3a 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -141,13 +141,14 @@ static const char **gb_generate_enum_strings(struct gbaudio_module_info *gb, { const char **strings; int i; + unsigned int items; __u8 *data; - strings = devm_kzalloc(gb->dev, sizeof(char *) * gbenum->items, - GFP_KERNEL); + items = le32_to_cpu(gbenum->items); + strings = devm_kzalloc(gb->dev, sizeof(char *) * items, GFP_KERNEL); data = gbenum->names; - for (i = 0; i < gbenum->items; i++) { + for (i = 0; i < items; i++) { strings[i] = (const char *)data; while (*data != '\0') data++; @@ -185,11 +186,11 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, switch (info->type) { case GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN: case GB_AUDIO_CTL_ELEM_TYPE_INTEGER: - uinfo->value.integer.min = info->value.integer.min; - uinfo->value.integer.max = info->value.integer.max; + uinfo->value.integer.min = le32_to_cpu(info->value.integer.min); + uinfo->value.integer.max = le32_to_cpu(info->value.integer.max); break; case GB_AUDIO_CTL_ELEM_TYPE_ENUMERATED: - max = info->value.enumerated.items; + max = le32_to_cpu(info->value.enumerated.items); uinfo->value.enumerated.items = max; if (uinfo->value.enumerated.item > max - 1) uinfo->value.enumerated.item = max - 1; @@ -249,17 +250,17 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, case GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN: case GB_AUDIO_CTL_ELEM_TYPE_INTEGER: ucontrol->value.integer.value[0] = - gbvalue.value.integer_value[0]; + le32_to_cpu(gbvalue.value.integer_value[0]); if (data->vcount == 2) ucontrol->value.integer.value[1] = - gbvalue.value.integer_value[1]; + le32_to_cpu(gbvalue.value.integer_value[1]); break; case GB_AUDIO_CTL_ELEM_TYPE_ENUMERATED: ucontrol->value.enumerated.item[0] = - gbvalue.value.enumerated_item[0]; + le32_to_cpu(gbvalue.value.enumerated_item[0]); if (data->vcount == 2) ucontrol->value.enumerated.item[1] = - gbvalue.value.enumerated_item[1]; + le32_to_cpu(gbvalue.value.enumerated_item[1]); break; default: dev_err(codec->dev, "Invalid type: %d for %s:kcontrol\n", @@ -296,17 +297,17 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol, case GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN: case GB_AUDIO_CTL_ELEM_TYPE_INTEGER: gbvalue.value.integer_value[0] = - ucontrol->value.integer.value[0]; + cpu_to_le32(ucontrol->value.integer.value[0]); if (data->vcount == 2) gbvalue.value.integer_value[1] = - ucontrol->value.integer.value[1]; + cpu_to_le32(ucontrol->value.integer.value[1]); break; case GB_AUDIO_CTL_ELEM_TYPE_ENUMERATED: gbvalue.value.enumerated_item[0] = - ucontrol->value.enumerated.item[0]; + cpu_to_le32(ucontrol->value.enumerated.item[0]); if (data->vcount == 2)
Re: [PATCH v2] staging: fsl-mc: fix coding stye errors
On Wed, Jan 18, 2017 at 11:53:07AM +0100, Dhananjay Balan wrote: > Split line at boolean operator. > > Error was reported by checkpatch.pl as > WARNING: Avoid multiple line dereference - prefer 'mc_msi_domain->host_data' > > Signed-off-by: Dhananjay Balan> --- > drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) What changed in v2? That has to go below the --- line. Please fix it up and resend v3 with that information and read Documentation/SubmittingPatches for all of the details about this. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 0/4] Cleanup greybus audio driver
This patch series include following cleanup changes in GB Audio driver. - Avoid unnecessary checks for le32 variables - Initialize sig_bits before configuring hw_params - Remove junk codec register mapping - Ensure proper byte ordering Next task is to enable build for GB codec driver. However this requires pushing some changes in ASoC framework. Possibly in another two weeks (based on my freetime), I'll try to submit those changes to ASoC mailing list. And once the same are accepted there, I'll share relevant patches for GB Audio codec driver as well. Changes from v2: - patch 1/4 - Update commit message - Mark Greer - Move le32_to_cpu change to patch 4/4 - Mark Greer - patch 3/4 - Remove junk codec register related definitions in .h file - Mark Greer - patch 4/4 - Ensure byte order for the variable missed out in v1/v2 - Mark Greer Changes from v1: - Include review comments from Dan Vaibhav Agarwal (4): staging: greybus: audio: Avoid less than zero check for le32 variable staging: greybus: audio: Initialize sig_bits before configuring hwparams staging: greybus: audio: Cleanup junk codec registers staging: greybus: audio: Ensure proper byte order drivers/staging/greybus/audio_codec.c| 46 +++--- drivers/staging/greybus/audio_codec.h| 46 -- drivers/staging/greybus/audio_module.c | 2 +- drivers/staging/greybus/audio_topology.c | 102 --- 4 files changed, 62 insertions(+), 134 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/9] VC04_SERVICES: Add compat ioctl data structures
On Wed, 2017-01-18 at 18:13 +0100, Greg KH wrote: > On Wed, Jan 18, 2017 at 07:04:45AM -0800, Michael Zoran wrote: > > This change adds the compatibility data structures for > > compatibility > > ioctls and defines compatibility ioctl definitions for the ioctls > > that have changed. > > > > Signed-off-by: Michael Zoran> > --- > > .../interface/vchiq_arm/vchiq_ioctl.h | 96 > > ++ > > 1 file changed, 96 insertions(+) > > > > diff --git > > a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > index 6137ae9de1c1..1681b7792ef2 100644 > > --- > > a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > +++ > > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > > @@ -35,6 +35,9 @@ > > #define VCHIQ_IOCTLS_H > > > > #include > > +#if defined(CONFIG_COMPAT) > > +#include > > +#endif > > Are you sure this ifdef is needed? > > thanks, > > greg k-h You're correct, that specific ifdef isn't necessary. I think the one around the structure definitions is necessary through. I'm more then willing to incorporate removing it into a V2 version of this series, but I would like to get as much feedback as possible on the set so that I can make all the needed changes at once. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/9] VC04_SERVICES: Add compat ioctl data structures
On Wed, Jan 18, 2017 at 07:04:45AM -0800, Michael Zoran wrote: > This change adds the compatibility data structures for compatibility > ioctls and defines compatibility ioctl definitions for the ioctls > that have changed. > > Signed-off-by: Michael Zoran> --- > .../interface/vchiq_arm/vchiq_ioctl.h | 96 > ++ > 1 file changed, 96 insertions(+) > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > index 6137ae9de1c1..1681b7792ef2 100644 > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h > @@ -35,6 +35,9 @@ > #define VCHIQ_IOCTLS_H > > #include > +#if defined(CONFIG_COMPAT) > +#include > +#endif Are you sure this ifdef is needed? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 4/4] staging: greybus: audio: Ensure proper byte order
On Tue, Jan 17, 2017 at 11:22 PM, Mark Greerwrote: > On Tue, Jan 17, 2017 at 08:19:30PM +0530, Vaibhav Agarwal wrote: >> From: Vaibhav Agarwal >> >> Proper byte order was completely disregarded for multi byte data shared >> between AP and module (and APB1). Fix this. >> >> Signed-off-by: Vaibhav Agarwal >> --- > > Hi Vaibhav. > > I think you got them all except for this one in > audio_topology.c:gbcodec_mixer_dapm_ctl_put(): > max = info->value.integer.max; <<< > mask = (1 << fls(max)) - 1; > val = ucontrol->value.integer.value[0] & mask; > connect = !!val; Oh Ok. I'll include this change in v3. -- vaibhav > > Mark > -- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] net: Remove usage of net_device last_rx member
The network stack no longer uses the last_rx member of struct net_device since the bonding driver switched to use its own private last_rx in commit 9f242738376d ("bonding: use last_arp_rx in slave_last_rx()"). However, some drivers still (ab)use the field for their own purposes and some driver just update it without actually using it. Previously, there was an accompanying comment for the last_rx member added in commit 4dc89133f49b ("net: add a comment on netdev->last_rx") which asked drivers not to update is, unless really needed. However, this commend was removed in commit f8ff080dacec ("bonding: remove useless updating of slave->dev->last_rx"), so some drivers added later on still did update last_rx. Remove all usage of last_rx and switch three drivers (sky2, atp and smc91c92_cs) which actually read and write it to use their own private copy in netdev_priv. Compile-tested with allyesconfig and allmodconfig on x86 and arm. Cc: Eric DumazetCc: Jay Vosburgh Cc: Veaceslav Falico Cc: Andy Gospodarek Cc: Mirko Lindner Cc: Stephen Hemminger Signed-off-by: Tobias Klauser --- arch/m68k/emu/nfeth.c | 1 - drivers/net/ethernet/cavium/liquidio/lio_main.c| 1 - drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 1 - drivers/net/ethernet/hisilicon/hns/hns_enet.c | 1 - drivers/net/ethernet/intel/e1000e/netdev.c | 6 +++--- drivers/net/ethernet/intel/igb/igb_main.c | 6 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 +++ drivers/net/ethernet/marvell/sky2.c| 6 +++--- drivers/net/ethernet/marvell/sky2.h| 1 + drivers/net/ethernet/qualcomm/emac/emac-mac.c | 1 - drivers/net/ethernet/realtek/atp.c | 7 +++ drivers/net/ethernet/smsc/smc91c92_cs.c| 6 -- drivers/net/irda/bfin_sir.c| 5 ++--- drivers/net/irda/sh_sir.c | 1 - drivers/staging/ks7010/ks_hostif.c | 2 -- drivers/staging/netlogic/xlr_net.c | 1 - drivers/staging/rtl8192e/rtllib_rx.c | 1 - drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 drivers/staging/wlan-ng/hfa384x_usb.c | 1 - drivers/staging/wlan-ng/p80211netdev.c | 2 -- include/linux/netdevice.h | 3 --- net/batman-adv/bridge_loop_avoidance.c | 1 - net/batman-adv/distributed-arp-table.c | 1 - net/batman-adv/soft-interface.c| 2 -- 24 files changed, 22 insertions(+), 46 deletions(-) diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c index fc4be028c418..e45ce4243aaa 100644 --- a/arch/m68k/emu/nfeth.c +++ b/arch/m68k/emu/nfeth.c @@ -124,7 +124,6 @@ static inline void recv_packet(struct net_device *dev) skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - dev->last_rx = jiffies; dev->stats.rx_packets++; dev->stats.rx_bytes += pktlen; diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index 2b89ec291b8b..5ee3f007c613 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c @@ -2360,7 +2360,6 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)), if (packet_was_received) { droq->stats.rx_bytes_received += len; droq->stats.rx_pkts_received++; - netdev->last_rx = jiffies; } else { droq->stats.rx_dropped++; netif_info(lio, rx_err, lio->netdev, diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c index 19d88fb387ce..e96cf6cdecfd 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c @@ -1571,7 +1571,6 @@ liquidio_push_packet(u32 octeon_id __attribute__((unused)), if (packet_was_received) { droq->stats.rx_bytes_received += len; droq->stats.rx_pkts_received++; - netdev->last_rx = jiffies; } else { droq->stats.rx_dropped++; netif_info(lio, rx_err, lio->netdev, diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index b7cb61385ad8..f7b75e96c1c3 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -797,7 +797,6 @@ static void hns_nic_rx_up_pro(struct hns_nic_ring_data *ring_data, skb->protocol = eth_type_trans(skb, ndev); (void)napi_gro_receive(_data->napi, skb); -
Re: [PATCH v2 3/4] staging: greybus: audio: Cleanup junk codec registers
On Tue, Jan 17, 2017 at 11:04 PM, Mark Greerwrote: > On Tue, Jan 17, 2017 at 08:19:29PM +0530, Vaibhav Agarwal wrote: >> From: Vaibhav Agarwal >> >> Dummy codec register were initially added while populating dummy codec >> mixer controls until module topology parser was available. Now, these >> dummy registers are nowhere used and thus can be safely removed. >> >> Since ASoC framework requires a valid callback for both read & write >> register APIS, currently empty placeholders are kept to avoid panic. >> >> Later, register mapping logic can be defined: >> 1. Assuming fixed number of maximum modules connected and register bits >> corresponds to basic info of each module OR >> 2. With a logic to dynamically grow register_cache_size based on codec >> modules added/removed. >> >> Signed-off-by: Vaibhav Agarwal >> --- >> drivers/staging/greybus/audio_codec.c | 39 >> ++- >> 1 file changed, 2 insertions(+), 37 deletions(-) >> >> diff --git a/drivers/staging/greybus/audio_codec.c >> b/drivers/staging/greybus/audio_codec.c >> index b9d66278ff87..30941f9e380d 100644 >> --- a/drivers/staging/greybus/audio_codec.c >> +++ b/drivers/staging/greybus/audio_codec.c >> @@ -1026,47 +1026,16 @@ static int gbcodec_remove(struct snd_soc_codec >> *codec) >> return 0; >> } >> >> -static u8 gbcodec_reg[GBCODEC_REG_COUNT] = { >> - [GBCODEC_CTL_REG] = GBCODEC_CTL_REG_DEFAULT, >> - [GBCODEC_MUTE_REG] = GBCODEC_MUTE_REG_DEFAULT, >> - [GBCODEC_PB_LVOL_REG] = GBCODEC_PB_VOL_REG_DEFAULT, >> - [GBCODEC_PB_RVOL_REG] = GBCODEC_PB_VOL_REG_DEFAULT, >> - [GBCODEC_CAP_LVOL_REG] = GBCODEC_CAP_VOL_REG_DEFAULT, >> - [GBCODEC_CAP_RVOL_REG] = GBCODEC_CAP_VOL_REG_DEFAULT, >> - [GBCODEC_APB1_MUX_REG] = GBCODEC_APB1_MUX_REG_DEFAULT, >> - [GBCODEC_APB2_MUX_REG] = GBCODEC_APB2_MUX_REG_DEFAULT, >> -}; >> - > > gbcodec_reg_defaults[] and the definitions of 'GBCODEC_CTL_REG_DEFAULT', > etc. can be removed now too, can't they? Of course, this should be removed as well. Nice catch. Thanks :) -- vaibhav > > The rest looks good. > > Mark > -- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/4] staging: greybus: audio: Avoid less than zero check for le32 variable
On Tue, Jan 17, 2017 at 10:56 PM, Mark Greerwrote: > Hi Vaibhav. > > On Tue, Jan 17, 2017 at 08:19:27PM +0530, Vaibhav Agarwal wrote: >> mixer control->info call back function checks for -ve values to rebase >> min and max values. However, le32 variable is used to fetch values from >> GB module FW. Thus -ve value checking is not required. Fix this!! > > nit: Please spell out "negative" so it is as easy as possible for the > casual observer to understand what you're saying. Will modify in v3. > >> Signed-off-by: Vaibhav Agarwal >> --- >> drivers/staging/greybus/audio_topology.c | 12 >> 1 file changed, 4 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/staging/greybus/audio_topology.c >> b/drivers/staging/greybus/audio_topology.c >> index 3001a4971c06..a8b63a8b2bb0 100644 >> --- a/drivers/staging/greybus/audio_topology.c >> +++ b/drivers/staging/greybus/audio_topology.c >> @@ -361,8 +361,8 @@ static int gbcodec_mixer_dapm_ctl_info(struct >> snd_kcontrol *kcontrol, >> info = (struct gb_audio_ctl_elem_info *)data->info; >> >> /* update uinfo */ >> - platform_max = info->value.integer.max; >> - platform_min = info->value.integer.min; >> + platform_max = le32_to_cpu(info->value.integer.max); >> + platform_min = le32_to_cpu(info->value.integer.min); > > Should this piece be in patch 4/4? It seems out of place in this patch. Yes. It should be part of 4/4 only. Will update in v3 -- vaibhav ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/9] VC04_SERVICES: Add compat ioctl data structures
This change adds the compatibility data structures for compatibility ioctls and defines compatibility ioctl definitions for the ioctls that have changed. Signed-off-by: Michael Zoran--- .../interface/vchiq_arm/vchiq_ioctl.h | 96 ++ 1 file changed, 96 insertions(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h index 6137ae9de1c1..1681b7792ef2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h @@ -35,6 +35,9 @@ #define VCHIQ_IOCTLS_H #include +#if defined(CONFIG_COMPAT) +#include +#endif #include "vchiq_if.h" #define VCHIQ_IOC_MAGIC 0xc4 @@ -128,4 +131,97 @@ typedef struct { #define VCHIQ_IOC_CLOSE_DELIVERED _IO(VCHIQ_IOC_MAGIC, 17) #define VCHIQ_IOC_MAX 17 +#if defined(CONFIG_COMPAT) + +struct vchiq_element32 { + compat_uptr_t data; + unsigned int size; +}; + +struct vchiq_service_base32 { + int fourcc; + compat_uptr_t callback; + compat_uptr_t userdata; +}; + +struct vchiq_service_params32 { + int fourcc; + compat_uptr_t callback; + compat_uptr_t userdata; + short version; /* Increment for non-trivial changes */ + short version_min; /* Update for incompatible changes */ +}; + +struct vchiq_create_service32 { + struct vchiq_service_params32 params; + int is_open; + int is_vchi; + unsigned int handle; /* OUT */ +}; + +struct vchiq_queue_message32 { + unsigned int handle; + unsigned int count; + compat_uptr_t elements; +}; + +struct vchiq_queue_bulk_transfer32 { + unsigned int handle; + compat_uptr_t data; + unsigned int size; + compat_uptr_t userdata; + VCHIQ_BULK_MODE_T mode; +}; + +struct vchiq_completion_data32 { + VCHIQ_REASON_T reason; + compat_uptr_t header; + compat_uptr_t service_userdata; + compat_uptr_t bulk_userdata; +}; + +struct vchiq_await_completion32 { + unsigned int count; + compat_uptr_t buf; + unsigned int msgbufsize; + unsigned int msgbufcount; /* IN/OUT */ + compat_uptr_t msgbufs; +}; + +struct vchiq_dequeue_message32 { + unsigned int handle; + int blocking; + unsigned int bufsize; + compat_uptr_t buf; +}; + +struct vchiq_get_config32 { + unsigned int config_size; + compat_uptr_t pconfig; +}; + +struct vchiq_dump_mem32 { + compat_uptr_t virt_addr; + u32 num_bytes; +}; + +#define VCHIQ_IOC_CREATE_SERVICE32 \ + _IOWR(VCHIQ_IOC_MAGIC, 2, struct vchiq_create_service32) +#define VCHIQ_IOC_QUEUE_MESSAGE32 \ + _IOW(VCHIQ_IOC_MAGIC, 4, struct vchiq_queue_message32) +#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT32 \ + _IOWR(VCHIQ_IOC_MAGIC, 5, struct vchiq_queue_bulk_transfer32) +#define VCHIQ_IOC_QUEUE_BULK_RECEIVE32 \ + _IOWR(VCHIQ_IOC_MAGIC, 6, struct vchiq_queue_bulk_transfer32) +#define VCHIQ_IOC_AWAIT_COMPLETION32 \ + _IOWR(VCHIQ_IOC_MAGIC, 7, struct vchiq_await_completion32) +#define VCHIQ_IOC_DEQUEUE_MESSAGE32 \ + _IOWR(VCHIQ_IOC_MAGIC, 8, struct vchiq_dequeue_message32) +#define VCHIQ_IOC_GET_CONFIG32 \ + _IOWR(VCHIQ_IOC_MAGIC, 10, struct vchiq_get_config32) +#define VCHIQ_IOC_DUMP_PHYS_MEM32 \ + _IOW(VCHIQ_IOC_MAGIC, 15, struct vchiq_dump_mem32) + +#endif + #endif -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 9/9] VC04_SERVICES: Add compat ioctl handler for "dump mem"
Add compat handler for "dump mem" ioctl. Signed-off-by: Michael Zoran--- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 84ede7d1285f..454b951fbda3 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1577,6 +1577,19 @@ vchiq_ioctl_compat_internal( } } break; + case VCHIQ_IOC_DUMP_PHYS_MEM32: { + struct vchiq_dump_mem32 args32; + + if (copy_from_user +(, (const void __user *)arg, + sizeof(args32))) { + ret = -EFAULT; + break; + } + + dump_phys_mem(compat_ptr(args32.virt_addr), args32.num_bytes); + } break; + default: ret = -ENOTTY; break; @@ -1624,6 +1637,7 @@ vchiq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) case VCHIQ_IOC_AWAIT_COMPLETION32: case VCHIQ_IOC_DEQUEUE_MESSAGE32: case VCHIQ_IOC_GET_CONFIG32: + case VCHIQ_IOC_DUMP_PHYS_MEM32: return vchiq_ioctl_compat_internal(file, cmd, arg); default: return vchiq_ioctl(file, cmd, arg); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/9] VC04_SERVICES: Add compat ioctl handler for "create service"
Add compat handler for "create service" ioctl and move parts in common with the regular ioctl to vchiq_ioctl_create_service Signed-off-by: Michael Zoran--- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 180 + 1 file changed, 112 insertions(+), 68 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 9ade2f63606b..e26949247f91 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -503,6 +503,75 @@ vchiq_ioc_queue_message(VCHIQ_SERVICE_HANDLE_T handle, , total_size); } +static long +vchiq_ioctl_create_service(VCHIQ_INSTANCE_T instance, + VCHIQ_CREATE_SERVICE_T *args, + VCHIQ_STATUS_T *status) +{ + VCHIQ_SERVICE_T *service = NULL; + USER_SERVICE_T *user_service = NULL; + void *userdata; + int srvstate; + + user_service = kmalloc(sizeof(USER_SERVICE_T), GFP_KERNEL); + if (!user_service) + return -ENOMEM; + + if (args->is_open) { + if (!instance->connected) { + kfree(user_service); + return -ENOTCONN; + } + srvstate = VCHIQ_SRVSTATE_OPENING; + } else { + srvstate = +instance->connected ? +VCHIQ_SRVSTATE_LISTENING : +VCHIQ_SRVSTATE_HIDDEN; + } + + userdata = args->params.userdata; + args->params.callback = service_callback; + args->params.userdata = user_service; + + service = vchiq_add_service_internal( + instance->state, + >params, srvstate, + instance, user_service_free); + + if (!service) { + kfree(user_service); + return -EEXIST; + } + + user_service->service = service; + user_service->userdata = userdata; + user_service->instance = instance; + user_service->is_vchi = (args->is_vchi != 0); + user_service->dequeue_pending = 0; + user_service->close_pending = 0; + user_service->message_available_pos = + instance->completion_remove - 1; + user_service->msg_insert = 0; + user_service->msg_remove = 0; + sema_init(_service->insert_event, 0); + sema_init(_service->remove_event, 0); + sema_init(_service->close_event, 0); + + if (args->is_open) { + *status = vchiq_open_service_internal(service, instance->pid); + + if (*status != VCHIQ_SUCCESS) { + vchiq_remove_service(service->handle); + return (*status == VCHIQ_RETRY) ? -EINTR : -EIO; + } + } + + args->handle = service->handle; + + return 0; +} + / * * vchiq_ioctl @@ -575,85 +644,25 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case VCHIQ_IOC_CREATE_SERVICE: { VCHIQ_CREATE_SERVICE_T args; - USER_SERVICE_T *user_service = NULL; - void *userdata; - int srvstate; if (copy_from_user (, (const void __user *)arg, - sizeof(args)) != 0) { + sizeof(args))) { ret = -EFAULT; break; } - user_service = kmalloc(sizeof(USER_SERVICE_T), GFP_KERNEL); - if (!user_service) { - ret = -ENOMEM; - break; - } - - if (args.is_open) { - if (!instance->connected) { - ret = -ENOTCONN; - kfree(user_service); - break; - } - srvstate = VCHIQ_SRVSTATE_OPENING; - } else { - srvstate = -instance->connected ? -VCHIQ_SRVSTATE_LISTENING : -VCHIQ_SRVSTATE_HIDDEN; - } - - userdata = args.params.userdata; - args.params.callback = service_callback; - args.params.userdata = user_service; - service = vchiq_add_service_internal( - instance->state, - , srvstate, - instance, user_service_free); - - if (service != NULL) { - user_service->service = service; - user_service->userdata = userdata; -
[PATCH 2/9] VC04_SERVICES: Add top level compat ioctl handler
Add the top level compat ioctl handler as a placeholder for adding additional handlers. The ioctls are first filtered and forwarded to the regular ioctl handler if the ioctl does not require any extra compatibility processing. Signed-off-by: Michael Zoran--- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 73 ++ 1 file changed, 73 insertions(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 0525211bcd65..9ade2f63606b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1206,6 +1206,76 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } +#if defined(CONFIG_COMPAT) + +static long +vchiq_ioctl_compat_internal( + struct file *file, + unsigned int cmd, + unsigned long arg) +{ + VCHIQ_INSTANCE_T instance = file->private_data; + VCHIQ_STATUS_T status = VCHIQ_SUCCESS; + VCHIQ_SERVICE_T *service = NULL; + long ret = 0; + + DEBUG_INITIALISE(g_state.local) + + vchiq_log_trace(vchiq_arm_log_level, + "vchiq_ioctl_compat - instance %pK, cmd %s, arg %lx", + instance, + ((_IOC_TYPE(cmd) == VCHIQ_IOC_MAGIC) && + (_IOC_NR(cmd) <= VCHIQ_IOC_MAX)) ? + ioctl_names[_IOC_NR(cmd)] : "", arg); + + switch (cmd) { + default: + ret = -ENOTTY; + break; + } + + if (service) + unlock_service(service); + + if (ret == 0) { + if (status == VCHIQ_ERROR) + ret = -EIO; + else if (status == VCHIQ_RETRY) + ret = -EINTR; + } + + if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && + (ret != -EWOULDBLOCK)) + vchiq_log_info(vchiq_arm_log_level, + " ioctl_compat instance %lx, cmd %s -> status %d, %ld", + (unsigned long)instance, + (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? + ioctl_names[_IOC_NR(cmd)] : + "", + status, ret); + else + vchiq_log_trace(vchiq_arm_log_level, + " ioctl_compat instance %lx, cmd %s -> status %d, %ld", + (unsigned long)instance, + (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? + ioctl_names[_IOC_NR(cmd)] : + "", + status, ret); + + return ret; +} + +static long +vchiq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + default: + return vchiq_ioctl(file, cmd, arg); + } +} + +#endif + / * * vchiq_open @@ -1660,6 +1730,9 @@ static const struct file_operations vchiq_fops = { .owner = THIS_MODULE, .unlocked_ioctl = vchiq_ioctl, +#if defined(CONFIG_COMPAT) + .compat_ioctl = vchiq_ioctl_compat, +#endif .open = vchiq_open, .release = vchiq_release, .read = vchiq_read -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/9] VC04_SERVICES: Add compat ioctl handler for "await completion"
Add compat handler for "await_completion" ioctl and move parts in common with the regular ioctl to vchiq_ioctl_await_completion Signed-off-by: Michael Zoran--- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 398 ++--- 1 file changed, 267 insertions(+), 131 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 7067bd3f4bd5..d9f3b0b34a95 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -653,6 +653,190 @@ vchiq_ioctl_queue_bulk(VCHIQ_INSTANCE_T instance, return 0; } +typedef bool (*vchiq_get_msgbuf_ptr_callback_t)(VCHIQ_AWAIT_COMPLETION_T *args, + unsigned int msgbufcount, + void __user **msgbuf); + +typedef bool (*vchiq_put_completion_callback_t)(VCHIQ_AWAIT_COMPLETION_T *args, + long num, + VCHIQ_COMPLETION_DATA_T *completion); + +typedef bool (*vchiq_put_msgbuf_count_callback_t)(unsigned long arg, + unsigned int msgbufcount); + +static long +vchiq_ioctl_await_completion(VCHIQ_INSTANCE_T instance, +unsigned long arg, +VCHIQ_AWAIT_COMPLETION_T *args, +vchiq_get_msgbuf_ptr_callback_t get_msgbuf, +vchiq_put_completion_callback_t put_completion, +vchiq_put_msgbuf_count_callback_t put_msgbuf_count) +{ + long ret; + int msgbufcount; + + DEBUG_INITIALISE(g_state.local) + + mutex_lock(>completion_mutex); + + DEBUG_TRACE(AWAIT_COMPLETION_LINE); + while ((instance->completion_remove == instance->completion_insert) && + !instance->closing) { + int rc; + + DEBUG_TRACE(AWAIT_COMPLETION_LINE); + mutex_unlock(>completion_mutex); + rc = down_interruptible(>insert_event); + mutex_lock(>completion_mutex); + + if (rc) { + DEBUG_TRACE(AWAIT_COMPLETION_LINE); + vchiq_log_info(vchiq_arm_log_level, + "AWAIT_COMPLETION interrupted"); + + up(>remove_event); + mutex_unlock(>completion_mutex); + DEBUG_TRACE(AWAIT_COMPLETION_LINE); + + return -EINTR; + } + } + + DEBUG_TRACE(AWAIT_COMPLETION_LINE); + + /* A read memory barrier is needed to stop prefetch of a stale +* completion record +*/ + rmb(); + + msgbufcount = args->msgbufcount; + for (ret = 0; ret < args->count; ret++) { + VCHIQ_COMPLETION_DATA_T *completion; + VCHIQ_SERVICE_T *service; + USER_SERVICE_T *user_service; + VCHIQ_HEADER_T *header; + + if (instance->completion_remove == instance->completion_insert) + break; + + completion = >completions[ + instance->completion_remove & + (MAX_COMPLETIONS - 1)]; + + service = completion->service_userdata; + user_service = service->base.userdata; + completion->service_userdata = user_service->userdata; + + header = completion->header; + if (header) { + void __user *msgbuf; + int msglen; + + msglen = header->size + sizeof(VCHIQ_HEADER_T); + /* This must be a VCHIQ-style service */ + if (args->msgbufsize < msglen) { + vchiq_log_error( + vchiq_arm_log_level, + "header %pK: msgbufsize %x < msglen %x", + header, args->msgbufsize, + msglen); + WARN(1, "invalid message size\n"); + if (ret == 0) + ret = -EMSGSIZE; + break; + } + if (msgbufcount <= 0) + /* Stall here for lack of a +* buffer for the message. +*/ + break; + + /* Get the pointer from user space */ + msgbufcount--; + if (get_msgbuf(args, msgbufcount, )) { + if (ret == 0) +
[PATCH 5/9] VC04_SERVICES: Add compat ioctl handler for "queue bulk"
Add compat handler for "queue bulk" ioctls and move parts in common with the regular ioctls to vchiq_ioctl_queue_bulk Signed-off-by: Michael Zoran--- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 206 ++--- 1 file changed, 141 insertions(+), 65 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 1c0afa318036..7067bd3f4bd5 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -572,6 +572,87 @@ vchiq_ioctl_create_service(VCHIQ_INSTANCE_T instance, return 0; } +static long +vchiq_ioctl_queue_bulk(VCHIQ_INSTANCE_T instance, + VCHIQ_QUEUE_BULK_TRANSFER_T *args, + VCHIQ_BULK_DIR_T dir, + VCHIQ_STATUS_T *status, + bool *needs_ret_mode_waiting) +{ + struct bulk_waiter_node *waiter = NULL; + *needs_ret_mode_waiting = false; + + if (args->mode == VCHIQ_BULK_MODE_BLOCKING) { + waiter = kzalloc(sizeof(*waiter), GFP_KERNEL); + + if (!waiter) + return -ENOMEM; + + args->userdata = >bulk_waiter; + } else if (args->mode == VCHIQ_BULK_MODE_WAITING) { + struct list_head *pos; + + mutex_lock(>bulk_waiter_list_mutex); + list_for_each(pos, >bulk_waiter_list) { + if (list_entry(pos, struct bulk_waiter_node, + list)->pid == current->pid) { + waiter = list_entry(pos, + struct bulk_waiter_node, + list); + list_del(pos); + break; + } + } + + mutex_unlock(>bulk_waiter_list_mutex); + if (!waiter) { + vchiq_log_error(vchiq_arm_log_level, + "no bulk_waiter found for pid %d", + current->pid); + return -ESRCH; + } + + vchiq_log_info(vchiq_arm_log_level, + "found bulk_waiter %pK for pid %d", waiter, + current->pid); + args->userdata = >bulk_waiter; + } + + *status = vchiq_bulk_transfer(args->handle, +VCHI_MEM_HANDLE_INVALID, +args->data, args->size, +args->userdata, args->mode, +dir); + + if (!waiter) + return 0; + + if ((*status != VCHIQ_RETRY) || fatal_signal_pending(current) || + !waiter->bulk_waiter.bulk) { + if (waiter->bulk_waiter.bulk) { + /* +* Cancel the signal when the transfer +* completes. +*/ + spin_lock(_waiter_spinlock); + waiter->bulk_waiter.bulk->userdata = NULL; + spin_unlock(_waiter_spinlock); + } + kfree(waiter); + } else { + *needs_ret_mode_waiting = true; + waiter->pid = current->pid; + mutex_lock(>bulk_waiter_list_mutex); + list_add(>list, >bulk_waiter_list); + mutex_unlock(>bulk_waiter_list_mutex); + vchiq_log_info(vchiq_arm_log_level, + "saved bulk_waiter %pK for pid %d", + waiter, current->pid); + } + + return 0; +} + / * * vchiq_ioctl @@ -774,7 +855,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case VCHIQ_IOC_QUEUE_BULK_TRANSMIT: case VCHIQ_IOC_QUEUE_BULK_RECEIVE: { VCHIQ_QUEUE_BULK_TRANSFER_T args; - struct bulk_waiter_node *waiter = NULL; + bool needs_ret_mode_waiting = false; VCHIQ_BULK_DIR_T dir = (cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ? VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE; @@ -792,75 +873,21 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) break; } - if (args.mode == VCHIQ_BULK_MODE_BLOCKING) { - waiter = kzalloc(sizeof(struct bulk_waiter_node), - GFP_KERNEL); - if (!waiter) { - ret = -ENOMEM; - break; - } -
[PATCH 7/9] VC04_SERVICES: Add compat ioctl handler for "dequeue message"
Add compat handler for "dequeue messagen" ioctl and move parts in common with the regular ioctl to vchiq_ioctl_dequeue_message. Signed-off-by: Michael Zoran--- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 168 - 1 file changed, 100 insertions(+), 68 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index d9f3b0b34a95..98a67c434cfd 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -837,6 +837,83 @@ vchiq_ioctl_put_msgbuf_count(unsigned long arg, sizeof(msgbufcount)); } +static long +vchiq_ioctl_dequeue_message(VCHIQ_INSTANCE_T instance, + VCHIQ_DEQUEUE_MESSAGE_T *args, + VCHIQ_SERVICE_T **service) +{ + USER_SERVICE_T *user_service; + VCHIQ_HEADER_T *header; + long ret = 0; + + DEBUG_INITIALISE(g_state.local) + + *service = find_service_for_instance(instance, args->handle); + if (!*service) + return -EINVAL; + + user_service = (USER_SERVICE_T *)(*service)->base.userdata; + if (user_service->is_vchi == 0) + return -EINVAL; + + spin_lock(_queue_spinlock); + if (user_service->msg_remove == user_service->msg_insert) { + if (!args->blocking) { + spin_unlock(_queue_spinlock); + DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); + return -EWOULDBLOCK; + } + + user_service->dequeue_pending = 1; + do { + spin_unlock(_queue_spinlock); + DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); + if (down_interruptible(_service->insert_event)) { + vchiq_log_info(vchiq_arm_log_level, + "DEQUEUE_MESSAGE interrupted"); + ret = -EINTR; + break; + } + spin_lock(_queue_spinlock); + } while (user_service->msg_remove == + user_service->msg_insert); + + if (ret) + return ret; + } + + BUG_ON((int)(user_service->msg_insert - user_service->msg_remove) < 0); + + header = user_service->msg_queue[user_service->msg_remove & + (MSG_QUEUE_SIZE - 1)]; + user_service->msg_remove++; + spin_unlock(_queue_spinlock); + + up(_service->remove_event); + + if (!header) + return -ENOTCONN; + + if (header->size > args->bufsize) { + vchiq_log_error(vchiq_arm_log_level, + "header %pK: bufsize %x < size %x", + header, args->bufsize, header->size); + WARN(1, "invalid size\n"); + return -EMSGSIZE; + } + + if (args->buf) + if (copy_to_user((void __user *)args->buf, +header->data, +header->size)) + return -EFAULT; + + ret = header->size; + vchiq_release_message((*service)->handle, header); + + return ret; +} + / * * vchiq_ioctl @@ -1101,8 +1178,6 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case VCHIQ_IOC_DEQUEUE_MESSAGE: { VCHIQ_DEQUEUE_MESSAGE_T args; - USER_SERVICE_T *user_service; - VCHIQ_HEADER_T *header; DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); if (copy_from_user @@ -,74 +1186,9 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EFAULT; break; } - service = find_service_for_instance(instance, args.handle); - if (!service) { - ret = -EINVAL; - break; - } - user_service = (USER_SERVICE_T *)service->base.userdata; - if (user_service->is_vchi == 0) { - ret = -EINVAL; - break; - } - - spin_lock(_queue_spinlock); - if (user_service->msg_remove == user_service->msg_insert) { - if (!args.blocking) { - spin_unlock(_queue_spinlock); - DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); - ret = -EWOULDBLOCK; - break; - } - user_service->dequeue_pending = 1; - do { -
[PATCH 0/9] vc04_services: Add compat ioctls
These set of changes add compat ioctls for vc04_services. When possible and practical common code between the native ioctl and the compat ioctl has been moved into a common function. This set includes one ioctl per patch with the first two patchs being common changes. No attempt is being made to cleanup the entire ioctl structure. Tests Runs: vchiq_test -f 10 vchiq_test -p 1 Tests were run from both a native debian arm64 install and a debian armhf chroot on an RPI 3. Signed-off-by: Michael ZoranMichael Zoran (9): VC04_SERVICES: Add compat ioctl data structures VC04_SERVICES: Add top level compat ioctl handler VC04_SERVICES: Add compat ioctl handler for "create service" VC04_SERVICES: Add compat ioctl handler for "queue message" VC04_SERVICES: Add compat ioctl handler for "queue bulk" VC04_SERVICES: Add compat ioctl handler for "await completion" VC04_SERVICES: Add compat ioctl handler for "dequeue message" VC04_SERVICES: Add compat ioctl handler for "get config" VC04_SERVICES: Add compat ioctl handler for "dump mem" .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 1107 ++-- .../interface/vchiq_arm/vchiq_ioctl.h | 96 ++ 2 files changed, 871 insertions(+), 332 deletions(-) -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/9] VC04_SERVICES: Add compat ioctl handler for "queue message"
Add compat handler for "queue message" ioctl. Signed-off-by: Michael Zoran--- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 36 ++ 1 file changed, 36 insertions(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index e26949247f91..1c0afa318036 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1271,6 +1271,41 @@ vchiq_ioctl_compat_internal( } } break; + case VCHIQ_IOC_QUEUE_MESSAGE32: { + struct vchiq_queue_message32 args32; + VCHIQ_ELEMENT_T elements[MAX_ELEMENTS]; + struct vchiq_element32 elements32[MAX_ELEMENTS]; + unsigned int i; + + if (copy_from_user +(, (const void __user *)arg, + sizeof(args32))) { + ret = -EFAULT; + break; + } + + service = find_service_for_instance(instance, args32.handle); + + if (!service || args32.count > MAX_ELEMENTS) { + ret = -EINVAL; + break; + } + + if (copy_from_user(elements32, compat_ptr(args32.elements), + args32.count * sizeof(struct vchiq_element32))) { + ret = -EFAULT; + break; + } + + for (i = 0; i < args32.count; i++) { + elements[i].data = compat_ptr(elements32[i].data); + elements[i].size = elements32[i].size; + } + + status = vchiq_ioc_queue_message(args32.handle, +elements, args32.count); + } break; + default: ret = -ENOTTY; break; @@ -1312,6 +1347,7 @@ vchiq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) { switch (cmd) { case VCHIQ_IOC_CREATE_SERVICE32: + case VCHIQ_IOC_QUEUE_MESSAGE32: return vchiq_ioctl_compat_internal(file, cmd, arg); default: return vchiq_ioctl(file, cmd, arg); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/9] VC04_SERVICES: Add compat ioctl handler for "get config"
Add compat handler for "get config" ioctl. Signed-off-by: Michael Zoran--- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 32 ++ 1 file changed, 32 insertions(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 98a67c434cfd..84ede7d1285f 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1546,6 +1546,37 @@ vchiq_ioctl_compat_internal( DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); } break; + case VCHIQ_IOC_GET_CONFIG32: { + VCHIQ_GET_CONFIG_T args; + struct vchiq_get_config32 args32; + VCHIQ_CONFIG_T config; + + if (copy_from_user(, (const void __user *)arg, + sizeof(args32))) { + ret = -EFAULT; + break; + } + + args.pconfig = compat_ptr(args32.pconfig); + args.config_size = args32.config_size; + + if (args.config_size > sizeof(config)) { + ret = -EINVAL; + break; + } + + status = vchiq_get_config(instance, args.config_size, ); + + if (status == VCHIQ_SUCCESS) { + if (copy_to_user((void __user *)args.pconfig, +, +args.config_size)) { + ret = -EFAULT; + break; + } + } + } break; + default: ret = -ENOTTY; break; @@ -1592,6 +1623,7 @@ vchiq_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) case VCHIQ_IOC_QUEUE_BULK_RECEIVE32: case VCHIQ_IOC_AWAIT_COMPLETION32: case VCHIQ_IOC_DEQUEUE_MESSAGE32: + case VCHIQ_IOC_GET_CONFIG32: return vchiq_ioctl_compat_internal(file, cmd, arg); default: return vchiq_ioctl(file, cmd, arg); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: fsl-mc: fix coding stye errors
Split line at boolean operator. Error was reported by checkpatch.pl as WARNING: Avoid multiple line dereference - prefer 'mc_msi_domain->host_data' Signed-off-by: Dhananjay Balan--- drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c index 6b1cd57..7a402eb 100644 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c @@ -94,8 +94,8 @@ int __init its_fsl_mc_msi_init(void) continue; } - WARN_ON(mc_msi_domain-> - host_data != _fsl_mc_msi_domain_info); + WARN_ON(mc_msi_domain->host_data != + _fsl_mc_msi_domain_info); pr_info("fsl-mc MSI: %s domain created\n", np->full_name); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: fsl-mc: fix coding stye errors
On Wed, Jan 18, 2017 at 11:53:07AM +0100, Dhananjay Balan wrote: > Split line at boolean operator. > > Error was reported by checkpatch.pl as > WARNING: Avoid multiple line dereference - prefer 'mc_msi_domain->host_data' > > Signed-off-by: Dhananjay Balan> --- > drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) What changed from v1? Always put that information below the --- line. Please try again with v3. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] iio: trigger: free trigger resource correctly
On Tue, Jan 17, 2017 at 07:00:28PM -0800, Alison Schofield wrote: > Using iio_trigger_put() to free a trigger leads to release of > a resource we never held. Replace with iio_trigger_free(). They're basically the same except iio_trigger_put() puts the module and the device and free only puts the device. I've looked at this briefly, but I can't figure out how iio_trigger_get/ iio_trigger_put is supposed to be used. There isn't any documentation. I'm trying to review this code, but I can't figure out where we *are* supposed to be doing the put. For example, iio_device_unregister_trigger_consumer() takes a put, but iio_device_register_trigger_consumer() doesn't do a get... It's all very confusing. You seem like you know what's going on. Can we get some documentation? > > Signed-off-by: Alison Schofield> --- > Patches to use devm_* funcs are ready to follow this for > the interrupt & bfin-timer triggers. > > drivers/iio/trigger/iio-trig-interrupt.c | 4 ++-- > drivers/iio/trigger/iio-trig-sysfs.c | 2 +- > drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 4 ++-- > 3 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/trigger/iio-trig-interrupt.c > b/drivers/iio/trigger/iio-trig-interrupt.c > index 572bc6f..b18e50d 100644 > --- a/drivers/iio/trigger/iio-trig-interrupt.c > +++ b/drivers/iio/trigger/iio-trig-interrupt.c > @@ -84,7 +84,7 @@ static int iio_interrupt_trigger_probe(struct > platform_device *pdev) > error_free_trig_info: > kfree(trig_info); > error_put_trigger: > - iio_trigger_put(trig); > + iio_trigger_free(trig); We could rename this label. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel