Re: [PATCH v2] staging: rtlwifi: Fix potential NULL pointer dereference of kzalloc
On Tue, Mar 19, 2019 at 03:15:08PM -0500, Aditya Pakki wrote: > phydm.internal is allocated using kzalloc which is used multiple > times without a check for NULL pointer. This patch avoids such a > scenario. > > -- > v1: Patch collision with different things, fix as per Greg > Signed-off-by: Aditya Pakki > --- Gar... Sorry, no, that's not quite right. It should be: blah blah blah... Signed-off-by: you --- V1: Patch collision with different things, fix as per Greg Try applying your patch with `cat raw_email.txt | git am` and you'll see the problem with the commit message. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: v5.1-rc1 binder_alloc_do_buffer_copy() BUG_ON triggered by selinux-testsuite
On Thu, Mar 21, 2019 at 12:26 AM Todd Kjos wrote: > I can send you a patch tomorrow (I won't be able to test it though). So, I was a bit quicker than you and I think I managed to fix the test myself :) See: https://github.com/SELinuxProject/selinux-testsuite/pull/50/commits/b559c3f54eae6130cb9e79c295b0f94db26e09e4 It seems the problem was indeed in the offsets array handling as you discovered. With the above commit included the PR#50 version of the binder test no longer fails for me. Thanks, > > On Wed, Mar 20, 2019 at 4:23 PM Paul Moore wrote: > > > > On Wed, Mar 20, 2019 at 3:50 PM Todd Kjos wrote: > > > > > > Paul, > > > > > > Looking at main() in test_binder.c... > > > > > > int main(int argc, char **argv) > > > { > > > > > > [...] > > > > > > // Line 493 > > > struct binder_write_read bwr; > > > struct flat_binder_object obj; > > > struct { > > > uint32_t cmd; > > > struct binder_transaction_data txn; > > > } __attribute__((packed)) writebuf; > > > unsigned int readbuf[32]; > > > > > > [...] > > > // Line 630 > > > writebuf.txn.data.ptr.buffer = (uintptr_t)&obj; > > > writebuf.txn.data.ptr.offsets = (uintptr_t)&obj + // [A] > > > sizeof(struct > > > flat_binder_object); > > > > > > bwr.write_buffer = (uintptr_t)&writebuf; > > > bwr.write_size = sizeof(writebuf); > > > > > > It looks like bwr.txn.data.ptr.offsets points off the end of obj (see > > > [A] above), which means the binder driver will read compiler-dependent > > > stack data as the offset for the object. If it happens to be 0, then > > > the test will work (read the object from offset 0). If it's not 0, > > > then most likely offset > data_size (which is what found that BUG_ON > > > case). With my patch applied, this will just cause an error to be > > > returned (what you are seeing now). > > > > > > Same thing when you test with v5.0 -- if the offset happens to be 0, > > > then the test will succeed. If not, then the test will fail because > > > the transaction fails in an unexpected way. > > > > That might explain why the test used to work, but now fails - a > > different compiler (I rebuild the test before each test run). > > > > Keeping in mind I'm really quite ignorant when it comes to binder, how > > would you suggest fixing the test? > > > > -- > > paul moore > > www.paul-moore.com -- Ondrej Mosnacek Software Engineer, Security Technologies Red Hat, Inc. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/14] staging: most: core: add configfs interface functions
This patch adds the core's interface to configfs file. Signed-off-by: Christian Gromm --- drivers/staging/most/core.c | 142 drivers/staging/most/core.h | 17 +- 2 files changed, 158 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index fb19b63..d5cf58f 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -783,6 +783,127 @@ static ssize_t add_link_store(struct device_driver *drv, return len; } +int most_set_cfg_buffer_size(char *mdev, char *mdev_ch, u16 val) +{ + struct most_channel *c = get_channel(mdev, mdev_ch); + + if (!c) + return -ENODEV; + c->cfg.buffer_size = val; + return 0; +} + +int most_set_cfg_subbuffer_size(char *mdev, char *mdev_ch, u16 val) +{ + struct most_channel *c = get_channel(mdev, mdev_ch); + + if (!c) + return -ENODEV; + c->cfg.subbuffer_size = val; + return 0; +} + +int most_set_cfg_dbr_size(char *mdev, char *mdev_ch, u16 val) +{ + struct most_channel *c = get_channel(mdev, mdev_ch); + + if (!c) + return -ENODEV; + c->cfg.dbr_size = val; + return 0; +} + +int most_set_cfg_num_buffers(char *mdev, char *mdev_ch, u16 val) +{ + struct most_channel *c = get_channel(mdev, mdev_ch); + + if (!c) + return -ENODEV; + c->cfg.num_buffers = val; + return 0; +} + +int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf) +{ + int i; + struct most_channel *c = get_channel(mdev, mdev_ch); + + if (!c) + return -ENODEV; + for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) { + if (!strcmp(buf, ch_data_type[i].name)) { + c->cfg.data_type = ch_data_type[i].most_ch_data_type; + break; + } + } + + if (i == ARRAY_SIZE(ch_data_type)) + pr_info("WARN: invalid attribute settings\n"); + return 0; +} + +int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf) +{ + struct most_channel *c = get_channel(mdev, mdev_ch); + + if (!c) + return -ENODEV; + if (!strcmp(buf, "dir_rx\n")) { + c->cfg.direction = MOST_CH_RX; + } else if (!strcmp(buf, "rx\n")) { + c->cfg.direction = MOST_CH_RX; + } else if (!strcmp(buf, "dir_tx\n")) { + c->cfg.direction = MOST_CH_TX; + } else if (!strcmp(buf, "tx\n")) { + c->cfg.direction = MOST_CH_TX; + } else { + pr_info("Invalid direction\n"); + return -ENODATA; + } + return 0; +} + +int most_set_cfg_packets_xact(char *mdev, char *mdev_ch, u16 val) +{ + struct most_channel *c = get_channel(mdev, mdev_ch); + + if (!c) + return -ENODEV; + c->cfg.packets_per_xact = val; + return 0; +} + +int most_cfg_complete(char *comp_name) +{ + struct core_component *comp; + + comp = match_component(comp_name); + if (!comp) + return -ENODEV; + + return comp->cfg_complete(); +} + +int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name, + char *comp_param) +{ + struct most_channel *c; + struct core_component *comp; + char buf[STRING_SIZE]; + + comp = match_component(comp_name); + if (!comp) + return -ENODEV; + if (!comp_param || *comp_param == 0) { + snprintf(buf, sizeof(buf), "%s-%s", mdev, mdev_ch); + comp_param = buf; + } + c = get_channel(mdev, mdev_ch); + if (!c) + return -ENODEV; + + return link_channel_to_component(c, comp, link_name, comp_param); +} /** * remove_link_store - store function for remove_link attribute * @drv: device driver @@ -825,6 +946,27 @@ static ssize_t remove_link_store(struct device_driver *drv, return len; } +int most_remove_link(char *mdev, char *mdev_ch, char *comp_name) +{ + struct most_channel *c; + struct core_component *comp; + + comp = match_component(comp_name); + if (!comp) + return -ENODEV; + c = get_channel(mdev, mdev_ch); + if (!c) + return -ENODEV; + + if (comp->disconnect_channel(c->iface, c->channel_id)) + return -EIO; + if (c->pipe0.comp == comp) + c->pipe0.comp = NULL; + if (c->pipe1.comp == comp) + c->pipe1.comp = NULL; + return 0; +} + #define DRV_ATTR(_name) (&driver_attr_##_name.attr) static DRIVER_ATTR_RO(links); diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h index 025dd1d..f875159 100644 --- a/drivers/staging/most/core.h +++ b/drivers/staging/most/core.h @@ -272,6 +272,7 @@ struct core_component { int channel_idx); int (*rx_compl
[PATCH 07/14] staging: most: core: use device description as name
This patch uses the device description to clearly identity a device attached to the bus. It is needed as the currently useed mdevX notation is not sufficiant in case more than one network interface controller is being used at the same time. Signed-off-by: Christian Gromm --- drivers/staging/most/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 006f044..c4423b5 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -1467,7 +1467,7 @@ int most_register_interface(struct most_interface *iface) INIT_LIST_HEAD(&iface->p->channel_list); iface->p->dev_id = id; - snprintf(iface->p->name, STRING_SIZE, "mdev%d", id); + strcpy(iface->p->name, iface->description); iface->dev.init_name = iface->p->name; iface->dev.bus = &mc.bus; iface->dev.parent = &mc.dev; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/14] staging: most: enable configfs support
This patch enables the configfs functionality of the driver by registering the configfs subsystems and compiling the configfs part of the sources. Signed-off-by: Christian Gromm --- drivers/staging/most/Makefile | 1 + drivers/staging/most/cdev/cdev.c | 6 ++ drivers/staging/most/core.c| 3 ++- drivers/staging/most/sound/sound.c | 11 ++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile index c7662f6..85ea5a4 100644 --- a/drivers/staging/most/Makefile +++ b/drivers/staging/most/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_MOST) += most_core.o most_core-y := core.o +most_core-y += configfs.o ccflags-y += -I $(srctree)/drivers/staging/ obj-$(CONFIG_MOST_CDEV)+= cdev/ diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c index 97408ec..d98977c 100644 --- a/drivers/staging/most/cdev/cdev.c +++ b/drivers/staging/most/cdev/cdev.c @@ -527,8 +527,13 @@ static int __init mod_init(void) err = most_register_component(&comp.cc); if (err) goto free_cdev; + err = most_register_configfs_subsys(&comp.cc); + if (err) + goto deregister_comp; return 0; +deregister_comp: + most_deregister_component(&comp.cc); free_cdev: unregister_chrdev_region(comp.devno, CHRDEV_REGION_SIZE); dest_ida: @@ -543,6 +548,7 @@ static void __exit mod_exit(void) pr_info("exit module\n"); + most_deregister_configfs_subsys(&comp.cc); most_deregister_component(&comp.cc); list_for_each_entry_safe(c, tmp, &channel_list, list) { diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index d5cf58f..b366517 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -1765,7 +1765,7 @@ static int __init most_init(void) err = -ENOMEM; goto err_unregister_driver; } - + configfs_init(); return 0; err_unregister_driver: @@ -1778,6 +1778,7 @@ static int __init most_init(void) static void __exit most_exit(void) { pr_info("exit core module\n"); + configfs_exit(); device_unregister(&mc.dev); driver_unregister(&mc.drv); bus_unregister(&mc.bus); diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 049ec44..fd089e6 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -790,16 +790,25 @@ static struct core_component comp = { static int __init audio_init(void) { + int ret; + pr_info("init()\n"); INIT_LIST_HEAD(&adpt_list); - return most_register_component(&comp); + ret = most_register_component(&comp); + if (ret) + pr_err("Failed to register %s\n", comp.name); + ret = most_register_configfs_subsys(&comp); + if (ret) + pr_err("Failed to register %s configfs subsys\n", comp.name); + return ret; } static void __exit audio_exit(void) { pr_info("exit()\n"); + most_deregister_configfs_subsys(&comp); most_deregister_component(&comp); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/14] staging: most: add new file configfs.c
This patch adds the file configfs.c to the driver directory. The file registers the necessary subsystems with configfs in order to move the driver configuration from sysfs to configfs. Signed-off-by: Christian Gromm --- drivers/staging/most/configfs.c | 659 1 file changed, 659 insertions(+) create mode 100644 drivers/staging/most/configfs.c diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c new file mode 100644 index 000..cefce69 --- /dev/null +++ b/drivers/staging/most/configfs.c @@ -0,0 +1,659 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * configfs.c - Implementation of configfs interface to the driver stack + * + * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include +#include +#include + +#define MAX_LEN 30 + +struct mdev_link { + struct config_item item; + int create; + u16 num_buffers; + u16 buffer_size; + u16 subbuffer_size; + u16 packets_per_xact; + u16 dbr_size; + char datatype[MAX_LEN]; + char direction[MAX_LEN]; + char name[MAX_LEN]; + char mdev[MAX_LEN]; + char channel[MAX_LEN]; + char comp[MAX_LEN]; + char param[MAX_LEN]; +}; + +int set_cfg_buffer_size(struct mdev_link *link) +{ + if (!link->buffer_size) + return -ENODATA; + return most_set_cfg_buffer_size(link->mdev, link->channel, + link->buffer_size); +} + +int set_cfg_subbuffer_size(struct mdev_link *link) +{ + if (!link->subbuffer_size) + return -ENODATA; + return most_set_cfg_subbuffer_size(link->mdev, link->channel, + link->subbuffer_size); +} + +int set_cfg_dbr_size(struct mdev_link *link) +{ + if (!link->dbr_size) + return -ENODATA; + return most_set_cfg_dbr_size(link->mdev, link->channel, +link->dbr_size); +} + +int set_cfg_num_buffers(struct mdev_link *link) +{ + if (!link->num_buffers) + return -ENODATA; + return most_set_cfg_num_buffers(link->mdev, link->channel, + link->num_buffers); +} + +int set_cfg_packets_xact(struct mdev_link *link) +{ + if (!link->packets_per_xact) + return -ENODATA; + return most_set_cfg_packets_xact(link->mdev, link->channel, +link->packets_per_xact); +} + +int set_cfg_direction(struct mdev_link *link) +{ + if (!strlen(link->direction)) + return -ENODATA; + return most_set_cfg_direction(link->mdev, link->channel, + link->direction); +} + +int set_cfg_datatype(struct mdev_link *link) +{ + if (!strlen(link->datatype)) + return -ENODATA; + return most_set_cfg_datatype(link->mdev, link->channel, +link->datatype); +} + +static int (*set_config_val[])(struct mdev_link *link) = { + set_cfg_buffer_size, + set_cfg_subbuffer_size, + set_cfg_dbr_size, + set_cfg_num_buffers, + set_cfg_packets_xact, + set_cfg_direction, + set_cfg_datatype, +}; + +static inline struct mdev_link *to_mdev_link(struct config_item *item) +{ + return item ? container_of(item, struct mdev_link, item) : NULL; +} + +static ssize_t mdev_link_create_show(struct config_item *item, char *page) +{ + return sprintf(page, "%d\n", to_mdev_link(item)->create); +} + +static ssize_t mdev_link_create_store(struct config_item *item, + const char *page, size_t count) +{ + struct mdev_link *mdev_link = to_mdev_link(item); + u16 tmp; + int ret; + int i; + char *p = (char *)page; + + ret = kstrtou16(p, 0, &tmp); + if (ret) + return ret; + if (tmp > 1) + return -ERANGE; + + for (i = 0; i < ARRAY_SIZE(set_config_val); i++) { + ret = set_config_val[i](mdev_link); + if (ret < 0) { + pr_err("Config failed\n"); + return ret; + } + } + + if (!mdev_link->mdev || !mdev_link->channel || !mdev_link->comp) { + pr_err("Config parameters incomplete\n"); + return -EIO; + } + if (tmp) + ret = most_add_link(mdev_link->mdev, mdev_link->channel, + mdev_link->comp, mdev_link->name, + mdev_link->param); + else + ret = most_remove_link(mdev_link->mdev, mdev_link->channel, + mdev_link->comp); + if (ret) + return ret; + mdev_link->create = tmp; + return count; +} + +static ssize_t mdev_link_direction_show(struc
[PATCH 02/14] staging: most: change signature of function probe_channel
This patch adds the param argument to the function parameter of the call-back probe_channel. This parameter is needed to configure the channels of an attached device. Signed-off-by: Christian Gromm --- drivers/staging/most/cdev/cdev.c | 2 +- drivers/staging/most/core.c| 6 -- drivers/staging/most/core.h| 3 ++- drivers/staging/most/net/net.c | 3 ++- drivers/staging/most/sound/sound.c | 3 +-- drivers/staging/most/video/video.c | 3 ++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c index f2b347c..97408ec 100644 --- a/drivers/staging/most/cdev/cdev.c +++ b/drivers/staging/most/cdev/cdev.c @@ -425,7 +425,7 @@ static int comp_tx_completion(struct most_interface *iface, int channel_id) * Returns 0 on success or error code otherwise. */ static int comp_probe(struct most_interface *iface, int channel_id, - struct most_channel_config *cfg, char *name) + struct most_channel_config *cfg, char *name, char *args) { struct comp_channel *c; unsigned long cl_flags; diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 18936cd..fb19b63 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -701,6 +701,7 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch) static inline int link_channel_to_component(struct most_channel *c, struct core_component *comp, +char *name, char *comp_param) { int ret; @@ -714,7 +715,8 @@ inline int link_channel_to_component(struct most_channel *c, return -ENOSPC; *comp_ptr = comp; - ret = comp->probe_channel(c->iface, c->channel_id, &c->cfg, comp_param); + ret = comp->probe_channel(c->iface, c->channel_id, &c->cfg, name, + comp_param); if (ret) { *comp_ptr = NULL; return ret; @@ -775,7 +777,7 @@ static ssize_t add_link_store(struct device_driver *drv, if (!c) return -ENODEV; - ret = link_channel_to_component(c, comp, comp_param); + ret = link_channel_to_component(c, comp, "name", comp_param); if (ret) return ret; return len; diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h index 64cc02f..025dd1d 100644 --- a/drivers/staging/most/core.h +++ b/drivers/staging/most/core.h @@ -266,7 +266,8 @@ struct core_component { struct list_head list; const char *name; int (*probe_channel)(struct most_interface *iface, int channel_idx, -struct most_channel_config *cfg, char *name); +struct most_channel_config *cfg, char *name, +char *param); int (*disconnect_channel)(struct most_interface *iface, int channel_idx); int (*rx_completion)(struct mbo *mbo); diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c index e20584b..c8a64e2 100644 --- a/drivers/staging/most/net/net.c +++ b/drivers/staging/most/net/net.c @@ -293,7 +293,8 @@ static struct net_dev_context *get_net_dev_hold(struct most_interface *iface) } static int comp_probe_channel(struct most_interface *iface, int channel_idx, - struct most_channel_config *ccfg, char *name) + struct most_channel_config *ccfg, char *name, + char *args) { struct net_dev_context *nd; struct net_dev_channel *ch; diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 79ab3a7..02fcd32 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -579,7 +579,7 @@ static void release_adapter(struct sound_adapter *adpt) */ static int audio_probe_channel(struct most_interface *iface, int channel_id, struct most_channel_config *cfg, - char *arg_list) + char *device_name, char *arg_list) { struct channel *channel; struct sound_adapter *adpt; @@ -588,7 +588,6 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, int capture_count = 0; int ret; int direction; - char *device_name; u16 ch_num; u8 create = 0; char *sample_res; diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c index ad7e28a..adca250 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -453,7 +453,8 @@ static void comp_v4l2_dev_release(struct v4l2_device *v4l2_dev) } static int comp_probe_channel(struct most_interface *iface, int channel_idx, -
[PATCH 00/14] staging: most: switch to configfs
This patch set makes the driver provide its configuration interface via configfs. The configuration interface is being switched to simplify the process of setting up the driver and to introduce the new feature of speculative configuration. Christian Gromm (14): staging: most: add new file configfs.c staging: most: change signature of function probe_channel staging: most: core: add configfs interface functions staging: most: sound: introduce new sound adapter management staging: most: enable configfs support staging: most: core: make sysfs attributes read-only staging: most: core: use device description as name staging: most: usb: remove prefix from description tag staging: most: core: remove attribute add_link staging: most: allow speculative configuration staging: most: configfs: make create attributes write-only staging: most: configfs: add code for link removal staging: most: configfs: rename config attributes staging: most: Documentation: update driver documentation .../most/Documentation/ABI/configfs-most.txt | 204 ++ .../staging/most/Documentation/driver_usage.txt| 131 ++-- drivers/staging/most/Makefile | 1 + drivers/staging/most/cdev/cdev.c | 8 +- drivers/staging/most/configfs.c| 709 + drivers/staging/most/core.c| 306 - drivers/staging/most/core.h| 21 +- drivers/staging/most/net/net.c | 3 +- drivers/staging/most/sound/sound.c | 59 +- drivers/staging/most/usb/usb.c | 2 +- drivers/staging/most/video/video.c | 3 +- 11 files changed, 1199 insertions(+), 248 deletions(-) create mode 100644 drivers/staging/most/Documentation/ABI/configfs-most.txt create mode 100644 drivers/staging/most/configfs.c -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/14] staging: most: allow speculative configuration
This patch makes the driver accept a link confiiguration eventhough no device is attached to the bus. Instead the configuration is being applied as soon as a device is being registered with the core. Signed-off-by: Christian Gromm --- drivers/staging/most/configfs.c| 63 +++--- drivers/staging/most/core.c| 16 +++--- drivers/staging/most/core.h| 1 + drivers/staging/most/sound/sound.c | 6 ++-- 4 files changed, 54 insertions(+), 32 deletions(-) diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c index cefce69..84a4bd3 100644 --- a/drivers/staging/most/configfs.c +++ b/drivers/staging/most/configfs.c @@ -16,6 +16,7 @@ struct mdev_link { struct config_item item; + struct list_head list; int create; u16 num_buffers; u16 buffer_size; @@ -31,6 +32,8 @@ struct mdev_link { char param[MAX_LEN]; }; +struct list_head mdev_link_list; + int set_cfg_buffer_size(struct mdev_link *link) { if (!link->buffer_size) @@ -107,13 +110,30 @@ static ssize_t mdev_link_create_show(struct config_item *item, char *page) return sprintf(page, "%d\n", to_mdev_link(item)->create); } +static int set_config_and_add_link(struct mdev_link *mdev_link) +{ + int i; + int ret; + + for (i = 0; i < ARRAY_SIZE(set_config_val); i++) { + ret = set_config_val[i](mdev_link); + if (ret == -ENODATA) { + pr_err("Config failed\n"); + return ret; + } + } + + return most_add_link(mdev_link->mdev, mdev_link->channel, +mdev_link->comp, mdev_link->name, +mdev_link->param); +} + static ssize_t mdev_link_create_store(struct config_item *item, const char *page, size_t count) { struct mdev_link *mdev_link = to_mdev_link(item); u16 tmp; int ret; - int i; char *p = (char *)page; ret = kstrtou16(p, 0, &tmp); @@ -121,28 +141,18 @@ static ssize_t mdev_link_create_store(struct config_item *item, return ret; if (tmp > 1) return -ERANGE; - - for (i = 0; i < ARRAY_SIZE(set_config_val); i++) { - ret = set_config_val[i](mdev_link); - if (ret < 0) { - pr_err("Config failed\n"); - return ret; - } - } + if (!tmp) + return most_remove_link(mdev_link->mdev, mdev_link->channel, + mdev_link->comp); if (!mdev_link->mdev || !mdev_link->channel || !mdev_link->comp) { pr_err("Config parameters incomplete\n"); - return -EIO; + return -ENODATA; } - if (tmp) - ret = most_add_link(mdev_link->mdev, mdev_link->channel, - mdev_link->comp, mdev_link->name, - mdev_link->param); - else - ret = most_remove_link(mdev_link->mdev, mdev_link->channel, - mdev_link->comp); - if (ret) + ret = set_config_and_add_link(mdev_link); + if (ret && ret != -ENODEV) return ret; + list_add_tail(&mdev_link->list, &mdev_link_list); mdev_link->create = tmp; return count; } @@ -622,6 +632,22 @@ int most_register_configfs_subsys(struct core_component *c) } EXPORT_SYMBOL_GPL(most_register_configfs_subsys); +void most_interface_register_notify(const char *mdev) +{ + bool register_snd_card = false; + struct mdev_link *mdev_link; + + list_for_each_entry(mdev_link, &mdev_link_list, list) { + if (!strcmp(mdev_link->mdev, mdev)) { + set_config_and_add_link(mdev_link); + if (!strcmp(mdev_link->comp, "sound")) + register_snd_card = true; + } + } + if (register_snd_card) + most_cfg_complete("sound"); +} + void most_deregister_configfs_subsys(struct core_component *c) { if (!strcmp(c->name, "cdev")) @@ -650,6 +676,7 @@ int __init configfs_init(void) mutex_init(&most_sound_subsys.subsys.su_mutex); INIT_LIST_HEAD(&most_sound_subsys.soundcard_list); + INIT_LIST_HEAD(&mdev_link_list); return 0; } diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 31291bc..765a74c0 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -720,19 +720,10 @@ int most_cfg_complete(char *comp_name) int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name, char *comp_param) { - struct most_channel *c; - struct core_component *comp; - char buf[STRING_SIZE]; + struct most_channel *c = get_ch
[PATCH 09/14] staging: most: core: remove attribute add_link
This patch removes the driver attribute add_link. It is not needed, because the link management is now done via configfs. Signed-off-by: Christian Gromm --- drivers/staging/most/core.c | 61 - 1 file changed, 61 deletions(-) diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index c4423b5..31291bc 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -616,65 +616,6 @@ inline int link_channel_to_component(struct most_channel *c, return 0; } -/** - * add_link_store - store function for add_link attribute - * @drv: device driver - * @buf: buffer - * @len: buffer length - * - * This parses the string given by buf and splits it into - * four substrings. Note: last substring is optional. In case a cdev - * component is loaded the optional 4th substring will make up the name of - * device node in the /dev directory. If omitted, the device node will - * inherit the channel's name within sysfs. - * - * Searches for (device, channel) pair and probes the component - * - * Example: - * (1) echo "mdev0:ch6:cdev:my_rxchannel" >add_link - * (2) echo "mdev1:ep81:cdev" >add_link - * - * (1) would create the device node /dev/my_rxchannel - * (2) would create the device node /dev/mdev1-ep81 - */ -static ssize_t add_link_store(struct device_driver *drv, - const char *buf, - size_t len) -{ - struct most_channel *c; - struct core_component *comp; - char buffer[STRING_SIZE]; - char *mdev; - char *mdev_ch; - char *comp_name; - char *comp_param; - char devnod_buf[STRING_SIZE]; - int ret; - size_t max_len = min_t(size_t, len + 1, STRING_SIZE); - - strlcpy(buffer, buf, max_len); - ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, &comp_param); - if (ret) - return ret; - comp = match_component(comp_name); - if (!comp) - return -ENODEV; - if (!comp_param || *comp_param == 0) { - snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, -mdev_ch); - comp_param = devnod_buf; - } - - c = get_channel(mdev, mdev_ch); - if (!c) - return -ENODEV; - - ret = link_channel_to_component(c, comp, "name", comp_param); - if (ret) - return ret; - return len; -} - int most_set_cfg_buffer_size(char *mdev, char *mdev_ch, u16 val) { struct most_channel *c = get_channel(mdev, mdev_ch); @@ -863,13 +804,11 @@ int most_remove_link(char *mdev, char *mdev_ch, char *comp_name) static DRIVER_ATTR_RO(links); static DRIVER_ATTR_RO(components); -static DRIVER_ATTR_WO(add_link); static DRIVER_ATTR_WO(remove_link); static struct attribute *mc_attrs[] = { DRV_ATTR(links), DRV_ATTR(components), - DRV_ATTR(add_link), DRV_ATTR(remove_link), NULL, }; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/14] staging: most: configfs: add code for link removal
This patch adds code that cleans up established links whenever the destroy attribute is set or if the config_item (directory) is being removed. Signed-off-by: Christian Gromm --- drivers/staging/most/configfs.c | 41 + 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c index 1e1d7d0..cb0256a 100644 --- a/drivers/staging/most/configfs.c +++ b/drivers/staging/most/configfs.c @@ -18,6 +18,7 @@ struct mdev_link { struct config_item item; struct list_head list; int create; + int destroy; u16 num_buffers; u16 buffer_size; u16 subbuffer_size; @@ -134,11 +135,8 @@ static ssize_t mdev_link_create_store(struct config_item *item, ret = kstrtou16(p, 0, &tmp); if (ret) return ret; - if (tmp > 1) + if (tmp != 1) return -ERANGE; - if (!tmp) - return most_remove_link(mdev_link->mdev, mdev_link->channel, - mdev_link->comp); if (!mdev_link->mdev || !mdev_link->channel || !mdev_link->comp) { pr_err("Config parameters incomplete\n"); @@ -152,6 +150,29 @@ static ssize_t mdev_link_create_store(struct config_item *item, return count; } +static ssize_t mdev_link_destroy_store(struct config_item *item, + const char *page, size_t count) +{ + struct mdev_link *mdev_link = to_mdev_link(item); + u16 tmp; + int ret; + char *p = (char *)page; + + ret = kstrtou16(p, 0, &tmp); + if (ret) + return ret; + if (tmp != 1) + return -ERANGE; + mdev_link->destroy = tmp; + ret = most_remove_link(mdev_link->mdev, mdev_link->channel, + mdev_link->comp); + if (ret) + return ret; + if (!list_empty(&mdev_link_list)) + list_del(&mdev_link->list); + return count; +} + static ssize_t mdev_link_direction_show(struct config_item *item, char *page) { return sprintf(page, "%s\n", to_mdev_link(item)->direction); @@ -344,6 +365,7 @@ static ssize_t mdev_link_dbr_size_store(struct config_item *item, } CONFIGFS_ATTR_WO(mdev_link_, create); +CONFIGFS_ATTR_WO(mdev_link_, destroy); CONFIGFS_ATTR(mdev_link_, mdev); CONFIGFS_ATTR(mdev_link_, channel); CONFIGFS_ATTR(mdev_link_, comp); @@ -358,6 +380,7 @@ CONFIGFS_ATTR(mdev_link_, dbr_size); static struct configfs_attribute *mdev_link_attrs[] = { &mdev_link_attr_create, + &mdev_link_attr_destroy, &mdev_link_attr_mdev, &mdev_link_attr_channel, &mdev_link_attr_comp, @@ -374,6 +397,16 @@ static struct configfs_attribute *mdev_link_attrs[] = { static void mdev_link_release(struct config_item *item) { + struct mdev_link *mdev_link = to_mdev_link(item); + int ret; + + if (!list_empty(&mdev_link_list)) { + ret = most_remove_link(mdev_link->mdev, mdev_link->channel, + mdev_link->comp); + if (ret && (ret != -ENODEV)) + pr_err("Removing link failed.\n"); + list_del(&mdev_link->list); + } kfree(to_mdev_link(item)); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/14] staging: most: configfs: make create attributes write-only
Reading the create attribute that triggers the creation of a link to a certain channel is not necessary. Hence, it is being removed. Signed-off-by: Christian Gromm --- drivers/staging/most/configfs.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c index 84a4bd3..1e1d7d0 100644 --- a/drivers/staging/most/configfs.c +++ b/drivers/staging/most/configfs.c @@ -105,11 +105,6 @@ static inline struct mdev_link *to_mdev_link(struct config_item *item) return item ? container_of(item, struct mdev_link, item) : NULL; } -static ssize_t mdev_link_create_show(struct config_item *item, char *page) -{ - return sprintf(page, "%d\n", to_mdev_link(item)->create); -} - static int set_config_and_add_link(struct mdev_link *mdev_link) { int i; @@ -348,7 +343,7 @@ static ssize_t mdev_link_dbr_size_store(struct config_item *item, return count; } -CONFIGFS_ATTR(mdev_link_, create); +CONFIGFS_ATTR_WO(mdev_link_, create); CONFIGFS_ATTR(mdev_link_, mdev); CONFIGFS_ATTR(mdev_link_, channel); CONFIGFS_ATTR(mdev_link_, comp); @@ -498,11 +493,6 @@ static struct config_item *most_snd_grp_make_item(struct config_group *group, return &mdev_link->item; } -static ssize_t most_snd_grp_create_show(struct config_item *item, char *page) -{ - return sprintf(page, "%d\n", to_most_snd_grp(item)->create); -} - static ssize_t most_snd_grp_create_store(struct config_item *item, const char *page, size_t count) { @@ -525,7 +515,7 @@ static ssize_t most_snd_grp_create_store(struct config_item *item, return count; } -CONFIGFS_ATTR(most_snd_grp_, create); +CONFIGFS_ATTR_WO(most_snd_grp_, create); static struct configfs_attribute *most_snd_grp_attrs[] = { &most_snd_grp_attr_create, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/14] staging: most: sound: introduce new sound adapter management
This patch adapts the sound card management to the configfs changes. Signed-off-by: Christian Gromm --- drivers/staging/most/sound/sound.c | 41 +- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 02fcd32..049ec44 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -471,17 +471,11 @@ static const struct snd_pcm_ops pcm_ops = { .page = snd_pcm_lib_get_vmalloc_page, }; -static int split_arg_list(char *buf, char **device_name, u16 *ch_num, - char **sample_res, u8 *create) +static int split_arg_list(char *buf, u16 *ch_num, char **sample_res) { char *num; int ret; - *device_name = strsep(&buf, "."); - if (!*device_name) { - pr_err("Missing sound card name\n"); - return -EIO; - } num = strsep(&buf, "x"); if (!num) goto err; @@ -492,8 +486,6 @@ static int split_arg_list(char *buf, char **device_name, u16 *ch_num, if (!*sample_res) goto err; - if (buf && !strcmp(buf, "create")) - *create = 1; return 0; err: @@ -589,7 +581,6 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, int ret; int direction; u16 ch_num; - u8 create = 0; char *sample_res; if (!iface) @@ -600,8 +591,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, return -EINVAL; } - ret = split_arg_list(arg_list, &device_name, &ch_num, &sample_res, -&create); + ret = split_arg_list(arg_list, &ch_num, &sample_res); if (ret < 0) return ret; @@ -672,12 +662,6 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, strscpy(pcm->name, device_name, sizeof(pcm->name)); snd_pcm_set_ops(pcm, direction, &pcm_ops); - if (create) { - ret = snd_card_register(adpt->card); - if (ret < 0) - goto err_free_adpt; - adpt->registered = true; - } return 0; err_free_adpt: @@ -685,6 +669,26 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, return ret; } +static int audio_create_sound_card(void) +{ + int ret; + struct sound_adapter *adpt; + + list_for_each_entry(adpt, &adpt_list, list) { + if (!adpt->registered) + goto adpt_alloc; + } + return -ENODEV; +adpt_alloc: + ret = snd_card_register(adpt->card); + if (ret < 0) { + release_adapter(adpt); + return ret; + } + adpt->registered = true; + return ret; +} + /** * audio_disconnect_channel - function to disconnect a channel * @iface: pointer to interface instance @@ -781,6 +785,7 @@ static struct core_component comp = { .disconnect_channel = audio_disconnect_channel, .rx_completion = audio_rx_completion, .tx_completion = audio_tx_completion, + .cfg_complete = audio_create_sound_card, }; static int __init audio_init(void) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/14] staging: most: usb: remove prefix from description tag
This patch cuts off the usb_device prefix of the description string. It is not needed, as the interface type is already available with the interface attribute of a channel. Signed-off-by: Christian Gromm --- drivers/staging/most/usb/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c index c0293d8..360cb5b 100644 --- a/drivers/staging/most/usb/usb.c +++ b/drivers/staging/most/usb/usb.c @@ -1072,7 +1072,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) mdev->iface.num_channels = num_endpoints; snprintf(mdev->description, sizeof(mdev->description), -"usb_device %d-%s:%d.%d", +"%d-%s:%d.%d", usb_dev->bus->busnum, usb_dev->devpath, usb_dev->config->desc.bConfigurationValue, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/14] staging: most: configfs: rename config attributes
This patch introduces attribute names that are more self explaining. Signed-off-by: Christian Gromm --- drivers/staging/most/configfs.c | 98 - 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c index cb0256a..8d6aaf9 100644 --- a/drivers/staging/most/configfs.c +++ b/drivers/staging/most/configfs.c @@ -17,8 +17,8 @@ struct mdev_link { struct config_item item; struct list_head list; - int create; - int destroy; + int create_link; + int destroy_link; u16 num_buffers; u16 buffer_size; u16 subbuffer_size; @@ -27,10 +27,10 @@ struct mdev_link { char datatype[MAX_LEN]; char direction[MAX_LEN]; char name[MAX_LEN]; - char mdev[MAX_LEN]; + char device[MAX_LEN]; char channel[MAX_LEN]; char comp[MAX_LEN]; - char param[MAX_LEN]; + char comp_params[MAX_LEN]; }; struct list_head mdev_link_list; @@ -39,7 +39,7 @@ int set_cfg_buffer_size(struct mdev_link *link) { if (!link->buffer_size) return -ENODATA; - return most_set_cfg_buffer_size(link->mdev, link->channel, + return most_set_cfg_buffer_size(link->device, link->channel, link->buffer_size); } @@ -47,7 +47,7 @@ int set_cfg_subbuffer_size(struct mdev_link *link) { if (!link->subbuffer_size) return -ENODATA; - return most_set_cfg_subbuffer_size(link->mdev, link->channel, + return most_set_cfg_subbuffer_size(link->device, link->channel, link->subbuffer_size); } @@ -55,7 +55,7 @@ int set_cfg_dbr_size(struct mdev_link *link) { if (!link->dbr_size) return -ENODATA; - return most_set_cfg_dbr_size(link->mdev, link->channel, + return most_set_cfg_dbr_size(link->device, link->channel, link->dbr_size); } @@ -63,7 +63,7 @@ int set_cfg_num_buffers(struct mdev_link *link) { if (!link->num_buffers) return -ENODATA; - return most_set_cfg_num_buffers(link->mdev, link->channel, + return most_set_cfg_num_buffers(link->device, link->channel, link->num_buffers); } @@ -71,7 +71,7 @@ int set_cfg_packets_xact(struct mdev_link *link) { if (!link->packets_per_xact) return -ENODATA; - return most_set_cfg_packets_xact(link->mdev, link->channel, + return most_set_cfg_packets_xact(link->device, link->channel, link->packets_per_xact); } @@ -79,7 +79,7 @@ int set_cfg_direction(struct mdev_link *link) { if (!strlen(link->direction)) return -ENODATA; - return most_set_cfg_direction(link->mdev, link->channel, + return most_set_cfg_direction(link->device, link->channel, link->direction); } @@ -87,7 +87,7 @@ int set_cfg_datatype(struct mdev_link *link) { if (!strlen(link->datatype)) return -ENODATA; - return most_set_cfg_datatype(link->mdev, link->channel, + return most_set_cfg_datatype(link->device, link->channel, link->datatype); } @@ -119,13 +119,13 @@ static int set_config_and_add_link(struct mdev_link *mdev_link) } } - return most_add_link(mdev_link->mdev, mdev_link->channel, + return most_add_link(mdev_link->device, mdev_link->channel, mdev_link->comp, mdev_link->name, -mdev_link->param); +mdev_link->comp_params); } -static ssize_t mdev_link_create_store(struct config_item *item, - const char *page, size_t count) +static ssize_t mdev_link_create_link_store(struct config_item *item, + const char *page, size_t count) { struct mdev_link *mdev_link = to_mdev_link(item); u16 tmp; @@ -138,7 +138,7 @@ static ssize_t mdev_link_create_store(struct config_item *item, if (tmp != 1) return -ERANGE; - if (!mdev_link->mdev || !mdev_link->channel || !mdev_link->comp) { + if (!mdev_link->device || !mdev_link->channel || !mdev_link->comp) { pr_err("Config parameters incomplete\n"); return -ENODATA; } @@ -146,12 +146,12 @@ static ssize_t mdev_link_create_store(struct config_item *item, if (ret && ret != -ENODEV) return ret; list_add_tail(&mdev_link->list, &mdev_link_list); - mdev_link->create = tmp; + mdev_link->create_link = tmp; return count; } -static ssize_t mdev_link_destroy_store(struct config_item *item, - const char *page, size
[PATCH 06/14] staging: most: core: make sysfs attributes read-only
This patch changes the access flags of the channel attributes to read-only. This is needed, because configuration is done via configfs. Signed-off-by: Christian Gromm --- drivers/staging/most/core.c | 122 +++- 1 file changed, 7 insertions(+), 115 deletions(-) diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index b366517..006f044 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -272,19 +272,6 @@ static ssize_t set_number_of_buffers_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers); } -static ssize_t set_number_of_buffers_store(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t count) -{ - struct most_channel *c = to_channel(dev); - int ret = kstrtou16(buf, 0, &c->cfg.num_buffers); - - if (ret) - return ret; - return count; -} - static ssize_t set_buffer_size_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -294,19 +281,6 @@ static ssize_t set_buffer_size_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size); } -static ssize_t set_buffer_size_store(struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t count) -{ - struct most_channel *c = to_channel(dev); - int ret = kstrtou16(buf, 0, &c->cfg.buffer_size); - - if (ret) - return ret; - return count; -} - static ssize_t set_direction_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -320,28 +294,6 @@ static ssize_t set_direction_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "unconfigured\n"); } -static ssize_t set_direction_store(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t count) -{ - struct most_channel *c = to_channel(dev); - - if (!strcmp(buf, "dir_rx\n")) { - c->cfg.direction = MOST_CH_RX; - } else if (!strcmp(buf, "rx\n")) { - c->cfg.direction = MOST_CH_RX; - } else if (!strcmp(buf, "dir_tx\n")) { - c->cfg.direction = MOST_CH_TX; - } else if (!strcmp(buf, "tx\n")) { - c->cfg.direction = MOST_CH_TX; - } else { - pr_info("WARN: invalid attribute settings\n"); - return -EINVAL; - } - return count; -} - static ssize_t set_datatype_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -356,28 +308,6 @@ static ssize_t set_datatype_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "unconfigured\n"); } -static ssize_t set_datatype_store(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t count) -{ - int i; - struct most_channel *c = to_channel(dev); - - for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) { - if (!strcmp(buf, ch_data_type[i].name)) { - c->cfg.data_type = ch_data_type[i].most_ch_data_type; - break; - } - } - - if (i == ARRAY_SIZE(ch_data_type)) { - pr_info("WARN: invalid attribute settings\n"); - return -EINVAL; - } - return count; -} - static ssize_t set_subbuffer_size_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -387,19 +317,6 @@ static ssize_t set_subbuffer_size_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size); } -static ssize_t set_subbuffer_size_store(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t count) -{ - struct most_channel *c = to_channel(dev); - int ret = kstrtou16(buf, 0, &c->cfg.subbuffer_size); - - if (ret) - return ret; - return count; -} - static ssize_t set_packets_per_xact_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -409,19 +326,6 @@ static ssize_t set_packets_per_xact_show(struct device *dev, return snprintf(buf, PAGE_SIZE,
[PATCH 14/14] staging: most: Documentation: update driver documentation
This patch updates the driver documentation files to reflect the latest changes regarding configfs. Signed-off-by: Christian Gromm --- .../most/Documentation/ABI/configfs-most.txt | 204 + .../staging/most/Documentation/driver_usage.txt| 131 +++-- 2 files changed, 284 insertions(+), 51 deletions(-) create mode 100644 drivers/staging/most/Documentation/ABI/configfs-most.txt diff --git a/drivers/staging/most/Documentation/ABI/configfs-most.txt b/drivers/staging/most/Documentation/ABI/configfs-most.txt new file mode 100644 index 000..f5669f4 --- /dev/null +++ b/drivers/staging/most/Documentation/ABI/configfs-most.txt @@ -0,0 +1,204 @@ +What: /sys/kernel/config/most_ +Date: March 8, 2019 +KernelVersion: 5.0.0 +Description: Interface is used to configure and connect device channels + to component drivers. + + Attributes are visible only when configfs is mounted. To mount + configfs in /sys/kernel/config directory use: + # mount -t configfs none /sys/kernel/config/ + + +What: /sys/kernel/config/most_cdev/ +Date: March 8, 2019 +KernelVersion: 5.0.0 +Description: + The attributes: + + buffer_size configure the buffer size for this channel + + subbuffer_size configure the sub-buffer size for this channel + (needed for synchronous and isochrnous data) + + + num_buffers configure number of buffers used for this + channel + + datatypeconfigure type of data that will travel over + this channel + + direction configure whether this link will be an input + or output + + dbr_sizeconfigure DBR data buffer size (this is used + for MediaLB communiction only) + + packets_per_xact + configure the number of packets that will be + collected from the network before being + transmitted via USB (this is used for USB + communiction only) + + device name of the device the link is to be attached to + + channel name of the channel the link is to be attached to + + comp_params pass parameters needed by some components + + create_link write '1' to this attribute to trigger the + creation of the link. In case of speculative + configuration, the creation is post-poned until + a physical device is being attached to the bus. + + destroy_linkwrite '1' to this attribute to destroy an + active link + +What: /sys/kernel/config/most_video/ +Date: March 8, 2019 +KernelVersion: 5.0.0 +Description: + The attributes: + + buffer_size configure the buffer size for this channel + + subbuffer_size configure the sub-buffer size for this channel + (needed for synchronous and isochrnous data) + + + num_buffers configure number of buffers used for this + channel + + datatypeconfigure type of data that will travel over + this channel + + direction configure whether this link will be an input + or output + + dbr_sizeconfigure DBR data buffer size (this is used + for MediaLB communiction only) + + packets_per_xact + configure the number of packets that will be + collected from the network before being + transmitted via USB (this is used for USB + communiction only) + + device name of the device the link is to be attached to + + channel name of the channel the link is to be attached to + + comp_params pass parameters needed by some components + + create_link write '1' to this attribute to trigger the + creation of the link. In case of speculative + configuration, the creation is post-poned until + a physical device is being attached to the bus. + + destroy_linkwrite '1' to this attribute to destroy an + active link + +What: /sys/kernel/config/most_net/ +Date: March 8, 2019 +KernelVersion: 5.0.0 +Description: + The attributes: +
Re: [PATCH] spi: mt7621: Move SPI driver out of staging
On Thu, Mar 14, 2019 at 12:52:12PM +0100, Stefan Roese wrote: This looks pretty good, a few trivial issues below but nothing major I think. > +config SPI_MT7621 > + tristate "MediaTek MT7621 SPI Controller" > + depends on RALINK > + help > + This selects a driver for the MediaTek MT7621 SPI Controller. > + I'm not seeing any build time dependency on this, please add an || COMPILE_TEST to help with build testing. > @@ -0,0 +1,422 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * spi-mt7621.c -- MediaTek MT7621 SPI controller driver > + * Please make the entire comment a C++ one to > + * Some parts are based on spi-orion.c: > + * Author: Shadi Ammouri > + * Copyright (C) 2007-2008 Marvell Ltd. That driver dates from 2008 AFAICT, and had some changes after then? > +static void mt7621_spi_set_cs(struct spi_device *spi, int enable) > +{ > + struct mt7621_spi *rs = spidev_to_mt7621_spi(spi); > + int cs = spi->chip_select; > + u32 polar = 0; > + > + mt7621_spi_reset(rs); > + if (enable) > + polar = BIT(cs); > + mt7621_spi_write(rs, MT7621_SPI_POLAR, polar); > +} Will doing a reset mess up the rate configuration and stuff that's done in _prepare(), or is _reset() perhaps not an entirely accurate name? > + list_for_each_entry(t, &m->transfers, transfer_list) > + if (t->speed_hz < speed) > + speed = t->speed_hz; This should be in the core if it's needed, it's going to be the same for all drivers. > + master->setup = mt7621_spi_setup; > + master->transfer_one_message = mt7621_spi_transfer_one_message; > + master->bits_per_word_mask = SPI_BPW_MASK(8); > + master->dev.of_node = pdev->dev.of_node; > + master->num_chipselect = 2; The driver should set SPI_CONTROLLER_HALF_DUPLEX in flags. > + clk_disable(rs->clk); This needs to be clk_disable_unprepare() to ensure the clock is unprepared as well as disabled. > + spi_unregister_master(master); Just use devm_spi_register_controller()? The _master() name is legacy and devm_ would make life easier. signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: pidfd design
On Wed, Mar 20, 2019 at 12:40 PM Daniel Colascione wrote: > > On Wed, Mar 20, 2019 at 12:14 PM Christian Brauner > wrote: > > > > On Wed, Mar 20, 2019 at 11:58:57AM -0700, Andy Lutomirski wrote: > > > On Wed, Mar 20, 2019 at 11:52 AM Christian Brauner > > > wrote: > > > > > > > > You're misunderstanding. Again, I said in my previous mails it should > > > > accept pidfds optionally as arguments, yes. But I don't want it to > > > > return the status fds that you previously wanted pidfd_wait() to return. > > > > I really want to see Joel's pidfd_wait() patchset and have more people > > > > review the actual code. > > > > > > Just to make sure that no one is forgetting a material security > > > consideration: > > > > Andy, thanks for commenting! > > > > > > > > $ ls /proc/self > > > attr exemountinfo projid_mapstatus > > > autogroupfd mounts root syscall > > > auxv fdinfo mountstats sched task > > > cgroup gid_mapnetschedstat timers > > > clear_refs io ns sessionid timerslack_ns > > > cmdline latencynuma_maps setgroups uid_map > > > comm limits oom_adjsmaps wchan > > > coredump_filter loginuid oom_score smaps_rollup > > > cpuset map_files oom_score_adj stack > > > cwd maps pagemapstat > > > environ mempersonalitystatm > > > > > > A bunch of this stuff makes sense to make accessible through a syscall > > > interface that we expect to be used even in sandboxes. But a bunch of > > > it does not. For example, *_map, mounts, mountstats, and net are all > > > namespace-wide things that certain policies expect to be unavailable. > > > stack, for example, is a potential attack surface. Etc. > > If you can access these files sources via open(2) on /proc/, you > should be able to access them via a pidfd. If you can't, you > shouldn't. Which /proc? The one you'd get by mounting procfs. I don't > see how pidfd makes any material changes to anyone's security. As far > as I'm concerned, if a sandbox can't mount /proc at all, it's just a > broken and unsupported configuration. It's not "broken and unsupported". I know of an actual working, deployed container-ish sandbox that does exactly this. I would also guess that quite a few not-at-all-container-like sandboxes work like this. (The obvious seccomp + unshare + pivot_root deny-myself-access-to-lots-of-things trick results in no /proc, which is by dsign.) > > An actual threat model and real thought paid to access capabilities > would help. Almost everything around the interaction of Linux kernel > namespaces and security feels like a jumble of ad-hoc patches added as > afterthoughts in response to random objections. I fully agree. But if you start thinking for real about access capabilities, there's no way that you're going to conclude that a capability to access some process implies a capability to access the settings of its network namespace. > > >> All these new APIs either need to > > > return something more restrictive than a proc dirfd or they need to > > > follow the same rules. > ... > What's special about libraries? How is a library any worse-off using > openat(2) on a pidfd than it would be just opening the file called > "/proc/$apid"? Because most libraries actually work, right now, without /proc. Even libraries that spawn subprocesses. If we make the new API have the property that it doesn't work if you're in a non-root user namespace and /proc isn't mounted, the result will be an utter mess. > > > > Yes, this is unfortunate, but it is indeed the current situation. I > > > suppose that we could return magic restricted dirfds, or we could > > > return things that aren't dirfds and all and have some API that gives > > > you the dirfd associated with a procfd but only if you can see > > > /proc/PID. > > > > What would be your opinion to having a > > /proc//handle > > file instead of having a dirfd. Essentially, what I initially proposed > > at LPC. The change on what we currently have in master would be: > > https://gist.github.com/brauner/59eec91550c5624ceaebd95a70df > > And how do you propose, given one of these handle objects, getting a > process's current priority, or its current oom score, or its list of > memory maps? As I mentioned in my original email, and which nobody has > addressed, if you don't use a dirfd as your process handle or you > don't provide an easy way to get one of these proc directory FDs, you > need to duplicate a lot of metadata access interfaces. An API that takes a process handle object and an fd pointing at /proc (the root of the proc fs) and gives you back a proc dirfd would do the trick. You could do this with no new kernel features at all if you're willing to read the pid, call openat(2), and handle the races in user code. __
[PATCH] staging: ralink-gdma: Prefer u32 over uint32_t
Change uint32_t to u32 Signed-off-by: Bharath Vedartham --- drivers/staging/ralink-gdma/ralink-gdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c index d78042e..2c19287 100644 --- a/drivers/staging/ralink-gdma/ralink-gdma.c +++ b/drivers/staging/ralink-gdma/ralink-gdma.c @@ -361,7 +361,7 @@ static int rt3883_gdma_start_transfer(struct gdma_dmaengine_chan *chan) struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); dma_addr_t src_addr, dst_addr; struct gdma_dma_sg *sg; - uint32_t ctrl0, ctrl1; + u32 ctrl0, ctrl1; /* verify chan is already stopped */ ctrl0 = gdma_dma_read(dma_dev, GDMA_REG_CTRL0(chan->id)); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 1/2] staging: iio: ad5933: change attributes to match ABI
Change device attributes' names to match ABI documentation. Names were chosen such that they tend to be similar to existing ABI so it should be easier to standardize them when necessary. Signed-off-by: Marcelo Schmitt --- .../staging/iio/impedance-analyzer/ad5933.c | 24 +-- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index d75bdfbf93de..2b0f8f899e3f 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -315,12 +315,12 @@ static ssize_t ad5933_store_frequency(struct device *dev, return ret ? ret : len; } -static IIO_DEVICE_ATTR(out_voltage0_freq_start, 0644, +static IIO_DEVICE_ATTR(out_altvoltage0_frequency_start, 0644, ad5933_show_frequency, ad5933_store_frequency, AD5933_REG_FREQ_START); -static IIO_DEVICE_ATTR(out_voltage0_freq_increment, 0644, +static IIO_DEVICE_ATTR(out_altvoltage0_frequency_increment, 0644, ad5933_show_frequency, ad5933_store_frequency, AD5933_REG_FREQ_INC); @@ -443,12 +443,12 @@ static ssize_t ad5933_store(struct device *dev, return ret ? ret : len; } -static IIO_DEVICE_ATTR(out_voltage0_scale, 0644, +static IIO_DEVICE_ATTR(out_altvoltage0_raw, 0644, ad5933_show, ad5933_store, AD5933_OUT_RANGE); -static IIO_DEVICE_ATTR(out_voltage0_scale_available, 0444, +static IIO_DEVICE_ATTR(out_altvoltage0_scale_available, 0444, ad5933_show, NULL, AD5933_OUT_RANGE_AVAIL); @@ -463,12 +463,12 @@ static IIO_DEVICE_ATTR(in_voltage0_scale_available, 0444, NULL, AD5933_IN_PGA_GAIN_AVAIL); -static IIO_DEVICE_ATTR(out_voltage0_freq_points, 0644, +static IIO_DEVICE_ATTR(out_altvoltage0_frequency_points, 0644, ad5933_show, ad5933_store, AD5933_FREQ_POINTS); -static IIO_DEVICE_ATTR(out_voltage0_settling_cycles, 0644, +static IIO_DEVICE_ATTR(out_altvoltage0_settling_cycles, 0644, ad5933_show, ad5933_store, AD5933_OUT_SETTLING_CYCLES); @@ -480,12 +480,12 @@ static IIO_DEVICE_ATTR(out_voltage0_settling_cycles, 0644, * don't create dedicated sysfs channel attributes for out0 and in0. */ static struct attribute *ad5933_attributes[] = { - &iio_dev_attr_out_voltage0_scale.dev_attr.attr, - &iio_dev_attr_out_voltage0_scale_available.dev_attr.attr, - &iio_dev_attr_out_voltage0_freq_start.dev_attr.attr, - &iio_dev_attr_out_voltage0_freq_increment.dev_attr.attr, - &iio_dev_attr_out_voltage0_freq_points.dev_attr.attr, - &iio_dev_attr_out_voltage0_settling_cycles.dev_attr.attr, + &iio_dev_attr_out_altvoltage0_raw.dev_attr.attr, + &iio_dev_attr_out_altvoltage0_scale_available.dev_attr.attr, + &iio_dev_attr_out_altvoltage0_frequency_start.dev_attr.attr, + &iio_dev_attr_out_altvoltage0_frequency_increment.dev_attr.attr, + &iio_dev_attr_out_altvoltage0_frequency_points.dev_attr.attr, + &iio_dev_attr_out_altvoltage0_settling_cycles.dev_attr.attr, &iio_dev_attr_in_voltage0_scale.dev_attr.attr, &iio_dev_attr_in_voltage0_scale_available.dev_attr.attr, NULL -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 0/2] staging: iio: ad5933: move out of staging
This series of patches makes device attributes' names equal to ABI documentation and move ad5933 driver out of staging. More precisely: It changes device attributes' names to match or be similar to existing ABI. It moves the ad5933 driver from staging directory to iio main drivers directory. Marcelo Schmitt (2): staging: iio: ad5933: change attributes to match ABI staging: iio: ad5933: move out of staging drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/impedance-analyzer/Kconfig| 18 + drivers/iio/impedance-analyzer/Makefile | 5 + drivers/iio/impedance-analyzer/ad5933.c | 811 ++ drivers/staging/iio/Kconfig | 1 - drivers/staging/iio/Makefile | 1 - .../staging/iio/impedance-analyzer/Kconfig| 18 - .../staging/iio/impedance-analyzer/Makefile | 5 - .../staging/iio/impedance-analyzer/ad5933.c | 811 -- 10 files changed, 836 insertions(+), 836 deletions(-) create mode 100644 drivers/iio/impedance-analyzer/Kconfig create mode 100644 drivers/iio/impedance-analyzer/Makefile create mode 100644 drivers/iio/impedance-analyzer/ad5933.c delete mode 100644 drivers/staging/iio/impedance-analyzer/Kconfig delete mode 100644 drivers/staging/iio/impedance-analyzer/Makefile delete mode 100644 drivers/staging/iio/impedance-analyzer/ad5933.c -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 2/2] staging: iio: ad5933: move out of staging
Move ad5933 impedance-analyzer driver from staging to mainline. The ad5933 is a high precision impedance converter system solution that combines an on-board frequency generator with an analog-to-digital converter (ADC). This driver was designed to be compatible with both ad5933 and ad5934 chips. Signed-off-by: Marcelo Schmitt --- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/impedance-analyzer/Kconfig| 18 + drivers/iio/impedance-analyzer/Makefile | 5 + drivers/iio/impedance-analyzer/ad5933.c | 811 ++ drivers/staging/iio/Kconfig | 1 - drivers/staging/iio/Makefile | 1 - .../staging/iio/impedance-analyzer/Kconfig| 18 - .../staging/iio/impedance-analyzer/Makefile | 5 - .../staging/iio/impedance-analyzer/ad5933.c | 811 -- 10 files changed, 836 insertions(+), 836 deletions(-) create mode 100644 drivers/iio/impedance-analyzer/Kconfig create mode 100644 drivers/iio/impedance-analyzer/Makefile create mode 100644 drivers/iio/impedance-analyzer/ad5933.c delete mode 100644 drivers/staging/iio/impedance-analyzer/Kconfig delete mode 100644 drivers/staging/iio/impedance-analyzer/Makefile delete mode 100644 drivers/staging/iio/impedance-analyzer/ad5933.c diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 014006d1cbb6..db38e6fb62fe 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -81,6 +81,7 @@ source "drivers/iio/frequency/Kconfig" source "drivers/iio/gyro/Kconfig" source "drivers/iio/health/Kconfig" source "drivers/iio/humidity/Kconfig" +source "drivers/iio/impedance-analyzer/Kconfig" source "drivers/iio/imu/Kconfig" source "drivers/iio/light/Kconfig" source "drivers/iio/magnetometer/Kconfig" diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index cb5993251381..fae55479356b 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -27,6 +27,7 @@ obj-y += gyro/ obj-y += frequency/ obj-y += health/ obj-y += humidity/ +obj-y += impedance-analyzer/ obj-y += imu/ obj-y += light/ obj-y += magnetometer/ diff --git a/drivers/iio/impedance-analyzer/Kconfig b/drivers/iio/impedance-analyzer/Kconfig new file mode 100644 index ..b9a679cdd146 --- /dev/null +++ b/drivers/iio/impedance-analyzer/Kconfig @@ -0,0 +1,18 @@ +# +# Impedance Converter, Network Analyzer drivers +# +menu "Network Analyzer, Impedance Converters" + +config AD5933 + tristate "Analog Devices AD5933, AD5934 driver" + depends on I2C + select IIO_BUFFER + select IIO_KFIFO_BUF + help + Say yes here to build support for Analog Devices Impedance Converter, + Network Analyzer, AD5933/4. + + To compile this driver as a module, choose M here: the + module will be called ad5933. + +endmenu diff --git a/drivers/iio/impedance-analyzer/Makefile b/drivers/iio/impedance-analyzer/Makefile new file mode 100644 index ..7604d786583e --- /dev/null +++ b/drivers/iio/impedance-analyzer/Makefile @@ -0,0 +1,5 @@ +# +# Makefile for Impedance Converter, Network Analyzer drivers +# + +obj-$(CONFIG_AD5933) += ad5933.o diff --git a/drivers/iio/impedance-analyzer/ad5933.c b/drivers/iio/impedance-analyzer/ad5933.c new file mode 100644 index ..2b0f8f899e3f --- /dev/null +++ b/drivers/iio/impedance-analyzer/ad5933.c @@ -0,0 +1,811 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * AD5933 AD5934 Impedance Converter, Network Analyzer + * + * Copyright 2011 Analog Devices Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* AD5933/AD5934 Registers */ +#define AD5933_REG_CONTROL_HB 0x80/* R/W, 1 byte */ +#define AD5933_REG_CONTROL_LB 0x81/* R/W, 1 byte */ +#define AD5933_REG_FREQ_START 0x82/* R/W, 3 bytes */ +#define AD5933_REG_FREQ_INC0x85/* R/W, 3 bytes */ +#define AD5933_REG_INC_NUM 0x88/* R/W, 2 bytes, 9 bit */ +#define AD5933_REG_SETTLING_CYCLES 0x8A/* R/W, 2 bytes */ +#define AD5933_REG_STATUS 0x8F/* R, 1 byte */ +#define AD5933_REG_TEMP_DATA 0x92/* R, 2 bytes*/ +#define AD5933_REG_REAL_DATA 0x94/* R, 2 bytes*/ +#define AD5933_REG_IMAG_DATA 0x96/* R, 2 bytes*/ + +/* AD5933_REG_CONTROL_HB Bits */ +#define AD5933_CTRL_INIT_START_FREQ(0x1 << 4) +#define AD5933_CTRL_START_SWEEP(0x2 << 4) +#define AD5933_CTRL_INC_FREQ (0x3 << 4) +#define AD5933_CTRL_REPEAT_FREQ(0x4 << 4) +#define AD5933_CTRL_MEASURE_TEMP (0x9 << 4) +#define AD5933_CTRL_POWER_DOWN (0xA << 4) +#define AD5933_CTRL_STANDBY(0xB << 4) + +#define AD5933_CTRL_RANGE_2000mVpp (0x0 << 1) +#define AD5933_CTRL_RANGE_200mVpp (0x1 << 1) +#define AD5933_CTRL_RANGE_400
Re: [PATCH] staging: ralink-gdma: Prefer u32 over uint32_t
On Fri, Mar 22, 2019 at 12:07:10AM +0530, Bharath Vedartham wrote: > Change uint32_t to u32 That says _what_ you did, but _why_ are you doing this? That's the main content a changelog text should have in it. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ralink-gdma: Prefer u32 over uint32_t
On Thu, Mar 21, 2019 at 07:46:09PM +0100, Greg KH wrote: > On Fri, Mar 22, 2019 at 12:07:10AM +0530, Bharath Vedartham wrote: > > Change uint32_t to u32 > > That says _what_ you did, but _why_ are you doing this? That's the main > content a changelog text should have in it. > > thanks, > > greg k-h That was a checkpatch.pl warning! I forgot to mention that! It fixed a checkpatch.pl warning. I ll write better changelogs from my next commit on. Thanks for the feedback! ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ralink-gdma: Prefer u32 over uint32_t
On Fri, Mar 22, 2019 at 12:18:58AM +0530, Bharath Vedartham wrote: > On Thu, Mar 21, 2019 at 07:46:09PM +0100, Greg KH wrote: > > On Fri, Mar 22, 2019 at 12:07:10AM +0530, Bharath Vedartham wrote: > > > Change uint32_t to u32 > > > > That says _what_ you did, but _why_ are you doing this? That's the main > > content a changelog text should have in it. > > > > thanks, > > > > greg k-h > That was a checkpatch.pl warning! I forgot to mention that! It fixed a > checkpatch.pl warning. I ll write better changelogs from my next commit > on. Thanks for the feedback! Please fix this up and resend as a "v2" patch, if you wish to have it accepted. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: ralink-gdma: Prefer u32 over uint32_t
Fix the checkpatch.pl warning: "Prefer u32 over uint32_t". Signed-off-by: Bharath Vedartham --- drivers/staging/ralink-gdma/ralink-gdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c index d78042e..2c19287 100644 --- a/drivers/staging/ralink-gdma/ralink-gdma.c +++ b/drivers/staging/ralink-gdma/ralink-gdma.c @@ -361,7 +361,7 @@ static int rt3883_gdma_start_transfer(struct gdma_dmaengine_chan *chan) struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); dma_addr_t src_addr, dst_addr; struct gdma_dma_sg *sg; - uint32_t ctrl0, ctrl1; + u32 ctrl0, ctrl1; /* verify chan is already stopped */ ctrl0 = gdma_dma_read(dma_dev, GDMA_REG_CTRL0(chan->id)); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ralink-gdma: Change uint32_t to u32
This is a follow up on my previous patch. Change occurences of the stdint type uint32_t to its shortened type u32. This fixed the checkpatch.pl warning: "Prefer u32 over uint32_t". Signed-off-by: Bharath Vedartham --- drivers/staging/ralink-gdma/ralink-gdma.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c index 2c19287..7e824d3 100644 --- a/drivers/staging/ralink-gdma/ralink-gdma.c +++ b/drivers/staging/ralink-gdma/ralink-gdma.c @@ -157,14 +157,14 @@ static struct gdma_dma_desc *to_gdma_dma_desc(struct virt_dma_desc *vdesc) return container_of(vdesc, struct gdma_dma_desc, vdesc); } -static inline uint32_t gdma_dma_read(struct gdma_dma_dev *dma_dev, +static inline u32 gdma_dma_read(struct gdma_dma_dev *dma_dev, unsigned int reg) { return readl(dma_dev->base + reg); } static inline void gdma_dma_write(struct gdma_dma_dev *dma_dev, - unsigned reg, uint32_t val) + unsigned reg, u32 val) { writel(val, dma_dev->base + reg); } @@ -283,7 +283,7 @@ static int rt305x_gdma_start_transfer(struct gdma_dmaengine_chan *chan) struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan); dma_addr_t src_addr, dst_addr; struct gdma_dma_sg *sg; - uint32_t ctrl0, ctrl1; + u32 ctrl0, ctrl1; /* verify chan is already stopped */ ctrl0 = gdma_dma_read(dma_dev, GDMA_REG_CTRL0(chan->id)); @@ -753,7 +753,7 @@ static void gdma_dma_tasklet(unsigned long arg) static void rt305x_gdma_init(struct gdma_dma_dev *dma_dev) { - uint32_t gct; + u32 gct; /* all chans round robin */ gdma_dma_write(dma_dev, GDMA_RT305X_GCT, GDMA_REG_GCT_ARBIT_RR); @@ -767,7 +767,7 @@ static void rt305x_gdma_init(struct gdma_dma_dev *dma_dev) static void rt3883_gdma_init(struct gdma_dma_dev *dma_dev) { - uint32_t gct; + u32 gct; /* all chans round robin */ gdma_dma_write(dma_dev, GDMA_REG_GCT, GDMA_REG_GCT_ARBIT_RR); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Help on testing ad5933 driver
Hello, would anyone mind helping me test ad5933 driver on actual hardware? I went through this (https://oslongjourney.github.io/linux-kernel/experiment-one-iio-dummy/) tutorial so I was able to load iio_simple_dummy driver, create and inspect some dummy devices. Now, as Jonathan has asked me, I would like to test ad5933 driver on an EVAL-AD5933 board which was donated to FLUSP (https://flusp.ime.usp.br/). So far I've been hesitating to plug this device on my Debian distro since this (https://www.analog.com/media/en/technical-documentation/user-guides/UG-364.pdf) user guide for Windows says not to connect it before driver installation. Is there something that could harm the board if plugged on a computer without a proper driver? I also didn't understand the hardware configuration showed on this (https://wiki.analog.com/resources/tools-software/linux-drivers/iio-impedance-analyzer/ad5933) page. Any advice will be greatly appreciated. Thanks in advance, Marcelo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: comedi: ni_mio_common.c: Added blank line after declarations
Added blank line after declarations. Signed-off-by: Arash Fotouhi --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 5edf59a..c6aff8f 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2110,6 +2110,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->scan_begin_src == TRIG_TIMER) { unsigned int tmp = cmd->scan_begin_arg; + cmd->scan_begin_arg = ni_timer_to_ns(dev, ni_ns_to_timer(dev, cmd->scan_begin_arg, @@ -2120,6 +2121,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->convert_src == TRIG_TIMER) { if (!devpriv->is_611x && !devpriv->is_6143) { unsigned int tmp = cmd->convert_arg; + cmd->convert_arg = ni_timer_to_ns(dev, ni_ns_to_timer(dev, cmd->convert_arg, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: v5.1-rc1 binder_alloc_do_buffer_copy() BUG_ON triggered by selinux-testsuite
On Thu, Mar 21, 2019 at 11:48 AM Todd Kjos wrote: > On Thu, Mar 21, 2019 at 2:50 AM Ondrej Mosnacek wrote: > > > > On Thu, Mar 21, 2019 at 12:26 AM Todd Kjos wrote: > > > I can send you a patch tomorrow (I won't be able to test it though). > > > > So, I was a bit quicker than you and I think I managed to fix the test > > myself :) > > > > See: > > https://github.com/SELinuxProject/selinux-testsuite/pull/50/commits/b559c3f54eae6130cb9e79c295b0f94db26e09e4 > > Looks good. Thanks! I'm getting clean runs on my test system now too - thanks everyone! -- paul moore www.paul-moore.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] staging: iio: ad7780: Add parentheses to macros
On Wed, Mar 20, 2019 at 10:42:17AM +0300, Dan Carpenter wrote: > On Sun, Mar 17, 2019 at 11:53:12PM +0300, Vladimir Petrigo wrote: > > - Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to > > avoid precedence issues > > - Fix CHECK Macro argument reuse 'bits' - possible side-effects? > > > > Signed-off-by: Vladimir Petrigo > > --- > > drivers/staging/iio/adc/ad7780.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/iio/adc/ad7780.c > > b/drivers/staging/iio/adc/ad7780.c > > index c4a8578..2dfd6f8 100644 > > --- a/drivers/staging/iio/adc/ad7780.c > > +++ b/drivers/staging/iio/adc/ad7780.c > > @@ -142,7 +142,7 @@ static const struct ad_sigma_delta_info > > ad7780_sigma_delta_info = { > > }; > > > > #define AD7780_CHANNEL(bits, wordsize) \ > > - AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, wordsize - bits) > > + AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, (bits), 32, ((wordsize) - (bits))) > ^^ > These parentheses are not required. > > This doesn't fix the "argument reuse" issue... It's not a reall issue > though, and it isn't like this a core macro so it doesn't really matter > too much. > > regards, > dan carpenter > Thank you for the reply. I'll get rid of that parentheses in the v2 Best regards, Vladimir Petrigo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] staging: iio: ad7280a: Add parentheses to macros
On Wed, Mar 20, 2019 at 10:38:06AM +0300, Dan Carpenter wrote: > On Sun, Mar 17, 2019 at 11:53:11PM +0300, Vladimir Petrigo wrote: > > Fix CHECK Macro argument 'c' may be better as '(c)' to > > avoid precedence issues > > > > Signed-off-by: Vladimir Petrigo > > > > diff --git a/drivers/staging/iio/adc/ad7280a.c > > b/drivers/staging/iio/adc/ad7280a.c index d9df126..98cf876 > > 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ > > b/drivers/staging/iio/adc/ad7280a.c @@ -97,9 +97,9 @@ > > #define AD7280A_NUM_CH (AD7280A_AUX_ADC_6 - \ > > AD7280A_CELL_VOLTAGE_1 > > + 1) > > > > -#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d * > > AD7280A_CELLS_PER_DEV) + c) -#define > > AD7280A_CALC_TEMP_CHAN_NUM(d, c) ((d * > > AD7280A_CELLS_PER_DEV) + \ - c - AD7280A_CELLS_PER_DEV) > > +#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) (((d) * > > AD7280A_CELLS_PER_DEV) + (c)) +#define > > AD7280A_CALC_TEMP_CHAN_NUM(d, c) (((d) * > > AD7280A_CELLS_PER_DEV) + \ + (c) - AD7280A_CELLS_PER_DEV) > > > > #define AD7280A_DEVADDR_MASTER 0 define > > #AD7280A_DEVADDR_ALL 0x1F > > I don't know how this diff got added to the commit message, but > obviously we don't want that. > > regards, > dan carpenter > > > --- > > drivers/staging/iio/adc/ad7280a.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/staging/iio/adc/ad7280a.c > > b/drivers/staging/iio/adc/ad7280a.c > > index d9df126..98cf876 100644 > > --- a/drivers/staging/iio/adc/ad7280a.c > > +++ b/drivers/staging/iio/adc/ad7280a.c > > @@ -97,9 +97,9 @@ > > #define AD7280A_NUM_CH (AD7280A_AUX_ADC_6 - \ > > AD7280A_CELL_VOLTAGE_1 + 1) > > > > -#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d * AD7280A_CELLS_PER_DEV) + > > c) > > -#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)((d * AD7280A_CELLS_PER_DEV) + > > \ > > -c - AD7280A_CELLS_PER_DEV) > > +#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) (((d) * AD7280A_CELLS_PER_DEV) > > + (c)) > > +#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)(((d) * AD7280A_CELLS_PER_DEV) > > + \ > > +(c) - AD7280A_CELLS_PER_DEV) > > > > #define AD7280A_DEVADDR_MASTER 0 > > #define AD7280A_DEVADDR_ALL0x1F > > -- > > 2.7.4 > > > > ___ > > devel mailing list > > de...@linuxdriverproject.org > > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel Yes, something went wrong, will fix that in the v2. Best regards, Vladimir Petrigo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/2] staging: iio: adc: Fix code formatting issues
v1 -> v2 - remove redundant patch for the ad7192.c - fix the issue with diff for the ad7280a.c - fix the redundant parentheses in the patch for ad7780.c Vladimir Petrigo (2): staging: iio: ad7280a: Add parentheses to macros staging: iio: ad7780: Add parentheses to macros drivers/staging/iio/adc/ad7280a.c | 6 +++--- drivers/staging/iio/adc/ad7780.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros
- Fix CHECK Macro argument 'c' may be better as '(c)' to avoid precedence issues - Fix CHECK Macro argument 'd' may be better as '(d)' to avoid precedence issues Signed-off-by: Vladimir Petrigo --- drivers/staging/iio/adc/ad7280a.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index d9df126..98cf876 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -97,9 +97,9 @@ #define AD7280A_NUM_CH (AD7280A_AUX_ADC_6 - \ AD7280A_CELL_VOLTAGE_1 + 1) -#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d * AD7280A_CELLS_PER_DEV) + c) -#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)((d * AD7280A_CELLS_PER_DEV) + \ -c - AD7280A_CELLS_PER_DEV) +#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) (((d) * AD7280A_CELLS_PER_DEV) + (c)) +#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)(((d) * AD7280A_CELLS_PER_DEV) + \ +(c) - AD7280A_CELLS_PER_DEV) #define AD7280A_DEVADDR_MASTER 0 #define AD7280A_DEVADDR_ALL0x1F -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/2] staging: iio: ad7780: Add parentheses to macros
- Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues Signed-off-by: Vladimir Petrigo --- drivers/staging/iio/adc/ad7780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index c4a8578..010fb47 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -142,7 +142,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = { }; #define AD7780_CHANNEL(bits, wordsize) \ - AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, wordsize - bits) + AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, (wordsize) - (bits)) static const struct ad7780_chip_info ad7780_chip_info_tbl[] = { [ID_AD7170] = { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] staging: erofs: Use !x or x in place of NULL comparision
From: Bhanusree Pola Test for NULL as !x instead of NULL comparisions. Issue found using coccinelle Semantic patch used to solve the problem is as follows // @@ expression x; statement S; @@ x = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\| usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...)); -if(x==NULL) +if(!x) S @@ expression e; @@ -e == NULL +!e // Signed-off-by: Bhanusree Pola [ Gao Xiang: fix x != NULL comparision to x as well. ] Signed-off-by: Gao Xiang --- change log v3: - based on Bhanusree's patch; - rebase code and fix x != NULL comparision to x as well. drivers/staging/erofs/inode.c | 4 ++-- drivers/staging/erofs/internal.h | 6 +++--- drivers/staging/erofs/super.c | 2 +- drivers/staging/erofs/unzip_pagevec.h | 6 +++--- drivers/staging/erofs/utils.c | 2 +- drivers/staging/erofs/xattr.c | 16 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/erofs/inode.c b/drivers/staging/erofs/inode.c index 2df096afe91f..c7d3b815a798 100644 --- a/drivers/staging/erofs/inode.c +++ b/drivers/staging/erofs/inode.c @@ -129,7 +129,7 @@ static int fill_inline_data(struct inode *inode, void *data, if (S_ISLNK(inode->i_mode) && inode->i_size < PAGE_SIZE) { char *lnk = erofs_kmalloc(sbi, inode->i_size + 1, GFP_KERNEL); - if (unlikely(lnk == NULL)) + if (unlikely(!lnk)) return -ENOMEM; m_pofs += vi->inode_isize + vi->xattr_isize; @@ -265,7 +265,7 @@ struct inode *erofs_iget(struct super_block *sb, { struct inode *inode = erofs_iget_locked(sb, nid); - if (unlikely(inode == NULL)) + if (unlikely(!inode)) return ERR_PTR(-ENOMEM); if (inode->i_state & I_NEW) { diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h index e3bfde00c7d2..1286b98ffd0a 100644 --- a/drivers/staging/erofs/internal.h +++ b/drivers/staging/erofs/internal.h @@ -469,7 +469,7 @@ erofs_grab_bio(struct super_block *sb, do { if (nr_pages == 1) { bio = bio_alloc(gfp | (nofail ? __GFP_NOFAIL : 0), 1); - if (unlikely(bio == NULL)) { + if (unlikely(!bio)) { DBG_BUGON(nofail); return ERR_PTR(-ENOMEM); } @@ -477,7 +477,7 @@ erofs_grab_bio(struct super_block *sb, } bio = bio_alloc(gfp, nr_pages); nr_pages /= 2; - } while (unlikely(bio == NULL)); + } while (unlikely(!bio)); bio->bi_end_io = endio; bio_set_dev(bio, sb->s_bdev); @@ -565,7 +565,7 @@ static inline void *erofs_vmap(struct page **pages, unsigned int count) while (1) { void *addr = vm_map_ram(pages, count, -1, PAGE_KERNEL); /* retry two more times (totally 3 times) */ - if (addr != NULL || ++i >= 3) + if (addr || ++i >= 3) return addr; vm_unmap_aliases(); } diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c index 40766519b443..7b460a3ca4d6 100644 --- a/drivers/staging/erofs/super.c +++ b/drivers/staging/erofs/super.c @@ -240,7 +240,7 @@ static int parse_options(struct super_block *sb, char *options) if (!options) return 0; - while ((p = strsep(&options, ",")) != NULL) { + while ((p = strsep(&options, ","))) { int token; if (!*p) diff --git a/drivers/staging/erofs/unzip_pagevec.h b/drivers/staging/erofs/unzip_pagevec.h index 23856ba2742d..f37d8fd14771 100644 --- a/drivers/staging/erofs/unzip_pagevec.h +++ b/drivers/staging/erofs/unzip_pagevec.h @@ -43,7 +43,7 @@ struct z_erofs_pagevec_ctor { static inline void z_erofs_pagevec_ctor_exit(struct z_erofs_pagevec_ctor *ctor, bool atomic) { - if (ctor->curr == NULL) + if (!ctor->curr) return; if (atomic) @@ -59,7 +59,7 @@ z_erofs_pagevec_ctor_next_page(struct z_erofs_pagevec_ctor *ctor, unsigned index; /* keep away from occupied pages */ - if (ctor->next != NULL) + if (ctor->next) return ctor->next; for (index = 0; index < nr; ++index) { @@ -121,7 +121,7 @@ z_erofs_pagevec_ctor_enqueue(struct z_erofs_pagevec_ctor *ctor, bool *occupied) { *occupied = false; - if (unlikely(ctor->next == NULL && type)) + if (unlikely(!ctor->next && type)) if (ctor->index + 1 == ctor->nr) return false; diff --git a/drivers/staging/erofs/utils.c b/drivers/staging/erofs/utils.c index f1725c2c45ea..3e7d30b6de1d 100644 --- a/drivers/staging/erofs/utils.c +++ b/drivers/staging/erofs/utils.c @@ -61,7 +61,7 @@
Re: [PATCH 1/3] staging: erofs: fix error handling when failed to read compresssed data
ping? Hi Chao, could you take some time looking into this series? Thanks, Gao Xiang On 2019/3/19 21:54, Gao Xiang wrote: > Complete read error handling paths for all three kinds of > compressed pages: > > 1) For cache-managed pages, PG_uptodate will be checked since > read_endio will unlock and SetPageUptodate for these pages; > > 2) For inplaced pages, read_endio cannot SetPageUptodate directly > since it should be used to mark the final decompressed data, > PG_error will be set with page locked for IO error instead; > > 3) For staging pages, PG_error is used, which is similar to > what we do for inplaced pages. > > Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") > Cc: # 4.19+ > Signed-off-by: Gao Xiang > --- > > This series focus on fixing error handling when failed to read > compresssed data due to previous incomplete paths. > > In addition, the last 2 patches add IO error fault injection > for reading paths, which I have used to test the first patch as well. > > Thanks, > Gao Xiang > > drivers/staging/erofs/unzip_vle.c | 41 > ++- > 1 file changed, 28 insertions(+), 13 deletions(-) > > diff --git a/drivers/staging/erofs/unzip_vle.c > b/drivers/staging/erofs/unzip_vle.c > index 8715bc50e09c..3416d3f10324 100644 > --- a/drivers/staging/erofs/unzip_vle.c > +++ b/drivers/staging/erofs/unzip_vle.c > @@ -972,6 +972,7 @@ static int z_erofs_vle_unzip(struct super_block *sb, > overlapped = false; > compressed_pages = grp->compressed_pages; > > + err = 0; > for (i = 0; i < clusterpages; ++i) { > unsigned int pagenr; > > @@ -981,26 +982,39 @@ static int z_erofs_vle_unzip(struct super_block *sb, > DBG_BUGON(!page); > DBG_BUGON(!page->mapping); > > - if (z_erofs_is_stagingpage(page)) > - continue; > + if (!z_erofs_is_stagingpage(page)) { > #ifdef EROFS_FS_HAS_MANAGED_CACHE > - if (page->mapping == MNGD_MAPPING(sbi)) { > - DBG_BUGON(!PageUptodate(page)); > - continue; > - } > + if (page->mapping == MNGD_MAPPING(sbi)) { > + if (unlikely(!PageUptodate(page))) > + err = -EIO; > + continue; > + } > #endif > > - /* only non-head page could be reused as a compressed page */ > - pagenr = z_erofs_onlinepage_index(page); > + /* > + * only if non-head page can be selected > + * for inplace decompression > + */ > + pagenr = z_erofs_onlinepage_index(page); > > - DBG_BUGON(pagenr >= nr_pages); > - DBG_BUGON(pages[pagenr]); > - ++sparsemem_pages; > - pages[pagenr] = page; > + DBG_BUGON(pagenr >= nr_pages); > + DBG_BUGON(pages[pagenr]); > + ++sparsemem_pages; > + pages[pagenr] = page; > + > + overlapped = true; > + } > > - overlapped = true; > + /* PG_error needs checking for inplaced and staging pages */ > + if (unlikely(PageError(page))) { > + DBG_BUGON(PageUptodate(page)); > + err = -EIO; > + } > } > > + if (unlikely(err)) > + goto out; > + > llen = (nr_pages << PAGE_SHIFT) - work->pageofs; > > if (z_erofs_vle_workgrp_fmt(grp) == Z_EROFS_VLE_WORKGRP_FMT_PLAIN) { > @@ -1194,6 +1208,7 @@ pickup_page_for_submission(struct z_erofs_vle_workgroup > *grp, > if (page->mapping == mc) { > WRITE_ONCE(grp->compressed_pages[nr], page); > > + ClearPageError(page); > if (!PagePrivate(page)) { > /* >* impossible to be !PagePrivate(page) for > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Spende
-- Mein Name ist Victoria, Kronprinzessin von Schweden, und ich spende Ihnen und Ihrer Familie 750.000 USD. Kommen Sie mit dieser E-Mail zu mir: victoriacrownprincessofswe...@gmail.com für andere Richtlinien. Schöne Grüße. Victoria, Kronprinzessin von Schweden, Herzogin von Västergötland ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel