[PATCH net-next 4/5] hv_netvsc: pass struct net_device to rndis_filter_set_device_mac()
We unpack 'struct net_device' in netvsc_set_mac_addr() to get to 'struct hv_device' pointer which we use in rndis_filter_set_device_mac() to get back to 'struct net_device'. Signed-off-by: Vitaly Kuznetsov --- drivers/net/hyperv/hyperv_net.h | 2 +- drivers/net/hyperv/netvsc_drv.c | 4 +--- drivers/net/hyperv/rndis_filter.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index f650ec1..467fb8b 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -201,7 +201,7 @@ int rndis_filter_receive(struct hv_device *dev, struct vmbus_channel *channel); int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter); -int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac); +int rndis_filter_set_device_mac(struct net_device *ndev, char *mac); void netvsc_switch_datapath(struct net_device *nv_dev, bool vf); diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 591ab58..733dea1 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -982,8 +982,6 @@ static struct rtnl_link_stats64 *netvsc_get_stats64(struct net_device *net, static int netvsc_set_mac_addr(struct net_device *ndev, void *p) { - struct net_device_context *ndevctx = netdev_priv(ndev); - struct hv_device *hdev = ndevctx->device_ctx; struct sockaddr *addr = p; char save_adr[ETH_ALEN]; unsigned char save_aatype; @@ -996,7 +994,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p) if (err != 0) return err; - err = rndis_filter_set_device_mac(hdev, addr->sa_data); + err = rndis_filter_set_device_mac(ndev, addr->sa_data); if (err != 0) { /* roll back to saved MAC */ memcpy(ndev->dev_addr, save_adr, ETH_ALEN); diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 2c2f3b9..f1692bc 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -543,9 +543,8 @@ static int rndis_filter_query_device_mac(struct rndis_device *dev) #define NWADR_STR "NetworkAddress" #define NWADR_STRLEN 14 -int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac) +int rndis_filter_set_device_mac(struct net_device *ndev, char *mac) { - struct net_device *ndev = hv_get_drvdata(hdev); struct netvsc_device *nvdev = net_device_to_netvsc_device(ndev); struct rndis_device *rdev = nvdev->extension; struct rndis_request *request; -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Dear Internet User
PLAZA DE CASTRE E-28830, MADRID, SPAIN Tel: 0034-698-238-766 Fax: 0034-911-881-416 Ref Number: PLATUK/9GM/327739 Batch Number: PLAT-ENGINE08920 Dear Internet User, FINAL AWARD NOTIFICATIONS!!! We congratulate you over your success in the following official publication of results of the E-mail electronic online Sweepstakes organized by Microsoft Google Online Award 2016 Held in Madrid Spain on 18th April 2016. Your email ID has won the total sum of Ђ1,810.000.00 (ONE MILLION EIGHT HUNDRED AND FIFTEEN THOUSAND EUROS ONLY), during the electronic E-mail online Power ball Draws For Internet Users. Microsoft Corporation organize this promotion offer in order to compensate consumers of the product in the world at large for their infinite supports towards the growth of the company. The claim agent will attend to your claim upon the receipt of your response. Contact Dr, Pablo Sanchez (Claims Agent) the Foreign Affairs manager of MAPFRE SEGUROS S.A. Tel +34-603-255-976, Email: mapfreseguros...@yahoo.com To begin your claim with the agent requires your details mentioned below in order to process your claim for immediate payment with the Spainish bank (1) Name (2) Address (3) Date of Birth (4) Occupation (5) Tel Nє (6) Ref Nє Congratulation once again. Thank you. Madam, Julia Gomez Responder --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next 0/5] hv_netvsc: cleanup after untangling the pointer mess
After we made traveling through our internal structures explicit it became obvious that some functions take arguments they don't need just to do redundant pointer travel and get to what they really need while their callers already have the required information. This is just a cleanup series with no functional changes intended. It doesn't pretend to be complete, additional cleanup of other functions may follow. Vitaly Kuznetsov (5): hv_netvsc: remove redundant assignment in netvsc_recv_callback() hv_netvsc: introduce {net,hv}_device_to_netvsc_device() helpers hv_netvsc: pass struct netvsc_device to rndis_filter_{open,close}() hv_netvsc: pass struct net_device to rndis_filter_set_device_mac() hv_netvsc: pass struct net_device to rndis_filter_set_offload_params() drivers/net/hyperv/hyperv_net.h | 19 +++--- drivers/net/hyperv/netvsc.c | 11 +++--- drivers/net/hyperv/netvsc_drv.c | 18 ++--- drivers/net/hyperv/rndis_filter.c | 42 --- 4 files changed, 38 insertions(+), 52 deletions(-) -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 23/24] Documentation: Move visorbus documentation from staging to Documentation/
This patch simple does a git mv of the drivers/staging/unisys/Documentation directory to Documentation. Renames overview.txt to visorbus.txt and renames sysfs-platform-visorchipset to the correct name sysfs-bus-visorbus. Signed-off-by: David Kershner --- .../ABI/stable/sysfs-bus-visorbus | 0 .../unisys/Documentation/overview.txt => Documentation/visorbus.txt | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset => Documentation/ABI/stable/sysfs-bus-visorbus (100%) rename drivers/staging/unisys/Documentation/overview.txt => Documentation/visorbus.txt (100%) diff --git a/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset b/Documentation/ABI/stable/sysfs-bus-visorbus similarity index 100% rename from drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset rename to Documentation/ABI/stable/sysfs-bus-visorbus diff --git a/drivers/staging/unisys/Documentation/overview.txt b/Documentation/visorbus.txt similarity index 100% rename from drivers/staging/unisys/Documentation/overview.txt rename to Documentation/visorbus.txt -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/5] staging: media: lirc: use new parport device model
On Monday 25 January 2016 10:42 PM, Mauro Carvalho Chehab wrote: Em Mon, 25 Jan 2016 22:32:31 +0530 Sudip Mukherjee escreveu: On Mon, Jan 25, 2016 at 02:29:06PM -0200, Mauro Carvalho Chehab wrote: Em Fri, 18 Dec 2015 18:35:29 +0530 Sudip Mukherjee escreveu: Modify lirc_parallel driver to use the new parallel port device model. Did you or someone else tested this patch? Only build tested and tested by inserting and removing the module. But since the only change is in the way it registers and nothing else so it should not break. It would be worth to wait for a while in the hope that someone could test with a real hardware. Hi Mauro, Since no one has commented on the patch till now, maybe you can merge now, or do i need to resend? Regards Sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH] posix acls: Move namespace conversion into filesystem / xattr handlers
> On 2016/05/23, 15:06, "James Simmons" wrote: > > > >> Currently, getxattr() and setxattr() check for the xattr names > >> "system.posix_acl_{access,default}" and perform in-place UID / GID > >> namespace mappings in the xattr values. Filesystems then again check for > >> the same xattr names to handle those attributes, almost always using the > >> standard posix_acl_{access,default}_xattr_handler handlers. This is > >> unnecessary overhead; move the namespace conversion into the xattr > >> handlers instead. > >> > >> For filesystems that use the POSIX ACL xattr handlers, no change is > >> required. Filesystems that don't use those handlers (cifs and lustre) > >> need to take care of the namespace mapping themselves now. > >> > >> The only user left of the posix_acl_fix_xattr_{from,to}_user helpers is > >> lustre, so this patch moves them into lustre. > >> > >> Signed-off-by: Andreas Gruenbacher > >> --- > >> > >> I'm reasonably confident about the core and cifs changes in this patch. > >> The lustre code is pretty weird though, so could I please get a careful > >> review on the changes there? > > > >Nak on the Lustre changes. POSIX ACLs are also handled in mdc_request.c. > >Besides POSIX ACLs lustre has created a extended ACL as well that is > >grouped in with posix ACL handling. This extended ACL is like POSIX acls > >except it also contains the state (deleted, modified, ...) of the ACL. > >Besides normal local access control list handling Lustre manages remote > >access control list handling. You can read about this handling is in > >llite_rmtacl.c. This code was written long before I became involved with > >lustre so the exact details are fuzzy to me. > > James, > the remote ACL code never found any usage in the field and can be > deleted. Please see http://review.whamcloud.com/19789 for details. That is a huge cleanup which will make Greg very happy. The tools and test are going to be updated so the landing has to be just right so we don't have a flood of test failures. Gruenbacher with the 19789 patch Dilger pointed out Lustre's POSIX ACL code just becomes ordinary which means we can use the default POSIS xattr handler. You wouldn't have to keep posix_acl.c around with these changes. > Cheers, Andreas > > > The guts of this are handled is located at: > > > >drivers/staging/lustre/lustre/obdclass/acl.c > > > >P.S > > > >A you probably have noticed Lustre has had an uptick in development > >which means the code is now changing all the time in staging. How should > >we handle the changes you are working in your own trees verses what is > >happing in staging. For example I'm looking at moving lustre to the > >xattr_handles. Should I push it to you and wait until it works it way > >into Greg's tree. What do the merge schedules look like. Lastly the > >a_refcount for the POSIX acl changed with your xattr updates which now > >causes lustre to crash :-( > > > >> Thanks, > >> Andreas > >> > >> drivers/staging/lustre/lustre/llite/Makefile | 1 + > >> .../staging/lustre/lustre/llite/llite_internal.h | 3 ++ > >> drivers/staging/lustre/lustre/llite/posix_acl.c| 62 > >> ++ > >> drivers/staging/lustre/lustre/llite/xattr.c| 8 ++- > >> fs/cifs/cifssmb.c | 41 ++ > >> fs/posix_acl.c | 62 > >> +- > >> fs/xattr.c | 7 --- > >> include/linux/posix_acl_xattr.h| 12 - > >> 8 files changed, 107 insertions(+), 89 deletions(-) > >> create mode 100644 drivers/staging/lustre/lustre/llite/posix_acl.c > >> > >> diff --git a/drivers/staging/lustre/lustre/llite/Makefile > >> b/drivers/staging/lustre/lustre/llite/Makefile > >> index 2ce10ff..67125f8 100644 > >> --- a/drivers/staging/lustre/lustre/llite/Makefile > >> +++ b/drivers/staging/lustre/lustre/llite/Makefile > >> @@ -7,5 +7,6 @@ lustre-y := dcache.o dir.o file.o llite_close.o > >> llite_lib.o llite_nfs.o \ > >>glimpse.o lcommon_cl.o lcommon_misc.o \ > >>vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o vvp_req.o \ > >>lproc_llite.o > >> +lustre-$(CONFIG_FS_POSIX_ACL) += posix_acl.o > >> > >> llite_lloop-y := lloop.o > >> diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h > >> b/drivers/staging/lustre/lustre/llite/llite_internal.h > >> index ce1f949..d454dfb 100644 > >> --- a/drivers/staging/lustre/lustre/llite/llite_internal.h > >> +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h > >> @@ -1402,4 +1402,7 @@ int cl_local_size(struct inode *inode); > >> __u64 cl_fid_build_ino(const struct lu_fid *fid, int api32); > >> __u32 cl_fid_build_gen(const struct lu_fid *fid); > >> > >> +void posix_acl_fix_xattr_from_user(void *value, size_t size); > >> +void posix_acl_fix_xattr_to_user(void *value, size_t size); > >> + > >> #endif /* LLITE_INTERNAL_H */ > >> diff --git a/drivers/stag
[PATCH] Drivers: hv: avoid vfree() on crash
When we crash from NMI context (e.g. after NMI injection from host when 'sysctl -w kernel.unknown_nmi_panic=1' is set) we hit kernel BUG at mm/vmalloc.c:1530! as vfree() is denied. While the issue could be solved with in_nmi() check instead I opted for skipping vfree on all sorts of crashes to reduce the amount of work which can cause consequent crashes. We don't really need to free anything on crash. Signed-off-by: Vitaly Kuznetsov --- drivers/hv/hv.c | 8 +--- drivers/hv/hyperv_vmbus.h | 2 +- drivers/hv/vmbus_drv.c| 8 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index a1c086b..60dbd6c 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -278,7 +278,7 @@ cleanup: * * This routine is called normally during driver unloading or exiting. */ -void hv_cleanup(void) +void hv_cleanup(bool crash) { union hv_x64_msr_hypercall_contents hypercall_msr; @@ -288,7 +288,8 @@ void hv_cleanup(void) if (hv_context.hypercall_page) { hypercall_msr.as_uint64 = 0; wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); - vfree(hv_context.hypercall_page); + if (!crash) + vfree(hv_context.hypercall_page); hv_context.hypercall_page = NULL; } @@ -308,7 +309,8 @@ void hv_cleanup(void) hypercall_msr.as_uint64 = 0; wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64); - vfree(hv_context.tsc_page); + if (!crash) + vfree(hv_context.tsc_page); hv_context.tsc_page = NULL; } #endif diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 718b5c7..dfa9fac 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -495,7 +495,7 @@ struct hv_ring_buffer_debug_info { extern int hv_init(void); -extern void hv_cleanup(void); +extern void hv_cleanup(bool crash); extern int hv_post_message(union hv_connection_id connection_id, enum hv_message_type message_type, diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 952f20f..d11690e 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -871,7 +871,7 @@ err_alloc: bus_unregister(&hv_bus); err_cleanup: - hv_cleanup(); + hv_cleanup(false); return ret; } @@ -1323,7 +1323,7 @@ static void hv_kexec_handler(void) vmbus_initiate_unload(false); for_each_online_cpu(cpu) smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1); - hv_cleanup(); + hv_cleanup(false); }; static void hv_crash_handler(struct pt_regs *regs) @@ -1335,7 +1335,7 @@ static void hv_crash_handler(struct pt_regs *regs) * for kdump. */ hv_synic_cleanup(NULL); - hv_cleanup(); + hv_cleanup(true); }; static int __init hv_acpi_init(void) @@ -1395,7 +1395,7 @@ static void __exit vmbus_exit(void) &hyperv_panic_block); } bus_unregister(&hv_bus); - hv_cleanup(); + hv_cleanup(false); for_each_online_cpu(cpu) { tasklet_kill(hv_context.event_dpc[cpu]); smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1); -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next 1/5] hv_netvsc: remove redundant assignment in netvsc_recv_callback()
net_device_ctx is assigned in the very beginning of the function and 'net' pointer doesn't change. Signed-off-by: Vitaly Kuznetsov --- drivers/net/hyperv/netvsc_drv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 6a69b5c..db8fedf 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -701,7 +701,6 @@ int netvsc_recv_callback(struct hv_device *device_obj, } vf_injection_done: - net_device_ctx = netdev_priv(net); rx_stats = this_cpu_ptr(net_device_ctx->rx_stats); /* Allocate a skb - TODO direct I/O to pages? */ -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next 5/5] hv_netvsc: pass struct net_device to rndis_filter_set_offload_params()
The only caller rndis_filter_device_add() has 'struct net_device' pointer already. Signed-off-by: Vitaly Kuznetsov --- drivers/net/hyperv/rndis_filter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index f1692bc..979fa44 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -620,10 +620,9 @@ cleanup: } static int -rndis_filter_set_offload_params(struct hv_device *hdev, +rndis_filter_set_offload_params(struct net_device *ndev, struct ndis_offload_params *req_offloads) { - struct net_device *ndev = hv_get_drvdata(hdev); struct netvsc_device *nvdev = net_device_to_netvsc_device(ndev); struct rndis_device *rdev = nvdev->extension; struct rndis_request *request; @@ -1083,7 +1082,7 @@ int rndis_filter_device_add(struct hv_device *dev, offloads.lso_v2_ipv4 = NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; - ret = rndis_filter_set_offload_params(dev, &offloads); + ret = rndis_filter_set_offload_params(net, &offloads); if (ret) goto err_dev_remv; -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] Staging: rdma: hfi1: rc.c: Fixed coding style issues
On Mon, May 23, 2016 at 12:06:01PM +0530, Shyam Saini wrote: Fixed following checkpatch.pl warnings: Prefer 'unsigned int' to bare use of 'unsigned' Prefer READ_ONCE() over ACCESS_ONCE() In general please don't fix two types of issues in the same patch. Also, as to the unsinged -> unsigned int, the linux-rdma maintainer has already said we don't really want all of the code churn for this [1]. I suggest to respin this patch with just the ACCESS_ONCE->READ_ONCE change so that can be reviewed on it's own. [1] http://marc.info/?l=linux-rdma&m=146308474205407&w=2 -Denny ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next 2/5] hv_netvsc: introduce {net, hv}_device_to_netvsc_device() helpers
Make it easier to get 'struct netvsc_device' from 'struct net_device' and 'struct hv_device' by introducing inline helpers. Signed-off-by: Vitaly Kuznetsov --- drivers/net/hyperv/hyperv_net.h | 12 drivers/net/hyperv/netvsc.c | 11 +++ drivers/net/hyperv/rndis_filter.c | 24 +++- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index c270c5a..952cbc8 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -743,6 +743,18 @@ struct netvsc_device { atomic_t vf_use_cnt; }; +static inline struct netvsc_device * +net_device_to_netvsc_device(struct net_device *ndev) +{ + return ((struct net_device_context *)netdev_priv(ndev))->nvdev; +} + +static inline struct netvsc_device * +hv_device_to_netvsc_device(struct hv_device *device) +{ + return net_device_to_netvsc_device(hv_get_drvdata(device)); +} + /* NdisInitialize message */ struct rndis_initialize_request { u32 req_id; diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 719cb35..96f00c0 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -95,9 +95,7 @@ static void free_netvsc_device(struct netvsc_device *nvdev) static struct netvsc_device *get_outbound_net_device(struct hv_device *device) { - struct net_device *ndev = hv_get_drvdata(device); - struct net_device_context *net_device_ctx = netdev_priv(ndev); - struct netvsc_device *net_device = net_device_ctx->nvdev; + struct netvsc_device *net_device = hv_device_to_netvsc_device(device); if (net_device && net_device->destroy) net_device = NULL; @@ -107,9 +105,7 @@ static struct netvsc_device *get_outbound_net_device(struct hv_device *device) static struct netvsc_device *get_inbound_net_device(struct hv_device *device) { - struct net_device *ndev = hv_get_drvdata(device); - struct net_device_context *net_device_ctx = netdev_priv(ndev); - struct netvsc_device *net_device = net_device_ctx->nvdev; + struct netvsc_device *net_device = hv_device_to_netvsc_device(device); if (!net_device) goto get_in_err; @@ -128,8 +124,7 @@ static int netvsc_destroy_buf(struct hv_device *device) struct nvsp_message *revoke_packet; int ret = 0; struct net_device *ndev = hv_get_drvdata(device); - struct net_device_context *net_device_ctx = netdev_priv(ndev); - struct netvsc_device *net_device = net_device_ctx->nvdev; + struct netvsc_device *net_device = net_device_to_netvsc_device(ndev); /* * If we got a section count, it means we received a diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 97c292b..42c652e 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -546,8 +546,7 @@ static int rndis_filter_query_device_mac(struct rndis_device *dev) int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac) { struct net_device *ndev = hv_get_drvdata(hdev); - struct net_device_context *net_device_ctx = netdev_priv(ndev); - struct netvsc_device *nvdev = net_device_ctx->nvdev; + struct netvsc_device *nvdev = net_device_to_netvsc_device(ndev); struct rndis_device *rdev = nvdev->extension; struct rndis_request *request; struct rndis_set_request *set; @@ -626,8 +625,7 @@ rndis_filter_set_offload_params(struct hv_device *hdev, struct ndis_offload_params *req_offloads) { struct net_device *ndev = hv_get_drvdata(hdev); - struct net_device_context *net_device_ctx = netdev_priv(ndev); - struct netvsc_device *nvdev = net_device_ctx->nvdev; + struct netvsc_device *nvdev = net_device_to_netvsc_device(ndev); struct rndis_device *rdev = nvdev->extension; struct rndis_request *request; struct rndis_set_request *set; @@ -851,8 +849,7 @@ static int rndis_filter_init_device(struct rndis_device *dev) u32 status; int ret; unsigned long t; - struct net_device_context *net_device_ctx = netdev_priv(dev->ndev); - struct netvsc_device *nvdev = net_device_ctx->nvdev; + struct netvsc_device *nvdev = net_device_to_netvsc_device(dev->ndev); request = get_rndis_request(dev, RNDIS_MSG_INIT, RNDIS_MESSAGE_SIZE(struct rndis_initialize_request)); @@ -977,8 +974,7 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc) { struct net_device *ndev = hv_get_drvdata(new_sc->primary_channel->device_obj); - struct net_device_context *net_device_ctx = netdev_priv(ndev); - struct netvsc_device *nvscdev = net_device_ctx->nvdev; + struct netvsc_device *nvscdev = net_device_to_netvsc_device(ndev); u16 chn_index = new_sc->offermsg.offer.s
[PATCH 10/24] staging: unisys: visorbus: Make visordriver_callback_lock a mutex
From: Bryan Thompson visordriver_callback_lock is just a binary semaphore that logically makes more sense as a mutex. Signed-off-by: Bryan Thompson Signed-off-by: David Kershner --- drivers/staging/unisys/include/visorbus.h | 3 ++- drivers/staging/unisys/visorbus/visorbus_main.c | 10 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 9bb88bb..9da25c0 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -161,7 +161,8 @@ struct visor_device { struct timer_list timer; bool timer_active; bool being_removed; - struct semaphore visordriver_callback_lock; + /* mutex to serialize visor_driver function callbacks */ + struct mutex visordriver_callback_lock; bool pausing; bool resuming; u32 chipset_bus_no; diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 24b27ff..44609ee 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -574,7 +574,7 @@ visordriver_probe_device(struct device *xdev) if (!drv->probe) return -ENODEV; - down(&dev->visordriver_callback_lock); + mutex_lock(&dev->visordriver_callback_lock); dev->being_removed = false; res = drv->probe(dev); @@ -584,7 +584,7 @@ visordriver_probe_device(struct device *xdev) fix_vbus_dev_info(dev); } - up(&dev->visordriver_callback_lock); + mutex_unlock(&dev->visordriver_callback_lock); return res; } @@ -600,11 +600,11 @@ visordriver_remove_device(struct device *xdev) dev = to_visor_device(xdev); drv = to_visor_driver(xdev->driver); - down(&dev->visordriver_callback_lock); + mutex_lock(&dev->visordriver_callback_lock); dev->being_removed = true; if (drv->remove) drv->remove(dev); - up(&dev->visordriver_callback_lock); + mutex_unlock(&dev->visordriver_callback_lock); dev_stop_periodic_work(dev); put_device(&dev->device); @@ -764,7 +764,7 @@ create_visor_device(struct visor_device *dev) POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, chipset_dev_no, chipset_bus_no, POSTCODE_SEVERITY_INFO); - sema_init(&dev->visordriver_callback_lock, 1); /* unlocked */ + mutex_init(&dev->visordriver_callback_lock); dev->device.bus = &visorbus_type; dev->device.groups = visorbus_channel_groups; device_initialize(&dev->device); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 04/20] staging: comedi: drivers: re-do macros for PLX PCI 9080 LASxRR values
On 20/05/16 18:52, Hartley Sweeten wrote: On Friday, May 20, 2016 10:18 AM, Ian Abbott wrote: On 20/05/16 17:37, Hartley Sweeten wrote: On Friday, May 20, 2016 6:49 AM, Ian Abbott wrote: Rename the macros for the PLX PCI 9080 LAS0RR and LAS1RR registers in "plx9080.h", using the prefix `PLX_LASRR_`. Make use of the `BIT(x)` and `GENMASK(h,l)` macros to define the values. Define a macro `PLX_LASRR_PREFETCH` for the "prefetchable memory" bit in this register, and define a macro `PLX_LASRR_MLOC_MASK` to mask the PCI memory location control bits. [snip] +#define PLX_LASRR_IO BIT(0) /* Map to: 1=I/O, 0=Mem */ +#define PLX_LASRR_ANY32(BIT(1) * 0)/* Locate anywhere in 32 bit */ +#define PLX_LASRR_LT1MB(BIT(1) * 1)/* Locate in 1st meg */ +#define PLX_LASRR_ANY64(BIT(1) * 2)/* Locate anywhere in 64 bit */ The (BIT(n) * x) looks ugly. You won't like the remaining patches then! You are correct... ;-) FWIW, all the constants end up with the same type (unsigned long) this way. That's probably good but it sure makes the defines look ugly, and a bit hard to understand imoh. You also don't know what the 'max' value for the bit-field is without further digging. Where the values are just predefined constants, you don't need to know the 'max' value. For cases where the value is a macro parameter, I ANDed the value with a bit-mask, although calling the macro with an out-of-range value is a bad idea anyway! I applied your whole series to see what the final header looks like. To me it actually looks worse than the original. The original had a number of whitespace issues that made it hard to follow and the defines were lacking namespace. Personally I also don't can for all the enums since the symbols are not actually used as enums just as raw values. But the 'bit' usage of the registers was fairly clear. With your series applied the whtespace and namespace issues are addressed. You also converted all the enums to defines which is great. But the 'bit' usage now is a bit muddled. I really don't care for the (BIT(n) * (x)) stuff. There are also the various, unused and unnecessary, _SHIFT defines. Those just add additional cruft. The PLX_FOO_BAR_SHIFT defines are there to make it possible to extract the field value from the register value using (reg_val & PLX_FOO_BAR_MASK) >> PLX_FOO_BAR_SHIFT. I only did that when the field value is parameterized in the PLX_FOO_BAR(x) macro. The alternative would be to define PLX_FOO_TO_BAR(r) macros to do the same thing. I had to do that anyway for the 'PAFL' field of the DMPBAM register due to its unusual layout. I'm also not sure if all the bits require a comment. They seem to clutter the header. Datasheets for the PLX-9080 are easy to find. Maybe just have a comment for each register and remove all the bit comments. (You used to have to create an account on plxtech.com to download the datasheets, but that is no longer necessary since it became part of Avago.) Some of the abbreviations used in the macro names are a bit contrived for brevity, so I think the comments help to pin them down in the datasheet. Of course, the comments are no substitution for the actual datasheet. I have been looking for a solution to the problem where random people change something like this: #define MY_COOLREG_VAL_FOO (0 << 5) #define MY_COOLREG_VAL_BAR (1 << 5) #define MY_COOLREG_VAL_BAZ (2 << 5) to: #define MY_COOLREG_VAL_FOO (0 << 5) #define MY_COOLREG_VAL_BAR BIT(5) #define MY_COOLREG_VAL_BAZ (2 << 5) and this seemed like one way to do it. Like I stated previously, I prefer something like this for the multi-bit fields of a register. #define PLX_LASSR_MLOC(x) (((x) & 0x3) << 1) #define PLX_LASSR_MLOC_ANY32PLX_LASSR_MLOC(0) #define PLX_LASSR_MLOC_LT1MBPLX_LASSR_MLOC(1) #define PLX_LASSR_MLOC_ANY64PLX_LASSR_MLOC(2) #define PLX_LASSR_MLOC_MASK PLX_LASSR_MLOC(3) It is handy when matching it up with the data sheet though. I have a field that occupies bits 2 and 1. It also doesn't expose a fairly useless PLX_LASRR_MLOC() macro to the user of the header file. The (BIT(n) * (x)) just looks odd. To be honest, I think the only benefit of using BIT(n) rather than 1 << n is that it forces some type consistency, particularly when the value being shifted is a plain 'int' and there is some possibility of shifting beyond bit 30. With your way of doing it, you need to start adding type casts if the field extends into bit 31. The GENMASK() for a multi-bit field also makes it more difficult to figure out what the maximum value for the field is when there are more than just a few bits and the lower bit is not 0. That's true, although in cases where it matters (where the value is supplied as a parameter), the maximum value is in a bit-mask. One thing about the GENMASK() macro is that it ties in nicely with
[PATCH 1/3] Staging: wlan-ng: fix Alignment should match open parenthesis. This patch fixes alignment of parenthesis found by checkpatch.pl tool.
Signed-off-by: Kevin McKinney --- drivers/staging/wlan-ng/prism2usb.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index b26d09f..43123f3 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -47,11 +47,11 @@ static const struct usb_device_id usb_prism_tbl[] = { PRISM_DEV(0x0bb2, 0x0302, "Ambit Microsystems Corp."), PRISM_DEV(0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter"), PRISM_DEV(0x0543, 0x0f01, - "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)"), + "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)"), PRISM_DEV(0x067c, 0x1022, - "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter"), + "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter"), PRISM_DEV(0x049f, 0x0033, - "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter"), + "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter"), { } /* terminator */ }; MODULE_DEVICE_TABLE(usb, usb_prism_tbl); @@ -216,7 +216,7 @@ exit: #ifdef CONFIG_PM static int prism2sta_suspend(struct usb_interface *interface, - pm_message_t message) +pm_message_t message) { hfa384x_t *hw = NULL; wlandevice_t *wlandev; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] fix wlan-ng/prism2usb.c
This patchset will fix the below issues reported checkpatch.pl tool. Kevin McKinney (3): Staging: wlan-ng: fix Alignment should match open parenthesis. This patch fixes alignment of parenthesis found by checkpatch.pl tool. Staging: wlan-ng: fix unnecessary parentheses around interface-dev. This is a path to fix unnecessary parentheses around interface-dev found by checkpatch.pl tool. Staging: wlan-ng: fix comparison to NULL. This patch fixes comparison to NULL found by checkpatch.pl tool. drivers/staging/wlan-ng/prism2usb.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] Staging: wlan-ng: fix comparison to NULL. This patch fixes comparison to NULL found by checkpatch.pl tool.
Signed-off-by: Kevin McKinney --- drivers/staging/wlan-ng/prism2usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 82be343..0463ec1 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -137,7 +137,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) wlandevice_t *wlandev; wlandev = (wlandevice_t *)usb_get_intfdata(interface); - if (wlandev != NULL) { + if (wlandev) { LIST_HEAD(cleanlist); hfa384x_usbctlx_t *ctlx, *temp; unsigned long flags; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] Staging: wlan-ng: fix unnecessary parentheses around interface-dev. This is a path to fix unnecessary parentheses around interface-dev found by checkpatch.pl tool.
Signed-off-by: Kevin McKinney --- drivers/staging/wlan-ng/prism2usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 43123f3..82be343 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -74,7 +74,7 @@ static int prism2sta_probe_usb(struct usb_interface *interface, } hw = wlandev->priv; - if (wlan_setup(wlandev, &(interface->dev)) != 0) { + if (wlan_setup(wlandev, &interface->dev) != 0) { dev_err(&interface->dev, "wlan_setup() failed.\n"); result = -EIO; goto failed; @@ -87,7 +87,7 @@ static int prism2sta_probe_usb(struct usb_interface *interface, /* Register the wlandev, this gets us a name and registers the * linux netdevice. */ - SET_NETDEV_DEV(wlandev->netdev, &(interface->dev)); + SET_NETDEV_DEV(wlandev->netdev, &interface->dev); /* Do a chip-level reset on the MAC */ if (prism2_doreset) { -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/24] staging: unisys: visorbus: removed unused periodic_test_workqueue
From: Tim Sell periodic_test_workqueue was an unused relic from the past, and was removed. Signed-off-by: Tim Sell Signed-off-by: David Kershner --- drivers/staging/unisys/visorbus/visorbus_main.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index c30b4b2..608ca1a 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -116,14 +116,6 @@ struct bus_type visorbus_type = { .bus_groups = visorbus_bus_groups, }; -static struct delayed_work periodic_work; - -/* YES, we need 2 workqueues. - * The reason is, workitems on the test queue may need to cancel - * workitems on the other queue. You will be in for trouble if you try to - * do this with workitems queued on the same workqueue. - */ -static struct workqueue_struct *periodic_test_workqueue; static struct workqueue_struct *periodic_dev_workqueue; static long long bus_count;/** number of bus instances */ /** ever-increasing */ @@ -1306,13 +1298,6 @@ visorbus_exit(void) destroy_workqueue(periodic_dev_workqueue); periodic_dev_workqueue = NULL; - if (periodic_test_workqueue) { - cancel_delayed_work(&periodic_work); - flush_workqueue(periodic_test_workqueue); - destroy_workqueue(periodic_test_workqueue); - periodic_test_workqueue = NULL; - } - list_for_each_safe(listentry, listtmp, &list_all_bus_instances) { struct visor_device *dev = list_entry(listentry, struct visor_device, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: set function scope with static
A number of function definitions were found to be candidates for static scoping. This patch adds static to these functions. Signed-off-by: Tobin C Harding --- drivers/staging/lustre/lustre/llite/vvp_dev.c | 8 drivers/staging/lustre/lustre/llite/vvp_io.c | 6 +++--- drivers/staging/lustre/lustre/llite/vvp_req.c | 12 ++-- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 47101de..c63def9 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -150,8 +150,8 @@ struct lu_context_key vvp_session_key = { .lct_fini = vvp_session_key_fini }; -void *vvp_thread_key_init(const struct lu_context *ctx, - struct lu_context_key *key) +static void *vvp_thread_key_init(const struct lu_context *ctx, +struct lu_context_key *key) { struct vvp_thread_info *vti; @@ -161,8 +161,8 @@ void *vvp_thread_key_init(const struct lu_context *ctx, return vti; } -void vvp_thread_key_fini(const struct lu_context *ctx, -struct lu_context_key *key, void *data) +static void vvp_thread_key_fini(const struct lu_context *ctx, + struct lu_context_key *key, void *data) { struct vvp_thread_info *vti = data; diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 5bf9592..e26e0f8 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -47,8 +47,8 @@ #include "llite_internal.h" #include "vvp_internal.h" -struct vvp_io *cl2vvp_io(const struct lu_env *env, -const struct cl_io_slice *slice) +static struct vvp_io *cl2vvp_io(const struct lu_env *env, + const struct cl_io_slice *slice) { struct vvp_io *vio; @@ -1259,7 +1259,7 @@ static int vvp_io_read_page(const struct lu_env *env, return 0; } -void vvp_io_end(const struct lu_env *env, const struct cl_io_slice *ios) +static void vvp_io_end(const struct lu_env *env, const struct cl_io_slice *ios) { CLOBINVRNT(env, ios->cis_io->ci_obj, vvp_object_invariant(ios->cis_io->ci_obj)); diff --git a/drivers/staging/lustre/lustre/llite/vvp_req.c b/drivers/staging/lustre/lustre/llite/vvp_req.c index fb88629..9fe9d6c 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_req.c +++ b/drivers/staging/lustre/lustre/llite/vvp_req.c @@ -60,10 +60,10 @@ static inline struct vvp_req *cl2vvp_req(const struct cl_req_slice *slice) *- o_ioepoch, * */ -void vvp_req_attr_set(const struct lu_env *env, - const struct cl_req_slice *slice, - const struct cl_object *obj, - struct cl_req_attr *attr, u64 flags) +static void vvp_req_attr_set(const struct lu_env *env, +const struct cl_req_slice *slice, +const struct cl_object *obj, +struct cl_req_attr *attr, u64 flags) { struct inode *inode; struct obdo *oa; @@ -87,8 +87,8 @@ void vvp_req_attr_set(const struct lu_env *env, JOBSTATS_JOBID_SIZE); } -void vvp_req_completion(const struct lu_env *env, - const struct cl_req_slice *slice, int ioret) +static void vvp_req_completion(const struct lu_env *env, + const struct cl_req_slice *slice, int ioret) { struct vvp_req *vrq; diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index e0c90ad..bc4e1e4 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -192,7 +192,7 @@ static int lustre_start_simple(char *obdname, char *type, char *uuid, return rc; } -DEFINE_MUTEX(mgc_start_lock); +static DEFINE_MUTEX(mgc_start_lock); /** Set up a mgc obd to process startup logs * -- 2.8.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/24] staging: unisys: visorbus: modify format string to match argument
From: David Binder Modifies the format string of snprintf to expect an unsigned int instead of a signed one, per the supplied argument. Signed-off-by: David Binder Signed-off-by: David Kershner --- drivers/staging/unisys/visorbus/visorbus_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index cb08ce4..c30b4b2 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -433,7 +433,7 @@ static ssize_t client_bus_info_show(struct device *dev, if (vdev->name) partition_name = vdev->name; shift = snprintf(pos, remain, -"Client device / client driver info for %s eartition (vbus #%d):\n", +"Client device / client driver info for %s eartition (vbus #%u):\n", partition_name, vdev->chipset_dev_no); pos += shift; remain -= shift; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next 3/5] hv_netvsc: pass struct netvsc_device to rndis_filter_{open, close}()
Both rndis_filter_open()/rndis_filter_close() use struct hv_device to reach to struct netvsc_device only and all callers have it already. While on it, rename net_device to nvdev in rndis_filter_open() as net_device is misleading. Signed-off-by: Vitaly Kuznetsov --- drivers/net/hyperv/hyperv_net.h | 5 +++-- drivers/net/hyperv/netvsc_drv.c | 13 + drivers/net/hyperv/rndis_filter.c | 14 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 952cbc8..f650ec1 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -173,6 +173,7 @@ struct rndis_device { /* Interface */ struct rndis_message; +struct netvsc_device; int netvsc_device_add(struct hv_device *device, void *additional_info); int netvsc_device_remove(struct hv_device *device); int netvsc_send(struct hv_device *device, @@ -189,8 +190,8 @@ int netvsc_recv_callback(struct hv_device *device_obj, struct vmbus_channel *channel, u16 vlan_tci); void netvsc_channel_cb(void *context); -int rndis_filter_open(struct hv_device *dev); -int rndis_filter_close(struct hv_device *dev); +int rndis_filter_open(struct netvsc_device *nvdev); +int rndis_filter_close(struct netvsc_device *nvdev); int rndis_filter_device_add(struct hv_device *dev, void *additional_info); void rndis_filter_device_remove(struct hv_device *dev); diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index db8fedf..591ab58 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -98,16 +98,14 @@ static void netvsc_set_multicast_list(struct net_device *net) static int netvsc_open(struct net_device *net) { - struct net_device_context *net_device_ctx = netdev_priv(net); - struct hv_device *device_obj = net_device_ctx->device_ctx; - struct netvsc_device *nvdev = net_device_ctx->nvdev; + struct netvsc_device *nvdev = net_device_to_netvsc_device(net); struct rndis_device *rdev; int ret = 0; netif_carrier_off(net); /* Open up the device */ - ret = rndis_filter_open(device_obj); + ret = rndis_filter_open(nvdev); if (ret != 0) { netdev_err(net, "unable to open device (ret %d).\n", ret); return ret; @@ -125,7 +123,6 @@ static int netvsc_open(struct net_device *net) static int netvsc_close(struct net_device *net) { struct net_device_context *net_device_ctx = netdev_priv(net); - struct hv_device *device_obj = net_device_ctx->device_ctx; struct netvsc_device *nvdev = net_device_ctx->nvdev; int ret; u32 aread, awrite, i, msec = 10, retry = 0, retry_max = 20; @@ -135,7 +132,7 @@ static int netvsc_close(struct net_device *net) /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */ cancel_work_sync(&net_device_ctx->work); - ret = rndis_filter_close(device_obj); + ret = rndis_filter_close(nvdev); if (ret != 0) { netdev_err(net, "unable to close device (ret %d).\n", ret); return ret; @@ -1247,7 +1244,7 @@ static int netvsc_vf_up(struct net_device *vf_netdev) /* * Open the device before switching data path. */ - rndis_filter_open(net_device_ctx->device_ctx); + rndis_filter_open(netvsc_dev); /* * notify the host to switch the data path. @@ -1302,7 +1299,7 @@ static int netvsc_vf_down(struct net_device *vf_netdev) udelay(50); netvsc_switch_datapath(ndev, false); netdev_info(ndev, "Data path switched from VF: %s\n", vf_netdev->name); - rndis_filter_close(net_device_ctx->device_ctx); + rndis_filter_close(netvsc_dev); netif_carrier_on(ndev); /* * Notify peers. diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 42c652e..2c2f3b9 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1216,23 +1216,19 @@ void rndis_filter_device_remove(struct hv_device *dev) } -int rndis_filter_open(struct hv_device *dev) +int rndis_filter_open(struct netvsc_device *nvdev) { - struct netvsc_device *net_device = hv_device_to_netvsc_device(dev); - - if (!net_device) + if (!nvdev) return -EINVAL; - if (atomic_inc_return(&net_device->open_cnt) != 1) + if (atomic_inc_return(&nvdev->open_cnt) != 1) return 0; - return rndis_filter_open_device(net_device->extension); + return rndis_filter_open_device(nvdev->extension); } -int rndis_filter_close(struct hv_device *dev) +int rndis_filter_close(struct netvsc_device *nvdev) { - struct netvsc_device *nvdev = hv_device_to_netvsc_device(dev); - if (!nvdev) return -EINVAL; -- 2.5.5
[PATCH 15/24] staging: unisys: visorbus: make function descriptions more kerneldoc-like
From: David Binder Per audit feedback from Thomas Gleixner, function descriptions in visorbus_main.c now utilize a more kerneldoc-like formatting. The affected comments do not implement other kerneldoc requirements. Signed-off-by: David Binder Signed-off-by: David Kershner --- drivers/staging/unisys/visorbus/visorbus_main.c | 178 +--- 1 file changed, 98 insertions(+), 80 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index c3f53fb..850998e 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -166,7 +166,8 @@ visorbus_uevent(struct device *xdev, struct kobj_uevent_env *env) return 0; } -/* This is called automatically upon adding a visor_device (device_add), or +/** + * This is called automatically upon adding a visor_device (device_add), or * adding a visor_driver (visorbus_register_visor_driver), and returns 1 iff the * provided driver can control the specified device. */ @@ -200,9 +201,10 @@ visorbus_match(struct device *xdev, struct device_driver *xdrv) return 0; } -/** This is called when device_unregister() is called for the bus device - * instance, after all other tasks involved with destroying the device - * are complete. +/** + * This is called when device_unregister() is called for the bus device + * instance, after all other tasks involved with destroying the device + * are complete. */ static void visorbus_release_busdevice(struct device *xdev) @@ -212,8 +214,9 @@ visorbus_release_busdevice(struct device *xdev) kfree(dev); } -/** This is called when device_unregister() is called for each child - * device instance. +/** + * This is called when device_unregister() is called for each child + * device instance. */ static void visorbus_release_device(struct device *xdev) @@ -556,10 +559,11 @@ dev_stop_periodic_work(struct visor_device *dev) put_device(&dev->device); } -/** This is called automatically upon adding a visor_device (device_add), or - * adding a visor_driver (visorbus_register_visor_driver), but only after - * visorbus_match has returned 1 to indicate a successful match between - * driver and device. +/** + * This is called automatically upon adding a visor_device (device_add), or + * adding a visor_driver (visorbus_register_visor_driver), but only after + * visorbus_match has returned 1 to indicate a successful match between + * driver and device. */ static int visordriver_probe_device(struct device *xdev) @@ -588,9 +592,10 @@ visordriver_probe_device(struct device *xdev) return res; } -/** This is called when device_unregister() is called for each child device - * instance, to notify the appropriate visorbus_driver that the device is - * going away, and to decrease the reference count of the device. +/** + * This is called when device_unregister() is called for each child device + * instance, to notify the appropriate visorbus_driver that the device is + * going away, and to decrease the reference count of the device. */ static int visordriver_remove_device(struct device *xdev) @@ -611,47 +616,47 @@ visordriver_remove_device(struct device *xdev) return 0; } -/** A particular type of visor driver calls this function to register - * the driver. The caller MUST fill in the following fields within the - * #drv structure: - * name, version, owner, channel_types, probe, remove +/** + * A particular type of visor driver calls this function to register + * the driver. The caller MUST fill in the following fields within the + * #drv structure: + * name, version, owner, channel_types, probe, remove * - * Here's how the whole Linux bus / driver / device model works. + * Here's how the whole Linux bus / driver / device model works. * - * At system start-up, the visorbus kernel module is loaded, which registers - * visorbus_type as a bus type, using bus_register(). + * At system start-up, the visorbus kernel module is loaded, which registers + * visorbus_type as a bus type, using bus_register(). * - * All kernel modules that support particular device types on a - * visorbus bus are loaded. Each of these kernel modules calls - * visorbus_register_visor_driver() in their init functions, passing a - * visor_driver struct. visorbus_register_visor_driver() in turn calls - * register_driver(&visor_driver.driver). This .driver member is - * initialized with generic methods (like probe), whose sole responsibility - * is to act as a broker for the real methods, which are within the - * visor_driver struct. (This is the way the subclass behavior is - * implemented, since visor_driver is essentially a subclass of the - * generic driver.) Whenever a driver_register() happens, core bus code in - * the kernel does (see device_attach() in drivers/base/dd.c): + * All kernel modules that support particular device
[PATCH 13/24] staging: unisys: Remove reference to unused STANDALONE_CLIENT
From: Bryan Thompson The STANDALONE_CLIENT define is no longer used by Unisys driver code. Signed-off-by: Bryan Thompson Signed-off-by: David Kershner --- drivers/staging/unisys/include/visorbus.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 2fd3016..94dd48e 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -177,7 +177,6 @@ struct visor_device { #define to_visor_device(x) container_of(x, struct visor_device, device) -#ifndef STANDALONE_CLIENT int visorbus_register_visor_driver(struct visor_driver *); void visorbus_unregister_visor_driver(struct visor_driver *); int visorbus_read_channel(struct visor_device *dev, @@ -188,7 +187,6 @@ int visorbus_write_channel(struct visor_device *dev, unsigned long nbytes); void visorbus_enable_channel_interrupts(struct visor_device *dev); void visorbus_disable_channel_interrupts(struct visor_device *dev); -#endif /* Note that for visorchannel_create() * and arguments may be 0 if we are a channel CLIENT. -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/24] staging: unisys: visorbus: remove unused struct
From: David Binder Removes unused struct definition, channel_size_info, in response to findings by SonarQube. Signed-off-by: David Binder Signed-off-by: David Kershner --- drivers/staging/unisys/visorbus/visorbus_main.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 8278624..cb08ce4 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1257,12 +1257,6 @@ chipset_device_resume(struct visor_device *dev_info) initiate_chipset_device_pause_resume(dev_info, false); } -struct channel_size_info { - uuid_le guid; - unsigned long min_size; - unsigned long max_size; -}; - int visorbus_init(void) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/24] staging: unisys: visorbus: vbusdeviceinfo function descriptions more kerneldoc-like
From: David Binder Per audit feedback from Thomas Gleixner, function descriptions in vbusdeviceinfo.h now utilize a more kerneldoc-like formatting. The affected comments do not implement other kerneldoc requirements. Signed-off-by: David Binder Signed-off-by: David Kershner --- drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h index abdab4a..010ea68 100644 --- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h +++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h @@ -34,7 +34,8 @@ struct ultra_vbus_deviceinfo { #pragma pack(pop) -/* Reads chars from the buffer at for bytes, and writes to +/** + * Reads chars from the buffer at for bytes, and writes to * the buffer at , which is bytes long, ensuring never to * overflow the buffer at , using the following rules: * - printable characters are simply copied from the buffer at to the @@ -92,7 +93,8 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, int srcmax) p++; chars++; remain--; \ } while (0) -/* Converts the non-negative value at to an ascii decimal string +/** + * Converts the non-negative value at to an ascii decimal string * at , writing at most bytes. Note there is NO '\0' termination * written to . * @@ -141,8 +143,9 @@ vbuschannel_itoa(char *p, int remain, int num) return digits; } -/* Reads , and converts its contents to a printable string at , - * writing at most bytes. Note there is NO '\0' termination +/** + * Reads , and converts its contents to a printable string at , + * writing at most bytes. Note there is NO '\0' termination * written to . * * Pass >= 0 if you want a device index presented. -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC][PATCH 2/3] staging: ion: Add support for syncing with DMA_BUF_IOCTL_SYNC
dma_buf added support for a userspace syncing ioctl. It is implemented by calling dma_buf_begin_cpu_access and dma_buf_end_cpu_access. Ion currently lacks cache operations on this code path. Add them for compatibility with the dma_buf ioctl. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 9282d96a..2096592 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1117,6 +1117,11 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); vaddr = ion_buffer_kmap_get(buffer); mutex_unlock(&buffer->lock); + + if (direction != DMA_TO_DEVICE) { + ion_invalidate_buffer(buffer); + } + return PTR_ERR_OR_ZERO(vaddr); } @@ -1129,6 +1134,12 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, ion_buffer_kmap_put(buffer); mutex_unlock(&buffer->lock); + if (direction == DMA_FROM_DEVICE) { + ion_invalidate_buffer(buffer); + } else { + ion_clean_buffer(buffer); + } + return 0; } @@ -1259,6 +1270,8 @@ static int ion_sync_for_device(struct ion_client *client, int fd) struct dma_buf *dmabuf; struct ion_buffer *buffer; + WARN_ONCE(1, "This API is deprecated in favor of the dma_buf ioctl\n"); + dmabuf = dma_buf_get(fd); if (IS_ERR(dmabuf)) return PTR_ERR(dmabuf); -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC][PATCH 0/3] Clean up Ion mapping/caching
Hi, This series cleans up Ion a bit to be more in line with existing standards for caching and dma mapping. The most controversial part of this is probably going to be the first patch. Ion takes quite a few liberties with how the DMA APIs are used for cache syncing. dma_sync_sg is used without calling dma_map first. There isn't a good way to get the cache synchronization with the DMA APIs. The behavior of Ion is closer to the DRM framework which uses its own private cache APIs for synchronization so I took that approach. Assuming the approach of the first patch is appropriate, the next two patches are fairly simple. dma_buf added support for a sync ioctl. Ion has a similar ioctl already so this fixes the Ion APIs to be compatible with the dma_buf ioctl. My plan would be to put a timeline on deprecation for the old Ion sync ioctl. The map_dma_buf calls were also missing calls to the underlying DMA APIs so the final patch in the series adds the appropriate calls. Feedback is appreciated. Thanks, Laura Laura Abbott (3): staging: ion: Move away from the DMA APIs for cache flushing staging: ion: Add support for syncing with DMA_BUF_IOCTL_SYNC staging: ion: Add dma_map/dma_unmap calls to dma_buf calls drivers/staging/android/ion/Kconfig | 14 - drivers/staging/android/ion/Makefile| 3 + drivers/staging/android/ion/ion-arm.c | 83 drivers/staging/android/ion/ion-arm64.c | 46 ++ drivers/staging/android/ion/ion-x86.c | 34 ++ drivers/staging/android/ion/ion.c | 84 + drivers/staging/android/ion/ion_carveout_heap.c | 5 +- drivers/staging/android/ion/ion_chunk_heap.c| 7 +-- drivers/staging/android/ion/ion_page_pool.c | 3 +- drivers/staging/android/ion/ion_priv.h | 14 ++--- drivers/staging/android/ion/ion_system_heap.c | 5 +- 11 files changed, 235 insertions(+), 63 deletions(-) create mode 100644 drivers/staging/android/ion/ion-arm.c create mode 100644 drivers/staging/android/ion/ion-arm64.c create mode 100644 drivers/staging/android/ion/ion-x86.c -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC][PATCH 3/3] staging: ion: Add dma_map/dma_unmap calls to dma_buf calls
The .map_dma_buf/.unmap_dma_buf function calls are designed for buffer users to perform DMA accesses. Ion doesn't call into the lower DMA layer currently. This may leave mapping incomplete for devices with more complex topologies (e.g. IOMMUs). Add the appropriate dma_map calls to the dma_buf call backs. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 2096592..52dbea4 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -980,7 +980,18 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment, struct dma_buf *dmabuf = attachment->dmabuf; struct ion_buffer *buffer = dmabuf->priv; + /* Necessary but not sufficient: This is for userspace */ ion_buffer_sync_for_device(buffer, attachment->dev, direction); + + /* The rest of this is for the standard mappings */ + buffer->sg_table->nents = dma_map_sg(attachment->dev, + buffer->sg_table->sgl, + buffer->sg_table->orig_nents, + direction); + + if (!buffer->sg_table->nents) + return ERR_PTR(-EIO); + return buffer->sg_table; } @@ -988,6 +999,7 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment, struct sg_table *table, enum dma_data_direction direction) { + dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction); } static int ion_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -- 2.5.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC][PATCH 1/3] staging: ion: Move away from the DMA APIs for cache flushing
Ion is currently using the DMA APIs in non-compliant ways for cache maintaince. The issue is Ion needs to do cache operations outside of the regular DMA model. The Ion model matches more closely with the DRM model which calls cache APIs directly. Add an appropriate abstraction layer for Ion to call cache operations outside of the DMA API. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/Kconfig | 14 - drivers/staging/android/ion/Makefile| 3 + drivers/staging/android/ion/ion-arm.c | 83 + drivers/staging/android/ion/ion-arm64.c | 46 ++ drivers/staging/android/ion/ion-x86.c | 34 ++ drivers/staging/android/ion/ion.c | 59 ++ drivers/staging/android/ion/ion_carveout_heap.c | 5 +- drivers/staging/android/ion/ion_chunk_heap.c| 7 +-- drivers/staging/android/ion/ion_page_pool.c | 3 +- drivers/staging/android/ion/ion_priv.h | 14 ++--- drivers/staging/android/ion/ion_system_heap.c | 5 +- 11 files changed, 210 insertions(+), 63 deletions(-) create mode 100644 drivers/staging/android/ion/ion-arm.c create mode 100644 drivers/staging/android/ion/ion-arm64.c create mode 100644 drivers/staging/android/ion/ion-x86.c diff --git a/drivers/staging/android/ion/Kconfig b/drivers/staging/android/ion/Kconfig index 19c1572..c1b1813 100644 --- a/drivers/staging/android/ion/Kconfig +++ b/drivers/staging/android/ion/Kconfig @@ -1,6 +1,6 @@ menuconfig ION bool "Ion Memory Manager" - depends on HAVE_MEMBLOCK && HAS_DMA && MMU + depends on HAVE_MEMBLOCK && HAS_DMA && MMU && (X86 || ARM || ARM64) select GENERIC_ALLOCATOR select DMA_SHARED_BUFFER ---help--- @@ -10,6 +10,18 @@ menuconfig ION If you're not using Android its probably safe to say N here. +config ION_ARM + depends on ION && ARM + def_bool y + +config ION_ARM64 + depends on ION && ARM64 + def_bool y + +config ION_X86 + depends on ION && X86 + def_bool y + config ION_TEST tristate "Ion Test Device" depends on ION diff --git a/drivers/staging/android/ion/Makefile b/drivers/staging/android/ion/Makefile index 18cc2aa..1b82bb5 100644 --- a/drivers/staging/android/ion/Makefile +++ b/drivers/staging/android/ion/Makefile @@ -1,5 +1,8 @@ obj-$(CONFIG_ION) += ion.o ion_heap.o ion_page_pool.o ion_system_heap.o \ ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o +obj-$(CONFIG_ION_X86) += ion-x86.o +obj-$(CONFIG_ION_ARM) += ion-arm.o +obj-$(CONFIG_ION_ARM64) += ion-arm64.o obj-$(CONFIG_ION_TEST) += ion_test.o ifdef CONFIG_COMPAT obj-$(CONFIG_ION) += compat_ion.o diff --git a/drivers/staging/android/ion/ion-arm.c b/drivers/staging/android/ion/ion-arm.c new file mode 100644 index 000..b91287f --- /dev/null +++ b/drivers/staging/android/ion/ion-arm.c @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2016 Laura Abbott + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include + +#include + +#include "ion_priv.h" + + +void ion_clean_page(struct page *page, size_t size) +{ + unsigned long pfn; + size_t left = size; + + pfn = page_to_pfn(page); + + /* +* A single sg entry may refer to multiple physically contiguous +* pages. But we still need to process highmem pages individually. +* If highmem is not configured then the bulk of this loop gets +* optimized out. +*/ + do { + size_t len = left; + void *vaddr; + + page = pfn_to_page(pfn); + + if (PageHighMem(page)) { + if (len > PAGE_SIZE) + len = PAGE_SIZE; + + if (cache_is_vipt_nonaliasing()) { + vaddr = kmap_atomic(page); + __cpuc_flush_dcache_area(vaddr, len); + kunmap_atomic(vaddr); + } else { + vaddr = kmap_high_get(page); + if (vaddr) { + __cpuc_flush_dcache_area(vaddr, len); + kunmap_high(page); + } + } + } else { + vaddr = page_address(page); + __cpuc_flush_dcache_area(vaddr, len); + } +
Re: [PATCH v2] vme: change LM callback argument to void pointer
Sorry it's taken me so long to get to this, I've wanted to write some test code to prove this out to myself and I've been struggling to find the time. On 29/04/16 22:41, Aaron Sierra wrote: diff --git a/Documentation/vme_api.txt b/Documentation/vme_api.txt index ca5b827..4ca63a6 100644 --- a/Documentation/vme_api.txt +++ b/Documentation/vme_api.txt @@ -385,13 +385,13 @@ location monitor location. Each location monitor can monitor a number of adjacent locations: int vme_lm_attach(struct vme_resource *res, int num, - void (*callback)(int)); + void (*callback)(void *)); You're missing the data in the documentation.. @@ -1414,7 +1414,7 @@ static int ca91cx42_lm_get(struct vme_lm_resource *lm, * Callback will be passed the monitor triggered. */ static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor, - void (*callback)(int)) + void (*callback)(void *), void *data) { u32 lm_ctl, tmp; struct ca91cx42_driver *bridge; Martyn ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] staging: dgnc: remove redundant NULL check for brd
On 20/05/16 10:51, Daeseok Youn wrote: > the "brd" value cannot be NULL in dgnc_finalize_board_init(). > Because "brd" as a parameter of this function was already > checked for NULL. > > Signed-off-by: Daeseok Youn > --- > drivers/staging/dgnc/dgnc_driver.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/staging/dgnc/dgnc_driver.c > b/drivers/staging/dgnc/dgnc_driver.c > index af2e835..22257d2 100644 > --- a/drivers/staging/dgnc/dgnc_driver.c > +++ b/drivers/staging/dgnc/dgnc_driver.c > @@ -579,9 +579,6 @@ static int dgnc_finalize_board_init(struct dgnc_board > *brd) > { > int rc = 0; > > - if (!brd || brd->magic != DGNC_BOARD_MAGIC) > - return -ENODEV; > - > if (brd->irq) { > rc = request_irq(brd->irq, brd->bd_ops->intr, >IRQF_SHARED, "DGNC", brd); > This is partially correct, the check for brd being NULL is in line 371. But there is a second check for brd->magic != DGNC_BOARD_MAGIC. Do you want to keep that one? Also, how did you find this patch. It is useful to mention this in the commit message if it was through some static analysis tool. For people using these tools in the future. Thanks for the patch :) Luis ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: dgnc: remove redundant null check in
On 20/05/16 10:51, Daeseok Youn wrote: > the "brd" was already checked for NULL before calling dgnc_do_remap(). > > Signed-off-by: Daeseok Youn > --- > drivers/staging/dgnc/dgnc_driver.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/staging/dgnc/dgnc_driver.c > b/drivers/staging/dgnc/dgnc_driver.c > index 22257d2..1882ef5 100644 > --- a/drivers/staging/dgnc/dgnc_driver.c > +++ b/drivers/staging/dgnc/dgnc_driver.c > @@ -599,9 +599,6 @@ static int dgnc_finalize_board_init(struct dgnc_board > *brd) > */ > static void dgnc_do_remap(struct dgnc_board *brd) > { > - if (!brd || brd->magic != DGNC_BOARD_MAGIC) > - return; > - > brd->re_map_membase = ioremap(brd->membase, 0x1000); > } > > Same comment as the 1/2 patch. Do you want to keep the brd->magic != DGNC_BOARD_MAGIC check? Thanks, Luis ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging/vme: explicitly use `unsigned int` instead of `unsigned`
On 20/05/16 17:27, Daniel Lockyer wrote: > Kernel code style is to prefer the former so add `int` to the method > parameters. > > Signed-off-by: Daniel Lockyer > --- > drivers/staging/vme/devices/vme_pio2_gpio.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c > b/drivers/staging/vme/devices/vme_pio2_gpio.c > index 6d361201..765cb2d 100644 > --- a/drivers/staging/vme/devices/vme_pio2_gpio.c > +++ b/drivers/staging/vme/devices/vme_pio2_gpio.c > @@ -92,7 +92,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, > } > > /* Directionality configured at board build - send appropriate response */ > -static int pio2_gpio_dir_in(struct gpio_chip *chip, unsigned offset) > +static int pio2_gpio_dir_in(struct gpio_chip *chip, unsigned int offset) > { > int data; > struct pio2_card *card = gpiochip_get_data(chip); > @@ -111,7 +111,7 @@ static int pio2_gpio_dir_in(struct gpio_chip *chip, > unsigned offset) > } > > /* Directionality configured at board build - send appropriate response */ > -static int pio2_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int > value) > +static int pio2_gpio_dir_out(struct gpio_chip *chip, unsigned int offset, > int value) > { > int data; > struct pio2_card *card = gpiochip_get_data(chip); > Unfortunately this doesn't apply cleanly on the staging-testing branch [0] AFAIK Greg pushes new staging patches onto this branch. Please fix so it does apply cleanly, the patch idea looks good. Thanks :) Luis [0] https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/log/?h=staging-testing ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/3] fix wlan-ng/prism2usb.c
On 20/05/16 19:04, Kevin McKinney wrote: > This patchset will fix the below issues reported checkpatch.pl tool. > > Kevin McKinney (3): > Staging: wlan-ng: fix Alignment should match open parenthesis. > This patch fixes alignment of parenthesis found by checkpatch.pl > tool. > Staging: wlan-ng: fix unnecessary parentheses around interface-dev. > This is a path to fix unnecessary parentheses around interface-dev > found by checkpatch.pl tool. > Staging: wlan-ng: fix comparison to NULL. This patch fixes > comparison to NULL found by checkpatch.pl tool. > > drivers/staging/wlan-ng/prism2usb.c | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) > Hi Kevin, You have the entire commit message as the subject. For example, if I apply the first patch it shows like this: Staging: wlan-ng: fix Alignment should match open parenthesis. This patch fixes alignment of parenthesis found by checkpatch.pl tool. Signed-off-by: Kevin McKinney This breaks the commit message formatting [0] Move the line starting with "This patch" down to two lines below. Not sure if they are hard rules but the subject line should be not much longer than 50 characters. And then the body of the message should be 72 characters wide, since git indents it. Check a bunch of random recent commits in the git log and you will get a feel of the format. Thanks, Luis ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/3] fix wlan-ng/prism2usb.c
On Wed, May 25, 2016 at 11:15:53PM +0100, Luis de Bethencourt wrote: > On 20/05/16 19:04, Kevin McKinney wrote: > > This patchset will fix the below issues reported checkpatch.pl tool. > > > > Kevin McKinney (3): > > Staging: wlan-ng: fix Alignment should match open parenthesis. > > This patch fixes alignment of parenthesis found by checkpatch.pl > > tool. > > Staging: wlan-ng: fix unnecessary parentheses around interface-dev. > > This is a path to fix unnecessary parentheses around interface-dev > > found by checkpatch.pl tool. > > Staging: wlan-ng: fix comparison to NULL. This patch fixes > > comparison to NULL found by checkpatch.pl tool. > > > > drivers/staging/wlan-ng/prism2usb.c | 14 +++--- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > Hi Kevin, > > You have the entire commit message as the subject. > > For example, if I apply the first patch it shows like this: > Staging: wlan-ng: fix Alignment should match open parenthesis. This patch > fixes alignment of parenthesis found by checkpatch.pl tool. > > Signed-off-by: Kevin McKinney > > This breaks the commit message formatting [0] > Move the line starting with "This patch" down to two lines below. > > Not sure if they are hard rules but the subject line should be > not much longer than 50 characters. And then the body of the message > should be 72 characters wide, since git indents it. > > Check a bunch of random recent commits in the git log and you will > get a feel of the format. > > Thanks, > Luis Thanks for the feedback Luis. I knew something looked strange with this patchset. I will resend. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] fix issues in prism2usb.c.
This patchset will address issues reported by checkpatch.pl tool for file prism2usb.c. Kevin McKinney (3): Staging: wlan-ng: fix alignment not matching. Staging: wlan-ng: fix unnecessary parentheses. Staging: wlan-ng: fix comparison to NULL issue. drivers/staging/wlan-ng/prism2usb.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] Staging: wlan-ng: fix comparison to NULL issue.
This patch fixes comparison to NULL could be written "wlandev" found by checkpatch.pl tool. Signed-off-by: Kevin McKinney --- drivers/staging/wlan-ng/prism2usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 82be343..0463ec1 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -137,7 +137,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) wlandevice_t *wlandev; wlandev = (wlandevice_t *)usb_get_intfdata(interface); - if (wlandev != NULL) { + if (wlandev) { LIST_HEAD(cleanlist); hfa384x_usbctlx_t *ctlx, *temp; unsigned long flags; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] Staging: wlan-ng: fix alignment not matching.
This patch fixes alignment should match open parenthesis found by checkpatch.pl tool in prism2usb.c. Signed-off-by: Kevin McKinney --- drivers/staging/wlan-ng/prism2usb.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index b26d09f..43123f3 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -47,11 +47,11 @@ static const struct usb_device_id usb_prism_tbl[] = { PRISM_DEV(0x0bb2, 0x0302, "Ambit Microsystems Corp."), PRISM_DEV(0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter"), PRISM_DEV(0x0543, 0x0f01, - "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)"), + "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)"), PRISM_DEV(0x067c, 0x1022, - "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter"), + "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter"), PRISM_DEV(0x049f, 0x0033, - "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter"), + "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter"), { } /* terminator */ }; MODULE_DEVICE_TABLE(usb, usb_prism_tbl); @@ -216,7 +216,7 @@ exit: #ifdef CONFIG_PM static int prism2sta_suspend(struct usb_interface *interface, - pm_message_t message) +pm_message_t message) { hfa384x_t *hw = NULL; wlandevice_t *wlandev; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] Staging: wlan-ng: fix unnecessary parentheses.
This patch fixes Unnecessary parentheses around interface->dev found by checkpatch.pl tool. Signed-off-by: Kevin McKinney --- drivers/staging/wlan-ng/prism2usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 43123f3..82be343 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -74,7 +74,7 @@ static int prism2sta_probe_usb(struct usb_interface *interface, } hw = wlandev->priv; - if (wlan_setup(wlandev, &(interface->dev)) != 0) { + if (wlan_setup(wlandev, &interface->dev) != 0) { dev_err(&interface->dev, "wlan_setup() failed.\n"); result = -EIO; goto failed; @@ -87,7 +87,7 @@ static int prism2sta_probe_usb(struct usb_interface *interface, /* Register the wlandev, this gets us a name and registers the * linux netdevice. */ - SET_NETDEV_DEV(wlandev->netdev, &(interface->dev)); + SET_NETDEV_DEV(wlandev->netdev, &interface->dev); /* Do a chip-level reset on the MAC */ if (prism2_doreset) { -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] staging: dgnc: remove redundant NULL check for brd
2016-05-26 6:48 GMT+09:00 Luis de Bethencourt : > On 20/05/16 10:51, Daeseok Youn wrote: >> the "brd" value cannot be NULL in dgnc_finalize_board_init(). >> Because "brd" as a parameter of this function was already >> checked for NULL. >> >> Signed-off-by: Daeseok Youn >> --- >> drivers/staging/dgnc/dgnc_driver.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/drivers/staging/dgnc/dgnc_driver.c >> b/drivers/staging/dgnc/dgnc_driver.c >> index af2e835..22257d2 100644 >> --- a/drivers/staging/dgnc/dgnc_driver.c >> +++ b/drivers/staging/dgnc/dgnc_driver.c >> @@ -579,9 +579,6 @@ static int dgnc_finalize_board_init(struct dgnc_board >> *brd) >> { >> int rc = 0; >> >> - if (!brd || brd->magic != DGNC_BOARD_MAGIC) >> - return -ENODEV; >> - >> if (brd->irq) { >> rc = request_irq(brd->irq, brd->bd_ops->intr, >>IRQF_SHARED, "DGNC", brd); >> > > This is partially correct, the check for brd being NULL is in line 371. Hi Luis, Yes, right. but also brd was assigned the value DGNC_BOARD_MAGIC in line 384. brd->magic = DGNC_BOARD_MAGIC; and also dgnc_finalize_board_init() as a static function is only called in dgnc_found_board(), right? > > But there is a second check for brd->magic != DGNC_BOARD_MAGIC. Do you want > to keep that one? So.. I think it doesn't need to check about DGNC_BOARD_MAGIC. > > Also, how did you find this patch. It is useful to mention this in the commit > message if it was through some static analysis tool. For people using these > tools > in the future. There are some static analysis tool for checking linux kernel code. But I didn't use those tools for this patch. sometimes, I usually run "smatch" tool for checking linux kernel code. thanks. regards, Daeseok. > > Thanks for the patch :) > Luis ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: dgnc: remove redundant null check in
2016-05-26 7:00 GMT+09:00 Luis de Bethencourt : > On 20/05/16 10:51, Daeseok Youn wrote: >> the "brd" was already checked for NULL before calling dgnc_do_remap(). >> >> Signed-off-by: Daeseok Youn >> --- >> drivers/staging/dgnc/dgnc_driver.c | 3 --- >> 1 file changed, 3 deletions(-) >> >> diff --git a/drivers/staging/dgnc/dgnc_driver.c >> b/drivers/staging/dgnc/dgnc_driver.c >> index 22257d2..1882ef5 100644 >> --- a/drivers/staging/dgnc/dgnc_driver.c >> +++ b/drivers/staging/dgnc/dgnc_driver.c >> @@ -599,9 +599,6 @@ static int dgnc_finalize_board_init(struct dgnc_board >> *brd) >> */ >> static void dgnc_do_remap(struct dgnc_board *brd) >> { >> - if (!brd || brd->magic != DGNC_BOARD_MAGIC) >> - return; >> - >> brd->re_map_membase = ioremap(brd->membase, 0x1000); >> } >> >> > > Same comment as the 1/2 patch. I sent an e-mail from the 1/2 patch. it has same reason for this patch. dgnc_do_remap() function is called twice only in dgnc_found_board() function. and also DNGC_BOARD_MAGIC was assigned into "brd->magic". So I think it doesn't need to check about DGNC_BOARD_MAGIC. thanks regards, Daeseok. > > Do you want to keep the brd->magic != DGNC_BOARD_MAGIC check? > > Thanks, > Luis ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: skein: threefish_block: fixed multiple blank line issue
Fixed coding style issue Signed-off-by: Bhushan Gopala Reddy --- drivers/staging/skein/threefish_block.c | 16 1 file changed, 16 deletions(-) diff --git a/drivers/staging/skein/threefish_block.c b/drivers/staging/skein/threefish_block.c index a95563f..5064065 100644 --- a/drivers/staging/skein/threefish_block.c +++ b/drivers/staging/skein/threefish_block.c @@ -64,7 +64,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k3 + t2; b0 += b1 + k2; b1 = rol64(b1, 14) ^ b0; @@ -117,7 +116,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k0 + t1; b0 += b1 + k4; b1 = rol64(b1, 14) ^ b0; @@ -170,7 +168,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k2 + t0; b0 += b1 + k1; b1 = rol64(b1, 14) ^ b0; @@ -223,7 +220,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k4 + t2; b0 += b1 + k3; b1 = rol64(b1, 14) ^ b0; @@ -276,7 +272,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k1 + t1; b0 += b1 + k0; b1 = rol64(b1, 14) ^ b0; @@ -329,7 +324,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k3 + t0; b0 += b1 + k2; b1 = rol64(b1, 14) ^ b0; @@ -382,7 +376,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k0 + t2; b0 += b1 + k4; b1 = rol64(b1, 14) ^ b0; @@ -435,7 +428,6 @@ void threefish_encrypt_256(struct threefish_key *key_ctx, u64 *input, b2 += b1; b1 = rol64(b1, 32) ^ b2; - b1 += k2 + t1; b0 += b1 + k1; b1 = rol64(b1, 14) ^ b0; @@ -579,7 +571,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k3 + t2; b3 -= k4 + 16; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; @@ -648,7 +639,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k1 + t0; b3 -= k2 + 14; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; @@ -717,7 +707,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k4 + t1; b3 -= k0 + 12; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; @@ -786,7 +775,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k2 + t2; b3 -= k3 + 10; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; @@ -855,7 +843,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k0 + t0; b3 -= k1 + 8; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; @@ -924,7 +911,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k3 + t1; b3 -= k4 + 6; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; @@ -993,7 +979,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k1 + t2; b3 -= k2 + 4; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; @@ -1062,7 +1047,6 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= b3 + k4 + t0; b3 -= k0 + 2; - tmp = b3 ^ b0; b3 = ror64(tmp, 32); b0 -= b3; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel