[PATCH 2/6] staging: most: remove blank line after an open brace
This patch removes blank line after an open brace found by checkpatch. CHECK: Blank lines aren't necessary after an open brace '{' Signed-off-by: Chaehyun Lim --- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index b6fe346..9ab092a 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -371,7 +371,6 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) if (hdm_ch->data_type == MOST_CH_ASYNC && hdm_ch->direction == MOST_CH_RX && PACKET_IS_NET_INFO(data)) { - retrieve_netinfo(dev, mbo); spin_lock_irqsave(&dim_lock, flags); @@ -380,7 +379,6 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) } else { if (hdm_ch->data_type == MOST_CH_CONTROL || hdm_ch->data_type == MOST_CH_ASYNC) { - u32 const data_size = (u32)data[0] * 256 + data[1] + 2; -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/6] staging: most: rename DIM_Startup to dim_startup
This patch renames DIM_Startup to dim_startup to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:653: Signed-off-by: Chaehyun Lim --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index c915c44..583506d 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -650,7 +650,7 @@ static bool channel_detach_buffers(struct dim_channel *ch, u16 buffers_number) /* -- */ /* API */ -u8 DIM_Startup(void *dim_base_address, u32 mlb_clock) +u8 dim_startup(void *dim_base_address, u32 mlb_clock) { g.dim_is_initialized = false; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 94ea6c7..6e1392a 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -65,7 +65,7 @@ struct dim_channel { u16 done_sw_buffers_number; /*< Done software buffers number. */ }; -u8 DIM_Startup(void *dim_base_address, u32 mlb_clock); +u8 dim_startup(void *dim_base_address, u32 mlb_clock); void DIM_Shutdown(void); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 9ab092a..89e43e4 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -212,9 +212,9 @@ static int startup_dim(struct platform_device *pdev) return ret; } - hal_ret = DIM_Startup(dev->io_base, dev->clk_speed); + hal_ret = dim_startup(dev->io_base, dev->clk_speed); if (hal_ret != DIM_NO_ERROR) { - pr_err("DIM_Startup failed: %d\n", hal_ret); + pr_err("dim_startup failed: %d\n", hal_ret); if (pdata && pdata->destroy) pdata->destroy(pdata); return -ENODEV; -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/6] staging: most: remove multiple blank lines
This patch removes multiple blank lines found by checkpatch. CHECK: Please don't use multiple blank lines Signed-off-by: Chaehyun Lim --- drivers/staging/most/aim-network/networking.h | 2 -- drivers/staging/most/hdm-dim2/dim2_errors.h | 2 -- drivers/staging/most/hdm-dim2/dim2_hal.h | 3 --- drivers/staging/most/hdm-dim2/dim2_reg.h | 3 --- drivers/staging/most/hdm-dim2/dim2_sysfs.h| 3 --- drivers/staging/most/mostcore/mostcore.h | 2 -- 6 files changed, 15 deletions(-) diff --git a/drivers/staging/most/aim-network/networking.h b/drivers/staging/most/aim-network/networking.h index 1b8b434..6f346d4 100644 --- a/drivers/staging/most/aim-network/networking.h +++ b/drivers/staging/most/aim-network/networking.h @@ -15,9 +15,7 @@ #include "mostcore.h" - void most_deliver_netinfo(struct most_interface *iface, unsigned char link_stat, unsigned char *mac_addr); - #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_errors.h b/drivers/staging/most/hdm-dim2/dim2_errors.h index 314f7de..5a713df 100644 --- a/drivers/staging/most/hdm-dim2/dim2_errors.h +++ b/drivers/staging/most/hdm-dim2/dim2_errors.h @@ -19,7 +19,6 @@ extern "C" { #endif - /** * MOST DIM errors. */ @@ -59,7 +58,6 @@ enum dim_errors_t { DIM_ERR_OVERFLOW, }; - #ifdef __cplusplus } #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index ebb7d87..94ea6c7 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -17,7 +17,6 @@ #include - #ifdef __cplusplus extern "C" { #endif @@ -66,7 +65,6 @@ struct dim_channel { u16 done_sw_buffers_number; /*< Done software buffers number. */ }; - u8 DIM_Startup(void *dim_base_address, u32 mlb_clock); void DIM_Shutdown(void); @@ -111,7 +109,6 @@ void DIMCB_IoWrite(u32 *ptr32, u32 value); void DIMCB_OnError(u8 error_id, const char *error_message); - #ifdef __cplusplus } #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_reg.h b/drivers/staging/most/hdm-dim2/dim2_reg.h index 476f66f..0795aae 100644 --- a/drivers/staging/most/hdm-dim2/dim2_reg.h +++ b/drivers/staging/most/hdm-dim2/dim2_reg.h @@ -21,7 +21,6 @@ extern "C" { #endif - struct dim2_regs { /* 0x00 */ u32 MLBC0; /* 0x01 */ u32 rsvd0[1]; @@ -67,7 +66,6 @@ struct dim2_regs { /* 0xF7 */ u32 ACMR1; }; - #define DIM2_MASK(n) (~((~(u32)0)<<(n))) enum { @@ -168,7 +166,6 @@ enum { CAT_CL_MASK = DIM2_MASK(6) }; - #ifdef __cplusplus } #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.h b/drivers/staging/most/hdm-dim2/dim2_sysfs.h index e719691..b71dd02 100644 --- a/drivers/staging/most/hdm-dim2/dim2_sysfs.h +++ b/drivers/staging/most/hdm-dim2/dim2_sysfs.h @@ -16,10 +16,8 @@ #ifndef DIM2_SYSFS_H #defineDIM2_SYSFS_H - #include - struct medialb_bus { struct kobject kobj_group; }; @@ -35,5 +33,4 @@ void dim2_sysfs_destroy(struct medialb_bus *bus); */ bool dim2_sysfs_get_state_cb(void); - #endif /* DIM2_SYSFS_H */ diff --git a/drivers/staging/most/mostcore/mostcore.h b/drivers/staging/most/mostcore/mostcore.h index e148b32..bda3850 100644 --- a/drivers/staging/most/mostcore/mostcore.h +++ b/drivers/staging/most/mostcore/mostcore.h @@ -60,7 +60,6 @@ enum most_channel_data_type { MOST_CH_SYNC = 1 << 5, }; - enum mbo_status_flags { /* MBO was processed successfully (data was send or received )*/ MBO_SUCCESS = 0, @@ -317,5 +316,4 @@ int most_start_channel(struct most_interface *iface, int channel_idx, int most_stop_channel(struct most_interface *iface, int channel_idx, struct most_aim *); - #endif /* MOST_CORE_H_ */ -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/6] staging: most: rename DIM_Shutdown to dim_shutdown
This patch renames DIM_Shutdown to dim_shutdown to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:676: Signed-off-by: Chaehyun Lim --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 583506d..e296adb 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -673,7 +673,7 @@ u8 dim_startup(void *dim_base_address, u32 mlb_clock) return DIM_NO_ERROR; } -void DIM_Shutdown(void) +void dim_shutdown(void) { g.dim_is_initialized = false; dim2_cleanup(); diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 6e1392a..8b18f74 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -67,7 +67,7 @@ struct dim_channel { u8 dim_startup(void *dim_base_address, u32 mlb_clock); -void DIM_Shutdown(void); +void dim_shutdown(void); bool DIM_GetLockState(void); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 89e43e4..9c99f65 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -883,7 +883,7 @@ static int dim2_remove(struct platform_device *pdev) unsigned long flags; spin_lock_irqsave(&dim_lock, flags); - DIM_Shutdown(); + dim_shutdown(); spin_unlock_irqrestore(&dim_lock, flags); if (pdata && pdata->destroy) -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/6] staging: most: rename DIM_DetachBuffers to dim_detach_buffers
This patch renames DIM_DetachBuffers to dim_detach_buffers to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:886: Signed-off-by: Chaehyun Lim --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index e296adb..9bf952d 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -883,7 +883,7 @@ bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size) return channel_start(ch, buffer_addr, buffer_size); } -bool DIM_DetachBuffers(struct dim_channel *ch, u16 buffers_number) +bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number) { if (!ch) return dim_on_error(DIM_ERR_DRIVER_NOT_INITIALIZED, diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 8b18f74..54dbfc4 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -101,7 +101,7 @@ struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size); -bool DIM_DetachBuffers(struct dim_channel *ch, u16 buffers_number); +bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number); u32 DIMCB_IoRead(u32 *ptr32); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 9c99f65..3f36aa65 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -346,7 +346,7 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) return; } - if (!DIM_DetachBuffers(&hdm_ch->ch, done_buffers)) { + if (!dim_detach_buffers(&hdm_ch->ch, done_buffers)) { spin_unlock_irqrestore(&dim_lock, flags); return; } -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/6] staging: most: add spaces preferred around that '<<'
This patch adds space around '<<' found by checkpatch. CHECK: spaces preferred around that '<<' (ctx:VxV) FILE: drivers/staging/most/hdm-dim2/dim2_reg.h:69: Signed-off-by: Chaehyun Lim --- drivers/staging/most/hdm-dim2/dim2_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_reg.h b/drivers/staging/most/hdm-dim2/dim2_reg.h index 0795aae..bcf6a79 100644 --- a/drivers/staging/most/hdm-dim2/dim2_reg.h +++ b/drivers/staging/most/hdm-dim2/dim2_reg.h @@ -66,7 +66,7 @@ struct dim2_regs { /* 0xF7 */ u32 ACMR1; }; -#define DIM2_MASK(n) (~((~(u32)0)<<(n))) +#define DIM2_MASK(n) (~((~(u32)0) << (n))) enum { MLBC0_MLBLK_BIT = 7, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
new version of the rename_rev.pl script
rename_rev.pl is a script to strip away the mechanical changes that we often see in staging patches and leave just the interesting changes for manual review. There are two new features in this version of rename_rev.pl. The -r option let's you use some pre-written recipes. There are two recipes there now, "NULL" and "bool". These are for changes where people do: - if (foo == NULL) { + if (foo) { Or you can use "cat patch.txt | rename_rev.pl -r bool" for the changes like: - if (foo == true) { + if (foo) { I am really worried about people reversing conditions when they write these sorts of patches. Hopefully, people can add some more recipes for: - foo = 1 << 0; + foo = BIT(0); And maybe: - frob(&(foo.bar)); + frob(&foo.bar); The second change in this version of rename_rev.pl is that I have introduced the -a option for auto. It's basically for when people deal with CamelCase variables. It tries to determine automatically what variables were renamed and filter those changes away. This is great when you get a patch series of 80 patches that deal with CamelCase variables. regards, dan carpenter #!/usr/bin/perl # This is a tool to help review variable rename patches. The goal is # to strip out the automatic sed renames and the white space changes # and leaves the interesting code changes. # # Example 1: A patch renames openInfo to open_info: # cat diff | rename_review.pl openInfo open_info # # Example 2: A patch swaps the first two arguments to some_func(): # cat diff | rename_review.pl \ #-e 's/some_func\((.*?),(.*?),/some_func\($2, $1,/' # # Example 3: A patch removes the xkcd_ prefix from some but not all the # variables. Instead of trying to figure out which variables were renamed # just remove the prefix from them all: # cat diff | rename_review.pl -ea 's/xkcd_//g' # # Example 4: A patch renames 20 CamelCase variables. To review this let's # just ignore all case changes and all '_' chars. # cat diff | rename_review -ea 'tr/[A-Z]/[a-z]/' -ea 's/_//g' # # The other arguments are: # -nc removes comments # -ns removes '\' chars if they are at the end of the line. use strict; use File::Temp qw/ :mktemp /; sub usage() { print "usage: cat diff | $0 old new old new old new...\n"; print " or: cat diff | $0 -e 's/old/new/g'\n"; print " -a : auto"; print " -e : execute on old lines\n"; print " -ea: execute on all lines\n"; print " -nc: no comments\n"; print " -nb: no unneeded braces\n"; print " -ns: no slashes at the end of a line\n"; print " -pull: for function pull. deletes context.\n"; print " -r : NULL, bool"; exit(1); } my @subs; my @strict_subs; my @cmds; my $strip_comments; my $strip_braces; my $strip_slashes; my $pull_context; my $auto; sub filter($) { my $_ = shift(); my $old = 0; if ($_ =~ /^-/) { $old = 1; } # remove the first char s/^[ +-]//; if ($strip_comments) { s/\/\*.*?\*\///g; s/\/\/.*//; } foreach my $cmd (@cmds) { if ($old || $cmd->[0] =~ /^-ea$/) { eval $cmd->[1]; } } foreach my $sub (@subs) { if ($old) { s/$sub->[0]/$sub->[1]/g; } } foreach my $sub (@strict_subs) { if ($old) { s/\b$sub->[0]\b/$sub->[1]/g; } } # remove the newline so we can move curly braces here if we want. s/\n//; return $_; } while (my $param1 = shift()) { if ($param1 =~ /^-a$/) { $auto = 1; next; } if ($param1 =~ /^-nc$/) { $strip_comments = 1; next; } if ($param1 =~ /^-nb$/) { $strip_braces = 1; next; } if ($param1 =~ /^-ns$/) { $strip_slashes = 1; next; } if ($param1 =~ /^-pull$/) { $pull_context = 1; next; } my $param2 = shift(); if ($param2 =~ /^$/) { usage(); } if ($param1 =~ /^-e(a|)$/) { push @cmds, [$param1, $param2]; next; } if ($param1 =~ /^-r$/) { if ($param2 =~ /bool/) { push @cmds, ["-e", "s/== true//"]; push @cmds, ["-e", "s/true ==//"]; push @cmds, ["-e", "s/([a-zA-Z\-\>\._]+) == false/!\$1/"]; next; } elsif ($param2 =~ /NULL/) { push @cmds, ["-e", "s/ != NULL//"]; push @cmds, ["-e", "s/([a-zA-Z\-\>\._]+) == NULL/!\$1/"]; next; } usage(); } push @subs, [$param1, $param2]; } my ($oldfh, $oldfile) = mkstemp("/tmp/oldX"); my ($newfh, $newfile) = mkstemp("/tmp/newX"); my @input = ; # auto works on the observation that the - line comes before the + line when we # rename variables. Take the first - line. Find the first + line. Find the # one word difference. Test that the old word never occurs in the new text. if ($auto) { my %c_keywords = ( auto => 1, break
[patch 1/2] staging: lustre: remove o_ prefix from function pointers
We mostly refer to these function pointers using macros that use macro magic to add the "o_" prefix to the front. It means that you can't use cscope to find the caller. Heck, you can't even grep for it. I looked at preserving the "o_" prefix by removing the macro magic and adding "o_" to all the call sites but then I realized that, really, the prefix doesn't add any value. Let's just remove it. Signed-off-by: Dan Carpenter diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5e93afc..5aca9bb 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -963,123 +963,123 @@ struct md_enqueue_info { }; struct obd_ops { - struct module *o_owner; - int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len, - void *karg, void *uarg); - int (*o_get_info)(const struct lu_env *env, struct obd_export *, - __u32 keylen, void *key, __u32 *vallen, void *val, - struct lov_stripe_md *lsm); - int (*o_set_info_async)(const struct lu_env *, struct obd_export *, - __u32 keylen, void *key, - __u32 vallen, void *val, - struct ptlrpc_request_set *set); - int (*o_attach)(struct obd_device *dev, u32 len, void *data); - int (*o_detach)(struct obd_device *dev); - int (*o_setup)(struct obd_device *dev, struct lustre_cfg *cfg); - int (*o_precleanup)(struct obd_device *dev, - enum obd_cleanup_stage cleanup_stage); - int (*o_cleanup)(struct obd_device *dev); - int (*o_process_config)(struct obd_device *dev, u32 len, void *data); - int (*o_postrecov)(struct obd_device *dev); - int (*o_add_conn)(struct obd_import *imp, struct obd_uuid *uuid, - int priority); - int (*o_del_conn)(struct obd_import *imp, struct obd_uuid *uuid); + struct module *owner; + int (*iocontrol)(unsigned int cmd, struct obd_export *exp, int len, +void *karg, void *uarg); + int (*get_info)(const struct lu_env *env, struct obd_export *, + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *lsm); + int (*set_info_async)(const struct lu_env *, struct obd_export *, + __u32 keylen, void *key, + __u32 vallen, void *val, + struct ptlrpc_request_set *set); + int (*attach)(struct obd_device *dev, u32 len, void *data); + int (*detach)(struct obd_device *dev); + int (*setup)(struct obd_device *dev, struct lustre_cfg *cfg); + int (*precleanup)(struct obd_device *dev, + enum obd_cleanup_stage cleanup_stage); + int (*cleanup)(struct obd_device *dev); + int (*process_config)(struct obd_device *dev, u32 len, void *data); + int (*postrecov)(struct obd_device *dev); + int (*add_conn)(struct obd_import *imp, struct obd_uuid *uuid, + int priority); + int (*del_conn)(struct obd_import *imp, struct obd_uuid *uuid); /* connect to the target device with given connection * data. @ocd->ocd_connect_flags is modified to reflect flags actually * granted by the target, which are guaranteed to be a subset of flags * asked for. If @ocd == NULL, use default parameters. */ - int (*o_connect)(const struct lu_env *env, -struct obd_export **exp, struct obd_device *src, -struct obd_uuid *cluuid, struct obd_connect_data *ocd, + int (*connect)(const struct lu_env *env, + struct obd_export **exp, struct obd_device *src, + struct obd_uuid *cluuid, struct obd_connect_data *ocd, + void *localdata); + int (*reconnect)(const struct lu_env *env, +struct obd_export *exp, struct obd_device *src, +struct obd_uuid *cluuid, +struct obd_connect_data *ocd, void *localdata); - int (*o_reconnect)(const struct lu_env *env, - struct obd_export *exp, struct obd_device *src, - struct obd_uuid *cluuid, - struct obd_connect_data *ocd, - void *localdata); - int (*o_disconnect)(struct obd_export *exp); + int (*disconnect)(struct obd_export *exp); /* Initialize/finalize fids infrastructure. */ - int (*o_fid_init)(struct obd_device *obd, - struct obd_export *exp, enum lu_cli_type type); - int (*o_fid_fini)(struct obd_device *obd); + int (*fid_init)(struct obd_device *obd, + struct ob
[patch 2/2] staging: lustre: remove m_ prefix from function pointers
All the callers call these function pointers without the "m_" prefix and use macro magic to add it later behind the scenes. It means that you can't grep for the call sites. I considered modifying the call sites but in the end I decided that the "m_" prefix doesn't add anything so we can just get rid of it. Signed-off-by: Dan Carpenter diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5aca9bb..5c90b59 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -1124,89 +1124,89 @@ struct md_open_data { struct lookup_intent; struct md_ops { - int (*m_getstatus)(struct obd_export *, struct lu_fid *); - int (*m_null_inode)(struct obd_export *, const struct lu_fid *); - int (*m_find_cbdata)(struct obd_export *, const struct lu_fid *, -ldlm_iterator_t, void *); - int (*m_close)(struct obd_export *, struct md_op_data *, - struct md_open_data *, struct ptlrpc_request **); - int (*m_create)(struct obd_export *, struct md_op_data *, - const void *, int, int, __u32, __u32, cfs_cap_t, - __u64, struct ptlrpc_request **); - int (*m_done_writing)(struct obd_export *, struct md_op_data *, - struct md_open_data *); - int (*m_enqueue)(struct obd_export *, struct ldlm_enqueue_info *, -struct lookup_intent *, struct md_op_data *, -struct lustre_handle *, void *, int, -struct ptlrpc_request **, __u64); - int (*m_getattr)(struct obd_export *, struct md_op_data *, -struct ptlrpc_request **); - int (*m_getattr_name)(struct obd_export *, struct md_op_data *, - struct ptlrpc_request **); - int (*m_intent_lock)(struct obd_export *, struct md_op_data *, -void *, int, struct lookup_intent *, int, -struct ptlrpc_request **, -ldlm_blocking_callback, __u64); - int (*m_link)(struct obd_export *, struct md_op_data *, + int (*getstatus)(struct obd_export *, struct lu_fid *); + int (*null_inode)(struct obd_export *, const struct lu_fid *); + int (*find_cbdata)(struct obd_export *, const struct lu_fid *, + ldlm_iterator_t, void *); + int (*close)(struct obd_export *, struct md_op_data *, +struct md_open_data *, struct ptlrpc_request **); + int (*create)(struct obd_export *, struct md_op_data *, + const void *, int, int, __u32, __u32, cfs_cap_t, + __u64, struct ptlrpc_request **); + int (*done_writing)(struct obd_export *, struct md_op_data *, + struct md_open_data *); + int (*enqueue)(struct obd_export *, struct ldlm_enqueue_info *, + struct lookup_intent *, struct md_op_data *, + struct lustre_handle *, void *, int, + struct ptlrpc_request **, __u64); + int (*getattr)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*getattr_name)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*intent_lock)(struct obd_export *, struct md_op_data *, + void *, int, struct lookup_intent *, int, + struct ptlrpc_request **, + ldlm_blocking_callback, __u64); + int (*link)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*rename)(struct obd_export *, struct md_op_data *, + const char *, int, const char *, int, struct ptlrpc_request **); - int (*m_rename)(struct obd_export *, struct md_op_data *, - const char *, int, const char *, int, - struct ptlrpc_request **); - int (*m_is_subdir)(struct obd_export *, const struct lu_fid *, - const struct lu_fid *, + int (*is_subdir)(struct obd_export *, const struct lu_fid *, +const struct lu_fid *, struct ptlrpc_request **); - int (*m_setattr)(struct obd_export *, struct md_op_data *, void *, -int, void *, int, struct ptlrpc_request **, + int (*setattr)(struct obd_export *, struct md_op_data *, void *, + int, void *, int, struct ptlrpc_request **, struct md_open_data **mod); - int (*m_sync)(struct obd_export *, const struct lu_fid *, + int (*sync)(struct obd_export *, const struct lu_fid *, + struct ptlrpc_request **); + int (*readpage)(struct obd_export *, struc
Re: new version of the rename_rev.pl script
On Thu, Oct 29, 2015 at 12:22:10PM +0300, Dan Carpenter wrote: > rename_rev.pl is a script to strip away the mechanical changes that we > often see in staging patches and leave just the interesting changes for > manual review. Thanks Dan. This CamelCase feature will be a life saver. I hope you remember few days back we had a long series of renames, though that was not CamelCase. But i just checked and your script works in normal variable rename also (state => cur_state). Thanks again for sharing. regards sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/12] staging: wilc1000: fix return type of host_int_del_beacon
This patch changes return type of host_int_del_beacon from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dbbe72c..b469962 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4495,9 +4495,9 @@ ERRORHANDLER: return result; } -s32 host_int_del_beacon(struct host_if_drv *hif_drv) +int host_int_del_beacon(struct host_if_drv *hif_drv) { - s32 result = 0; + int result = 0; struct host_if_msg msg; if (!hif_drv) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index b854db5..698a588 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -932,7 +932,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, * @date 10 Julys 2012 * @version 1.0 Description */ -s32 host_int_del_beacon(struct host_if_drv *hWFIDrv); +int host_int_del_beacon(struct host_if_drv *hWFIDrv); /*! * @fns32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/12] staging: wilc1000: fix parameter name of host_int_del_station
This patch changes struct host_if_drv of host_int_del_station function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 9eb1b3b..083def57 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE * @date 15 July 2012 * @version 1.0 Description */ -int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr); /*! * @fns32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/12] staging: wilc1000: fix parameter name of host_int_del_beacon
This patch changes struct host_if_drv of host_int_del_beacon function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 698a588..36de990 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -932,7 +932,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, * @date 10 Julys 2012 * @version 1.0 Description */ -int host_int_del_beacon(struct host_if_drv *hWFIDrv); +int host_int_del_beacon(struct host_if_drv *hif_drv); /*! * @fns32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/12] staging: wilc1000: fix return type of host_int_del_station
This patch changes return type of host_int_del_station from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b469962..be5e652 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4552,9 +4552,9 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, return result; } -s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) { - s32 result = 0; + int result = 0; struct host_if_msg msg; struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 36de990..9eb1b3b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE * @date 15 July 2012 * @version 1.0 Description */ -s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); /*! * @fns32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/12] staging: wilc1000: rename pstrStaParams in host_int_add_station
This patch renames pstrStaParams to sta_param to avoid camelcase. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0f36825..57287d4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4517,7 +4517,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv) } int host_int_add_station(struct host_if_drv *hif_drv, -struct add_sta_param *pstrStaParams) +struct add_sta_param *sta_param) { int result = 0; struct host_if_msg msg; @@ -4535,14 +4535,14 @@ int host_int_add_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_ADD_STATION; msg.drv = hif_drv; - memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); + memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, sta_param->pu8Rates, pstrAddStationMsg->u8NumRates); pstrAddStationMsg->pu8Rates = rates; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 7c9c4c6..aa92762 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -949,7 +949,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv); * @version 1.0 Description */ int host_int_add_station(struct host_if_drv *hif_drv, -struct add_sta_param *pstrStaParams); +struct add_sta_param *sta_param); /*! * @fns32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr) -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/12] staging: wilc1000: rename pstrDelStationMsg in host_int_del_station
This patch renames pstrDelStationMsg to del_sta_info to avoid camelcase. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8dba9a3..fe4ccdb 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4556,7 +4556,7 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; - struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; + struct del_sta *del_sta_info = &msg.body.del_sta_info; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4571,9 +4571,9 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) msg.drv = hif_drv; if (!mac_addr) - eth_broadcast_addr(pstrDelStationMsg->mac_addr); + eth_broadcast_addr(del_sta_info->mac_addr); else - memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN); + memcpy(del_sta_info->mac_addr, mac_addr, ETH_ALEN); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/12] staging: wilc1000: fix return type of host_int_add_station
This patch changes return type of host_int_add_station from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index fe4ccdb..0f36825 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4516,10 +4516,10 @@ int host_int_del_beacon(struct host_if_drv *hif_drv) return result; } -s32 host_int_add_station(struct host_if_drv *hif_drv, +int host_int_add_station(struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams) { - s32 result = 0; + int result = 0; struct host_if_msg msg; struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index be9283f..3fcff7a 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -948,7 +948,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv); * @date 12 July 2012 * @version 1.0 Description */ -s32 host_int_add_station(struct host_if_drv *hWFIDrv, +int host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); /*! -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/12] staging: wilc1000: rename pu8MacAddr in host_int_del_station
This patch changes pu8MacAddr to mac_addr that is second argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index be5e652..8dba9a3 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4552,7 +4552,7 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, return result; } -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; @@ -4570,10 +4570,10 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) msg.id = HOST_IF_MSG_DEL_STATION; msg.drv = hif_drv; - if (!pu8MacAddr) + if (!mac_addr) eth_broadcast_addr(pstrDelStationMsg->mac_addr); else - memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN); + memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 083def57..be9283f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE * @date 15 July 2012 * @version 1.0 Description */ -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr); /*! * @fns32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/12] staging: wilc1000: fix parameter name of host_int_add_station
This patch changes struct host_if_drv of host_int_add_station function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 3fcff7a..7c9c4c6 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -948,7 +948,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv); * @date 12 July 2012 * @version 1.0 Description */ -int host_int_add_station(struct host_if_drv *hWFIDrv, +int host_int_add_station(struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams); /*! -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/12] staging: use kmemdup in host_int_add_station
This patch replaces kmalloc followed by memcpy with kmemdup. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3c5de75..6b804e6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4537,12 +4537,12 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->u8NumRates > 0) { - u8 *rates = kmalloc(add_sta_info->u8NumRates, GFP_KERNEL); - + u8 *rates = kmemdup(sta_param->pu8Rates, + add_sta_info->u8NumRates, + GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, sta_param->pu8Rates, add_sta_info->u8NumRates); add_sta_info->pu8Rates = rates; } -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/12] staging: wilc1000: rename pstrAddStationMsg in host_int_add_station
This patch renames pstrAddStationMsg to add_sta_info to avoid camelcase. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 57287d4..3c5de75 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4521,7 +4521,7 @@ int host_int_add_station(struct host_if_drv *hif_drv, { int result = 0; struct host_if_msg msg; - struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; + struct add_sta_param *add_sta_info = &msg.body.add_sta_info; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4535,15 +4535,15 @@ int host_int_add_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_ADD_STATION; msg.drv = hif_drv; - memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param)); - if (pstrAddStationMsg->u8NumRates > 0) { - u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); + memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); + if (add_sta_info->u8NumRates > 0) { + u8 *rates = kmalloc(add_sta_info->u8NumRates, GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, sta_param->pu8Rates, pstrAddStationMsg->u8NumRates); - pstrAddStationMsg->pu8Rates = rates; + memcpy(rates, sta_param->pu8Rates, add_sta_info->u8NumRates); + add_sta_info->pu8Rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/12] staging: wilc1000: remove rates in host_int_add_station
Instead of using rates variable, it is used as add_sta_info->pu8Rates directly. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6b804e6..e2bdac8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4537,13 +4537,11 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->u8NumRates > 0) { - u8 *rates = kmemdup(sta_param->pu8Rates, - add_sta_info->u8NumRates, - GFP_KERNEL); - if (!rates) + add_sta_info->pu8Rates = kmemdup(sta_param->pu8Rates, +add_sta_info->u8NumRates, +GFP_KERNEL); + if (!add_sta_info->pu8Rates) return -ENOMEM; - - add_sta_info->pu8Rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch] staging: lustre: potential underflow in libcfs_kkuc_group_add()
My static checker says that "group" is a user controlled number that can be negative leading to an array underflow. I have looked at it, and I'm not an expert enough in lustre to say for sure if it is really a bug. Anyway, it's simple enough to make the variable unsigned which pleases the static checker and makes it easier to audit. Signed-off-by: Dan Carpenter diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index a989d26..41f3d81 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -91,7 +91,7 @@ typedef int (*libcfs_kkuc_cb_t)(__u32 data, void *cb_arg); /* Kernel methods */ int libcfs_kkuc_msg_put(struct file *fp, void *payload); int libcfs_kkuc_group_put(int group, void *payload); -int libcfs_kkuc_group_add(struct file *fp, int uid, int group, +int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group, __u32 data); int libcfs_kkuc_group_rem(int uid, int group); int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c index ad661a3..d8230ae 100644 --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c @@ -110,7 +110,8 @@ static DECLARE_RWSEM(kg_sem); * @param uid identifier for this receiver * @param group group number */ -int libcfs_kkuc_group_add(struct file *filp, int uid, int group, __u32 data) +int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group, + __u32 data) { struct kkuc_reg *reg; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [lustre-devel] [PATCH 08/10] staging: lustre: remove white space in libcfs_hash.h
>>struct cfs_hash_bd { >>- struct cfs_hash_bucket *bd_bucket; /**< address of bucket */ >>- unsigned intbd_offset; /**< offset in bucket */ >>+ /**< address of bucket */ >>+ struct cfs_hash_bucket *bd_bucket; >>+ /**< offset in bucket */ >>+ unsigned int bd_offset; >> }; > >The "/**< ... */" marker means "the field to the left", but if you are >moving these to the line before the field you should just use "/* ... */". Fixed. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [lustre-devel] [PATCH 09/10] staging: lustre: fix remaining checkpatch issues for libcfs_hash.h
>>diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>index 5df8ba2..563b2b4 100644 >>--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>@@ -62,7 +62,8 @@ >> /** disable debug */ >> #define CFS_HASH_DEBUG_NONE 0 >> /** record hash depth and output to console when it's too deep, >>- * computing overhead is low but consume more memory */ >>+ * computing overhead is low but consume more memory >>+ */ > >Typically, multi-line comments have the leading /* on a separate line >from the first line of text. If you are changing all these comments >you may as well make it consistent with the kernel style. Fixed for next patch series. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/6] staging: most: remove multiple blank lines
2015-10-29 5:44 GMT-02:00 Chaehyun Lim : > This patch removes multiple blank lines found by checkpatch. > CHECK: Please don't use multiple blank lines > > Signed-off-by: Chaehyun Lim Good. Tips for Coding Style [0] 0 - https://www.kernel.org/doc/Documentation/CodingStyle Albino ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 4/5] staging: fsl-mc: bus rescan attribute to sync kernel with MC
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Tuesday, October 27, 2015 12:40 AM > To: Pan Lijun-B44306 > Cc: a...@arndb.de; de...@driverdev.osuosl.org; linux- > ker...@vger.kernel.org; Hamciuc Bogdan-BHAMCIU1 > ; Sharma Bhupesh-B45370 > ; Rivera Jose-B46482 > ; ag...@suse.de; Yoder Stuart-B08248 > ; Erez Nir-RM30794 ; > katz Itai-RM05202 ; Wood Scott-B07421 > ; Li Yang-Leo-R58472 ; > Marginean Alexandru-R89243 ; > dan.carpen...@oracle.com; Schmitt Richard-B43082 > > Subject: Re: [PATCH 4/5] staging: fsl-mc: bus rescan attribute to sync kernel > with MC > > On Sun, Oct 25, 2015 at 05:41:22PM -0500, Lijun Pan wrote: > > Introduce the rescan attribute as a bus attribute to synchronize the > > fsl-mc bus objects and the MC firmware. > > > > To rescan the fsl-mc bus, e.g., > > echo 1 > /sys/bus/fsl-mc/rescan > > > > Signed-off-by: Lijun Pan > > --- > > drivers/staging/fsl-mc/bus/mc-bus.c | 46 > > + > > 1 file changed, 46 insertions(+) > > > > diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c > > b/drivers/staging/fsl-mc/bus/mc-bus.c > > index 33a56ad..f1baad7 100644 > > --- a/drivers/staging/fsl-mc/bus/mc-bus.c > > +++ b/drivers/staging/fsl-mc/bus/mc-bus.c > > @@ -144,11 +144,57 @@ static const struct attribute_group > *fsl_mc_dev_groups[] = { > > NULL, > > }; > > > > +static int scan_fsl_mc_bus(struct device *dev, void *data) { > > + struct fsl_mc_device *root_mc_dev; > > + struct fsl_mc_bus *root_mc_bus; > > + > > + if (is_root_dprc(dev)) { > > + root_mc_dev = to_fsl_mc_device(dev); > > + root_mc_bus = to_fsl_mc_bus(root_mc_dev); > > + mutex_lock(&root_mc_bus->scan_mutex); > > + dprc_scan_objects(root_mc_dev); > > + mutex_unlock(&root_mc_bus->scan_mutex); > > + } > > + > > + return 0; > > +} > > + > > +static ssize_t bus_rescan_store(struct bus_type *bus, > > + const char *buf, size_t count) { > > + unsigned long val; > > + > > + if (kstrtoul(buf, 0, &val) < 0) > > + return -EINVAL; > > + > > + if (val) > > + bus_for_each_dev(bus, NULL, NULL, scan_fsl_mc_bus); > > + > > + return count; > > +} > > +static BUS_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, bus_rescan_store); > > + > > +static struct attribute *fsl_mc_bus_attrs[] = { > > + &bus_attr_rescan.attr, > > + NULL, > > +}; > > + > > +static const struct attribute_group fsl_mc_bus_group = { > > + .attrs = fsl_mc_bus_attrs, > > +}; > > + > > +static const struct attribute_group *fsl_mc_bus_groups[] = { > > + &fsl_mc_bus_group, > > + NULL, > > +}; > > + > > struct bus_type fsl_mc_bus_type = { > > .name = "fsl-mc", > > .match = fsl_mc_bus_match, > > .uevent = fsl_mc_bus_uevent, > > .dev_groups = fsl_mc_dev_groups, > > + .bus_groups = fsl_mc_bus_groups, > > }; > > EXPORT_SYMBOL_GPL(fsl_mc_bus_type); > > No documentation update as well? Hi Greg, Are you saying something like adding Documentation/ABI/testing/sysfs-bus-fsl-mc? For the fsl-mc bus Documentation/ABI/testing/sysfs-devices-dprc? For the dprc device? Or drivers/staging/fsl-mc/[README.txt | TODO]? Thanks Lijun ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: adv_pci1710: separate out PCI-1720 support as a new driver
The PCI-1710 series boards are multifunction data acquisition boards with analog inputs and outputs, digital inputs and outputs, and counter/timer functions. The PCI-1720 is a simple 4 channel analog output board. It also uses a unique register map. Separate out the PCI-1720 support as a new driver, adv_pci1720, to ease maintainability. Fix some issues with the PCI-1720 support in the new driver: 1) the registers are all 8-bit 2) remove the analog output "reset" when the driver attaches/detaches 3) disable "synchronized output" to simplify the analog outputs 4) remove the need for the private data 5) add support for the BoardID register to allow multiple cards Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 12 +- drivers/staging/comedi/drivers/Makefile | 1 + drivers/staging/comedi/drivers/adv_pci1710.c | 108 +-- drivers/staging/comedi/drivers/adv_pci1720.c | 195 +++ 4 files changed, 211 insertions(+), 105 deletions(-) create mode 100644 drivers/staging/comedi/drivers/adv_pci1720.c diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index ac0f010..945c85a 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -737,15 +737,23 @@ config COMEDI_ADL_PCI9118 called adl_pci9118. config COMEDI_ADV_PCI1710 - tristate "Advantech PCI-171x, PCI-1720 and PCI-1731 support" + tristate "Advantech PCI-171x and PCI-1731 support" select COMEDI_8254 ---help--- Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711, - PCI-1713, PCI-1720 and PCI-1731 + PCI-1713 and PCI-1731 To compile this driver as a module, choose M here: the module will be called adv_pci1710. +config COMEDI_ADV_PCI1720 + tristate "Advantech PCI-1720 support" + ---help--- + Enable support for Advantech PCI-1720 Analog Output board. + + To compile this driver as a module, choose M here: the module will be + called adv_pci1720. + config COMEDI_ADV_PCI1723 tristate "Advantech PCI-1723 support" ---help--- diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index c3b8f2d..94c179b 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -78,6 +78,7 @@ obj-$(CONFIG_COMEDI_ADL_PCI8164) += adl_pci8164.o obj-$(CONFIG_COMEDI_ADL_PCI9111) += adl_pci9111.o obj-$(CONFIG_COMEDI_ADL_PCI9118) += adl_pci9118.o obj-$(CONFIG_COMEDI_ADV_PCI1710) += adv_pci1710.o +obj-$(CONFIG_COMEDI_ADV_PCI1720) += adv_pci1720.o obj-$(CONFIG_COMEDI_ADV_PCI1723) += adv_pci1723.o obj-$(CONFIG_COMEDI_ADV_PCI1724) += adv_pci1724.o obj-$(CONFIG_COMEDI_ADV_PCI_DIO) += adv_pci_dio.o diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 399c511..7cd4944 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -11,7 +11,7 @@ * Driver: adv_pci1710 * Description: Comedi driver for Advantech PCI-1710 series boards * Devices: [Advantech] PCI-1710 (adv_pci1710), PCI-1710HG, PCI-1711, - * PCI-1713, PCI-1720, PCI-1731 + * PCI-1713, PCI-1731 * Author: Michal Dobes * Status: works * @@ -62,16 +62,6 @@ #define PCI171X_DO_REG 0x10/* W: digital outputs */ #define PCI171X_TIMER_BASE 0x18/* R/W: 8254 timer */ -/* - * PCI-1720 only has analog outputs and has a different - * register map (dev->iobase) - */ -#define PCI1720_DA_REG(x) (0x00 + ((x) * 2)) /* W: D/A registers */ -#define PCI1720_RANGE_REG 0x08/* R/W: D/A range register */ -#define PCI1720_SYNC_REG 0x09/* W: D/A synchronized output */ -#define PCI1720_SYNC_CTRL_REG 0x0f/* R/W: D/A synchronized control */ -#define PCI1720_SYNC_CTRL_SC0 BIT(0) /* set synchronous output mode */ - static const struct comedi_lrange range_pci1710_3 = { 9, { BIP_RANGE(5), @@ -122,15 +112,6 @@ static const struct comedi_lrange range_pci17x1 = { static const char range_codes_pci17x1[] = { 0x00, 0x01, 0x02, 0x03, 0x04 }; -static const struct comedi_lrange pci1720_ao_range = { - 4, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(10) - } -}; - static const struct comedi_lrange pci171x_ao_range = { 2, { UNI_RANGE(5), @@ -143,7 +124,6 @@ enum pci1710_boardid { BOARD_PCI1710HG, BOARD_PCI1711, BOARD_PCI1713, - BOARD_PCI1720, BOARD_PCI1731, }; @@ -153,7 +133,6 @@ struct boardtype { const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ const char *rangecode_ai; /* range codes for programming */ unsigned i
GOOD DAY MY DEAR FRIEND
Mr Kenneth Sing Yip NG (Director & Senior Executive Officer) Hang Seng Bank Limited 83 Des Voeux Road, Central Hong Kong SAR FAX NO: + 852-3017-6738 GREETINGS!!! URGENT BUSINESS PROPOSAL OVERVIEW FOR YOU, FROM HONG KONG It is understandable that you might be a little bit apprehensive because you do not know me, Please forgive this unusual manner to contact you, but this particular letter/email is of exceptional and very private nature, as by virtue of my vantage position in Hang Seng Bank Ltd -Hong Kong I have a lucrative business proposal of mutual interest to share with you. There is no way for me to know whether I will be properly understood, but it is my duty to write and reach out to you, TRUSTING that you will give this proposal a positive consideration. I am Mr. Kenneth NG Yip from Hong Kong, 55 years old and happily married with grown-up children, and I am a Director and a Senior Executive Officer of Hang Seng Bank Ltd, in charge of the International Remittance Department. I will need you to assist me in executing a business project from our bank worth US$22.5 Million. These funds were deposited with our bank by a customer of our bank who is a national{citizen} of your country, who u unfortunately died in the December http://news.bbc.co.uk/cbbcnews/hi/newsid_453/newsid_4537600/4537601.stm http://edition.cnn.com/2005/WORLD/asiapcf/02/19/tsunami.bush.clinton/index.html http://www.smh.com.au/news/Asia-Tsunami/Tsunami-survivors-face-disease-starvation/2004/12/28/1103996558253.htmlhttp://www.globalsecurity.org/eye/andaman-us.htm The deceased account has been declared dormant since 2006 and these funds will be confiscated/declared unserviceable and turned over to the Hong Kong government if the deceased business associates or Next-of-Kin did not claim this money; since all efforts to trace any living relative of the deceased proved abortive we have decided that I will have you claim this money as the deceased business associate/or Next-of-Kin, since you are from the same country and perhaps have some similarities in certain areas. Everything concerning this transaction shall be LEGALLY done without hitch, as I was the deceased account Officer and all the relevant documents of this deposit were kept under my care. Please endeavour to observe utmost discretion in all matters concerning this issue, as I hope that you are a sincere, honest, matured person and above all TRUSTWORTHY. Once the funds have been successfully transferred into your account, we shall share it in a ratio of 30% for you, 60% for me and my associates in the bank and the reminder 10% to take care of contingencies. I will prefer you reach me on my private email address below: Emails: kensingyi...@gmail.com ) and finally after that I shall furnish you with more information about this operation. I am counting on your anticipated co-operation for a successful and hitch free business transaction between us, that will be mutually beneficial, for a start, oblige me these information:-1.Your Full name{s}:- 2. Current contact address:-3.Your presents Occupation:- 4. Your age:-5.Contact phone numbers {Office and Mobile {cell}:-Please if you are not interested delete this email and do not hurt me because I am putting my career and the life of my family at stake with this venture. Although nothing ventured is nothing gained, as it is said, the taste of the pudding is in the eating, do give this proposal SERIOUS AND POSITIVE CONSIDERATION. Your earliest response to this letter will be highly appreciated. Kind Regards, Mr. Mr. Kenneth NG Sing Yip Hang Seng Bank Limited Hong Kong. (Asia) Tel/Fax:-852-3017-6738. Emails: kensingyi...@gmail.com --- 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
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
> -Original Message- > From: Richard Weinberger [mailto:richard.weinber...@gmail.com] > Sent: Tuesday, October 27, 2015 6:36 PM > To: David Miller > Cc: Haiyang Zhang ; o...@aepfle.de; Greg Kroah- > Hartman ; net...@vger.kernel.org; jasow...@redhat.com; > driverdev-devel@linuxdriverproject.org; LKML ker...@vger.kernel.org> > Subject: Re: [PATCH net-next] hyperv: Add handler for > RNDIS_STATUS_NETWORK_CHANGE event > > On Mon, Jun 23, 2014 at 10:10 PM, David Miller > wrote: > > From: Haiyang Zhang > > Date: Mon, 23 Jun 2014 16:09:59 + > > > >> So, what's the equivalent or similar command to "network restart" on > SLES12? Could > >> you update the command line for the usermodehelper when porting this > patch to SLES > >> 12? > > > > No, you are not going to keep the usermodehelper invocation in your > driver > > please remove it. It is absolutely inappropriate, and I strictly do > not want > > to keep it in there because other people will copy it and then we'll > have a > > real mess on our hands. > > Sorry for digging up this old thread. > While talking with some guys about usermodehelper abuses I came across > this gem. > Mainline still contains that "/etc/init.d/network restart" code. > Haiyang, care to cleanup? Hi Richard and others, Thanks for the reminder. I will clean up the usermode helper. Do you have suggestions of trigger DHCP refresh from kernel mode? Any sample code in the existing kernel code? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
{{ U.N.O/W.B.O/10/15/82/05/9 }}
Please view the attached file for your code payment. United Nations Compensation Unit.docx Description: Binary data ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/6] staging: most: remove multiple blank lines
On Thu, Oct 29, 2015 at 02:17:03PM -0200, Albino B Neto wrote: > 2015-10-29 5:44 GMT-02:00 Chaehyun Lim : > > This patch removes multiple blank lines found by checkpatch. > > CHECK: Please don't use multiple blank lines > > > > Signed-off-by: Chaehyun Lim > > Good. Tips for Coding Style [0] > > 0 - https://www.kernel.org/doc/Documentation/CodingStyle I don't understand what you are saying here, what does this email mean? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/6] staging: lustre: place linux header first in hash.c
From: James Simmons Always place linux headers first in libcfs header files. This avoid can potential build issues if any changes to a libcfs header land that starts using a linux header definition. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/libcfs/hash.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index ed4e1f1..4cd8776 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -106,9 +106,9 @@ * Now we support both locked iteration & lockless iteration of hash * table. Also, user can break the iteration by return 1 in callback. */ +#include #include "../../include/linux/libcfs/libcfs.h" -#include #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/6] staging: lustre: remove obsolete comment in libcfs_hash.h
From: James Simmons Remove comment hash_long which was removed long ago. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h |7 --- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 4d73f8a..4a78e6d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -56,13 +56,6 @@ /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffc0001ULL -/* - * Ideally we would use HAVE_HASH_LONG for this, but on linux we configure - * the linux kernel and user space at the same time, so we need to differentiate - * between them explicitly. If this is not needed on other architectures, then - * we'll need to move the functions to architecture specific headers. - */ - #include /** disable debug */ -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/6] staging: lustre: second series for libcfs hash code cleanup
From: James Simmons This patch covers more style cleanup series for the libcfs hash code. Mostly removal of white spaces and resolving the checkpath issues in libcfs_hash.h. James Simmons (6): staging: lustre: remove white space in libcfs_hash.h staging: lustre: remove obsolete comment in libcfs_hash.h staging: lustre: move linux hash.h header to start of libcfs_hash.h staging: lustre: fix remaining checkpatch issues for libcfs_hash.h staging: lustre: remove white space in hash.c staging: lustre: place linux header first in hash.c .../lustre/include/linux/libcfs/libcfs_hash.h | 170 +- drivers/staging/lustre/lustre/libcfs/hash.c| 344 ++-- 2 files changed, 266 insertions(+), 248 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/6] staging: lustre: move linux hash.h header to start of libcfs_hash.h
From: James Simmons Minor style cleanup to put hash.h header to the top of the libcfs_hash.h file. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 4a78e6d..2e0c892 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -41,6 +41,9 @@ #ifndef __LIBCFS_HASH_H__ #define __LIBCFS_HASH_H__ + +#include + /* * Knuth recommends primes in approximately golden ratio to the maximum * integer representable by a machine word for multiplicative hashing. @@ -56,8 +59,6 @@ /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffc0001ULL -#include - /** disable debug */ #define CFS_HASH_DEBUG_NONE0 /** record hash depth and output to console when it's too deep, -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/6] staging: lustre: fix remaining checkpatch issues for libcfs_hash.h
From: James Simmons Final cleanup to make libcfs_hash.h completely kernel standard compliant. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 25 --- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 2e0c892..6bd2012 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -61,8 +61,10 @@ /** disable debug */ #define CFS_HASH_DEBUG_NONE0 -/** record hash depth and output to console when it's too deep, - * computing overhead is low but consume more memory */ +/* + * record hash depth and output to console when it's too deep, + * computing overhead is low but consume more memory + */ #define CFS_HASH_DEBUG_1 1 /** expensive, check key validation */ #define CFS_HASH_DEBUG_2 2 @@ -158,7 +160,8 @@ enum cfs_hash_tag { */ CFS_HASH_NBLK_CHANGE= 1 << 13, /** NB, we typed hs_flags as __u16, please change it -* if you need to extend >=16 flags */ +* if you need to extend >=16 flags +*/ }; /** most used attributes */ @@ -205,8 +208,10 @@ enum cfs_hash_tag { */ struct cfs_hash { - /** serialize with rehash, or serialize all operations if -* the hash-table has CFS_HASH_NO_BKTLOCK */ + /* +* serialize with rehash, or serialize all operations if +* the hash-table has CFS_HASH_NO_BKTLOCK +*/ union cfs_hash_lock hs_lock; /** hash operations */ struct cfs_hash_ops *hs_ops; @@ -373,9 +378,11 @@ cfs_hash_with_add_tail(struct cfs_hash *hs) static inline int cfs_hash_with_no_itemref(struct cfs_hash *hs) { - /* hash-table doesn't keep refcount on item, + /* +* hash-table doesn't keep refcount on item, * item can't be removed from hash unless it's -* ZERO refcount */ +* ZERO refcount. +*/ return (hs->hs_flags & CFS_HASH_NO_ITEMREF) != 0; } @@ -820,7 +827,7 @@ cfs_hash_djb2_hash(const void *key, size_t size, unsigned mask) { unsigned i, hash = 5381; - LASSERT(key != NULL); + LASSERT(key); for (i = 0; i < size; i++) hash = hash * 33 + ((char *)key)[i]; @@ -848,7 +855,7 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ #define cfs_hash_for_each_bd(bds, n, i)\ - for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) + for (i = 0; i < n && (bds)[i].bd_bucket; i++) /** iterate over all buckets of @hs */ #define cfs_hash_for_each_bucket(hs, bd, pos) \ -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/6] staging: lustre: remove white space in hash.c
From: James Simmons Cleanup all the unneeded white space in hash.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/libcfs/hash.c | 342 ++- 1 files changed, 177 insertions(+), 165 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 0308744..ed4e1f1 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -161,49 +161,49 @@ cfs_hash_rw_unlock(union cfs_hash_lock *lock, int exclusive) /** No lock hash */ static struct cfs_hash_lock_ops cfs_hash_nl_lops = { .hs_lock= cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock= cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock= cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** no bucket lock, one spinlock to protect everything */ static struct cfs_hash_lock_ops cfs_hash_nbl_lops = { .hs_lock= cfs_hash_spin_lock, - .hs_unlock = cfs_hash_spin_unlock, - .hs_bkt_lock= cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_spin_unlock, + .hs_bkt_lock= cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** spin bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_spin_lops = { .hs_lock= cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock= cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock= cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_rw_lops = { .hs_lock= cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock= cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock= cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; /** spin bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_spin_lops = { .hs_lock= cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock= cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock= cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_rw_lops = { .hs_lock= cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock= cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock= cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; static void @@ -280,7 +280,7 @@ cfs_hash_hh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_head_dep { struct hlist_head hd_head;/**< entries list */ - unsigned inthd_depth; /**< list length */ + unsigned inthd_depth; /**< list length */ }; static int @@ -328,7 +328,7 @@ cfs_hash_hd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead { struct hlist_head dh_head;/**< entries list */ - struct hlist_node *dh_tail; /**< the last entry */ + struct hlist_node *dh_tail; /**< the last entry */ }; static int @@ -384,8 +384,8 @@ cfs_hash_dh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead_dep { struct hlist_head dd_head;/**< entries list */ - struct hlist_node *dd_tail; /**< the last entry */ - unsigned intdd_depth; /**< list length */ + struct hlist_node *dd_tail; /**< the last entry */ + unsigned intdd_depth; /**< list length */ }; static int @@ -436,31 +436,31 @@ cfs_hash_dd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, } static struct cfs_hash_hlist_ops cfs_hash_hh_hops = { - .hop_hhead = cfs_hash_hh_hhead, - .hop_hhead_size = cfs_hash_hh_hhead_size, - .hop_hnode_add = cfs_hash_hh_hnode_add, - .hop_hnode_del = cfs_hash_hh_hnode_del, + .hop_hhead = cfs_hash_hh_hhead, + .hop_hhead_size = cfs_hash_hh_hhead_size, + .hop_hnode_add = cfs_hash_hh_hnode_add, + .hop_hnode_del = cfs_hash_hh_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_hd_hops = { - .hop_hhead = cfs_hash_hd_hhead, - .hop_hhead_size = cfs_hash_hd_hhead_size, -
[PATCH 1/6] staging: lustre: remove white space in libcfs_hash.h
From: James Simmons Cleanup all the unneeded white space in libcfs_hash.h. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 135 ++-- 1 files changed, 70 insertions(+), 65 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 70b8b29..4d73f8a 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -66,12 +66,12 @@ #include /** disable debug */ -#define CFS_HASH_DEBUG_NONE 0 +#define CFS_HASH_DEBUG_NONE0 /** record hash depth and output to console when it's too deep, * computing overhead is low but consume more memory */ -#define CFS_HASH_DEBUG_1 1 +#define CFS_HASH_DEBUG_1 1 /** expensive, check key validation */ -#define CFS_HASH_DEBUG_2 2 +#define CFS_HASH_DEBUG_2 2 #define CFS_HASH_DEBUG_LEVEL CFS_HASH_DEBUG_NONE @@ -108,16 +108,18 @@ struct cfs_hash_bucket { * cfs_hash bucket descriptor, it's normally in stack of caller */ struct cfs_hash_bd { - struct cfs_hash_bucket *bd_bucket; /**< address of bucket */ - unsigned intbd_offset; /**< offset in bucket */ + /* address of bucket */ + struct cfs_hash_bucket *bd_bucket; + /* offset in bucket */ + unsigned int bd_offset; }; -#define CFS_HASH_NAME_LEN 16 /**< default name length */ -#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ +#define CFS_HASH_NAME_LEN 16 /**< default name length */ +#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ -#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ -#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ -#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS +#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ +#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ +#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS /** * common hash attributes. @@ -133,41 +135,41 @@ enum cfs_hash_tag { */ CFS_HASH_NO_LOCK= 1 << 0, /** no bucket lock, use one spinlock to protect the whole hash */ - CFS_HASH_NO_BKTLOCK = 1 << 1, + CFS_HASH_NO_BKTLOCK = 1 << 1, /** rwlock to protect bucket */ - CFS_HASH_RW_BKTLOCK = 1 << 2, + CFS_HASH_RW_BKTLOCK = 1 << 2, /** spinlock to protect bucket */ - CFS_HASH_SPIN_BKTLOCK = 1 << 3, + CFS_HASH_SPIN_BKTLOCK = 1 << 3, /** always add new item to tail */ - CFS_HASH_ADD_TAIL = 1 << 4, + CFS_HASH_ADD_TAIL = 1 << 4, /** hash-table doesn't have refcount on item */ - CFS_HASH_NO_ITEMREF = 1 << 5, + CFS_HASH_NO_ITEMREF = 1 << 5, /** big name for param-tree */ CFS_HASH_BIGNAME= 1 << 6, /** track global count */ CFS_HASH_COUNTER= 1 << 7, /** rehash item by new key */ - CFS_HASH_REHASH_KEY = 1 << 8, + CFS_HASH_REHASH_KEY = 1 << 8, /** Enable dynamic hash resizing */ - CFS_HASH_REHASH = 1 << 9, + CFS_HASH_REHASH = 1 << 9, /** can shrink hash-size */ - CFS_HASH_SHRINK = 1 << 10, + CFS_HASH_SHRINK = 1 << 10, /** assert hash is empty on exit */ - CFS_HASH_ASSERT_EMPTY = 1 << 11, + CFS_HASH_ASSERT_EMPTY = 1 << 11, /** record hlist depth */ - CFS_HASH_DEPTH= 1 << 12, + CFS_HASH_DEPTH = 1 << 12, /** * rehash is always scheduled in a different thread, so current * change on hash table is non-blocking */ - CFS_HASH_NBLK_CHANGE= 1 << 13, + CFS_HASH_NBLK_CHANGE= 1 << 13, /** NB, we typed hs_flags as __u16, please change it * if you need to extend >=16 flags */ }; /** most used attributes */ -#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ - CFS_HASH_COUNTER | CFS_HASH_REHASH) +#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ +CFS_HASH_COUNTER | CFS_HASH_REHASH) /** * cfs_hash is a hash-table implementation for general purpose, it can support: @@ -211,7 +213,7 @@ enum cfs_hash_tag { struct cfs_hash { /** serialize with rehash, or serialize all operations if * the hash-table has CFS_HASH_NO_BKTLOCK */ - union cfs_hash_lock hs_lock; + union cfs_hash_lock hs_lock; /** hash operations */ struct cfs_hash_ops *hs_ops; /** hash lock operations */ @@ -219,57 +221,57 @@ struct cfs_hash { /** hash list operations */ struct cfs_hash_hlist_ops *hs_hops; /** hash buckets-table */ - struct cfs_hash_bucket *
[PATCH] Staging: comedi: fixed comment, added a new line
From 16dae6c28a46ae257dcedd51d973aee7821053f3 Mon Sep 17 00:00:00 2001 From: Philippe Loctaux Date: Thu, 29 Oct 2015 22:45:16 +0100 Subject: [PATCH] Staging: comedi: fixed comment, added a new line Signed-off-by: Philippe Loctaux ---  drivers/staging/comedi/drivers/ssv_dnp.c | 3 ++-  1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index acc7f34..c28b6cb 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -150,7 +150,8 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it)   /* We use the I/O ports 0x22,0x23 and 0xa3-0xa9, which are always   * allocated for the primary 8259, so we don't need to allocate them -  * ourselves. */ +  * ourselves. +  */   /* configure all ports as input (default)*/  outb(PAMR, CSCIR); -- 2.6.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 01/12] staging: wilc1000: fix return type of host_int_del_beacon
This patch changes return type of host_int_del_beacon from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dbbe72c..b469962 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4495,9 +4495,9 @@ ERRORHANDLER: return result; } -s32 host_int_del_beacon(struct host_if_drv *hif_drv) +int host_int_del_beacon(struct host_if_drv *hif_drv) { - s32 result = 0; + int result = 0; struct host_if_msg msg; if (!hif_drv) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index b854db5..698a588 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -932,7 +932,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, * @date 10 Julys 2012 * @version 1.0 Description */ -s32 host_int_del_beacon(struct host_if_drv *hWFIDrv); +int host_int_del_beacon(struct host_if_drv *hWFIDrv); /*! * @fns32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 02/12] staging: wilc1000: fix parameter name of host_int_del_beacon
This patch changes struct host_if_drv of host_int_del_beacon function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 698a588..36de990 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -932,7 +932,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, * @date 10 Julys 2012 * @version 1.0 Description */ -int host_int_del_beacon(struct host_if_drv *hWFIDrv); +int host_int_del_beacon(struct host_if_drv *hif_drv); /*! * @fns32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 03/12] staging: wilc1000: fix return type of host_int_del_station
This patch changes return type of host_int_del_station from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b469962..be5e652 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4552,9 +4552,9 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, return result; } -s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) { - s32 result = 0; + int result = 0; struct host_if_msg msg; struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 36de990..9eb1b3b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE * @date 15 July 2012 * @version 1.0 Description */ -s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); /*! * @fns32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 05/12] staging: wilc1000: rename pu8MacAddr in host_int_del_station
This patch changes pu8MacAddr to mac_addr that is second argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index be5e652..8dba9a3 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4552,7 +4552,7 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, return result; } -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; @@ -4570,10 +4570,10 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) msg.id = HOST_IF_MSG_DEL_STATION; msg.drv = hif_drv; - if (!pu8MacAddr) + if (!mac_addr) eth_broadcast_addr(pstrDelStationMsg->mac_addr); else - memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN); + memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 083def57..be9283f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE * @date 15 July 2012 * @version 1.0 Description */ -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr); /*! * @fns32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 11/12] staging: wilc1000: use kmemdup in host_int_add_station
This patch replaces kmalloc followed by memcpy with kmemdup. Signed-off-by: Chaehyun Lim --- V2: add wilc1000 driver name in commit title because driver name is not included at V1. drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3c5de75..6b804e6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4537,12 +4537,12 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->u8NumRates > 0) { - u8 *rates = kmalloc(add_sta_info->u8NumRates, GFP_KERNEL); - + u8 *rates = kmemdup(sta_param->pu8Rates, + add_sta_info->u8NumRates, + GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, sta_param->pu8Rates, add_sta_info->u8NumRates); add_sta_info->pu8Rates = rates; } -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 04/12] staging: wilc1000: fix parameter name of host_int_del_station
This patch changes struct host_if_drv of host_int_del_station function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 9eb1b3b..083def57 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -979,7 +979,7 @@ s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALE * @date 15 July 2012 * @version 1.0 Description */ -int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr); /*! * @fns32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 07/12] staging: wilc1000: fix return type of host_int_add_station
This patch changes return type of host_int_add_station from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index fe4ccdb..0f36825 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4516,10 +4516,10 @@ int host_int_del_beacon(struct host_if_drv *hif_drv) return result; } -s32 host_int_add_station(struct host_if_drv *hif_drv, +int host_int_add_station(struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams) { - s32 result = 0; + int result = 0; struct host_if_msg msg; struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index be9283f..3fcff7a 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -948,7 +948,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv); * @date 12 July 2012 * @version 1.0 Description */ -s32 host_int_add_station(struct host_if_drv *hWFIDrv, +int host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); /*! -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 06/12] staging: wilc1000: rename pstrDelStationMsg in host_int_del_station
This patch renames pstrDelStationMsg to del_sta_info to avoid camelcase. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8dba9a3..fe4ccdb 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4556,7 +4556,7 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; - struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; + struct del_sta *del_sta_info = &msg.body.del_sta_info; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4571,9 +4571,9 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) msg.drv = hif_drv; if (!mac_addr) - eth_broadcast_addr(pstrDelStationMsg->mac_addr); + eth_broadcast_addr(del_sta_info->mac_addr); else - memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN); + memcpy(del_sta_info->mac_addr, mac_addr, ETH_ALEN); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 12/12] staging: wilc1000: remove rates in host_int_add_station
Instead of using rates variable, it is used as add_sta_info->pu8Rates directly. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6b804e6..e2bdac8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4537,13 +4537,11 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->u8NumRates > 0) { - u8 *rates = kmemdup(sta_param->pu8Rates, - add_sta_info->u8NumRates, - GFP_KERNEL); - if (!rates) + add_sta_info->pu8Rates = kmemdup(sta_param->pu8Rates, +add_sta_info->u8NumRates, +GFP_KERNEL); + if (!add_sta_info->pu8Rates) return -ENOMEM; - - add_sta_info->pu8Rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 10/12] staging: wilc1000: rename pstrAddStationMsg in host_int_add_station
This patch renames pstrAddStationMsg to add_sta_info to avoid camelcase. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 57287d4..3c5de75 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4521,7 +4521,7 @@ int host_int_add_station(struct host_if_drv *hif_drv, { int result = 0; struct host_if_msg msg; - struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; + struct add_sta_param *add_sta_info = &msg.body.add_sta_info; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4535,15 +4535,15 @@ int host_int_add_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_ADD_STATION; msg.drv = hif_drv; - memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param)); - if (pstrAddStationMsg->u8NumRates > 0) { - u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); + memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); + if (add_sta_info->u8NumRates > 0) { + u8 *rates = kmalloc(add_sta_info->u8NumRates, GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, sta_param->pu8Rates, pstrAddStationMsg->u8NumRates); - pstrAddStationMsg->pu8Rates = rates; + memcpy(rates, sta_param->pu8Rates, add_sta_info->u8NumRates); + add_sta_info->pu8Rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 09/12] staging: wilc1000: rename pstrStaParams in host_int_add_station
This patch renames pstrStaParams to sta_param to avoid camelcase. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0f36825..57287d4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4517,7 +4517,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv) } int host_int_add_station(struct host_if_drv *hif_drv, -struct add_sta_param *pstrStaParams) +struct add_sta_param *sta_param) { int result = 0; struct host_if_msg msg; @@ -4535,14 +4535,14 @@ int host_int_add_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_ADD_STATION; msg.drv = hif_drv; - memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); + memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, sta_param->pu8Rates, pstrAddStationMsg->u8NumRates); pstrAddStationMsg->pu8Rates = rates; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 7c9c4c6..aa92762 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -949,7 +949,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv); * @version 1.0 Description */ int host_int_add_station(struct host_if_drv *hif_drv, -struct add_sta_param *pstrStaParams); +struct add_sta_param *sta_param); /*! * @fns32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr) -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 08/12] staging: wilc1000: fix parameter name of host_int_add_station
This patch changes struct host_if_drv of host_int_add_station function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim --- V2: resend because 11/12 patch is changed. drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 3fcff7a..7c9c4c6 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -948,7 +948,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv); * @date 12 July 2012 * @version 1.0 Description */ -int host_int_add_station(struct host_if_drv *hWFIDrv, +int host_int_add_station(struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams); /*! -- 2.6.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: lustre: checkpatch cleanups for nidstring.c
With nidstring now having the latest fixes we can now clean up all the remaining checkpatch errors for nidstring.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/nidstrings.c | 80 ++--- 1 files changed, 44 insertions(+), 36 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 80f585a..ee04c3b 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -162,6 +162,7 @@ struct addrrange { static int parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) { + struct netstrfns *nf = nidrange->nr_netstrfns; struct addrrange *addrrange; if (src->ls_len == 1 && src->ls_str[0] == '*') { @@ -170,14 +171,13 @@ parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) } LIBCFS_ALLOC(addrrange, sizeof(struct addrrange)); - if (addrrange == NULL) + if (!addrrange) return -ENOMEM; list_add_tail(&addrrange->ar_link, &nidrange->nr_addrranges); INIT_LIST_HEAD(&addrrange->ar_numaddr_ranges); - return nidrange->nr_netstrfns->nf_parse_addrlist(src->ls_str, - src->ls_len, - &addrrange->ar_numaddr_ranges); + return nf->nf_parse_addrlist(src->ls_str, src->ls_len, +&addrrange->ar_numaddr_ranges); } /** @@ -203,16 +203,18 @@ add_nidrange(const struct cfs_lstr *src, return NULL; nf = libcfs_namenum2netstrfns(src->ls_str); - if (nf == NULL) + if (!nf) return NULL; endlen = src->ls_len - strlen(nf->nf_name); if (endlen == 0) /* network name only, e.g. "elan" or "tcp" */ netnum = 0; else { - /* e.g. "elan25" or "tcp23", refuse to parse if + /* +* e.g. "elan25" or "tcp23", refuse to parse if * network name is not appended with decimal or -* hexadecimal number */ +* hexadecimal number +*/ if (!cfs_str2num_check(src->ls_str + strlen(nf->nf_name), endlen, &netnum, 0, MAX_NUMERIC_VALUE)) return NULL; @@ -227,7 +229,7 @@ add_nidrange(const struct cfs_lstr *src, } LIBCFS_ALLOC(nr, sizeof(struct nidrange)); - if (nr == NULL) + if (!nr) return NULL; list_add_tail(&nr->nr_link, nidlist); INIT_LIST_HEAD(&nr->nr_addrranges); @@ -256,11 +258,11 @@ parse_nidrange(struct cfs_lstr *src, struct list_head *nidlist) if (cfs_gettok(src, '@', &addrrange) == 0) goto failed; - if (cfs_gettok(src, '@', &net) == 0 || src->ls_str != NULL) + if (cfs_gettok(src, '@', &net) == 0 || src->ls_str) goto failed; nr = add_nidrange(&net, nidlist); - if (nr == NULL) + if (!nr) goto failed; if (parse_addrange(&addrrange, nr) != 0) @@ -370,15 +372,17 @@ int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist) struct addrrange *ar; list_for_each_entry(nr, nidlist, nr_link) { - if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid))) + struct netstrfns *nf = nr->nr_netstrfns; + + if (nf->nf_type != LNET_NETTYP(LNET_NIDNET(nid))) continue; if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid))) continue; if (nr->nr_all) return 1; list_for_each_entry(ar, &nr->nr_addrranges, ar_link) - if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid), - &ar->ar_numaddr_ranges)) + if (nf->nf_match_addr(LNET_NIDADDR(nid), + &ar->ar_numaddr_ranges)) return 1; } return 0; @@ -487,13 +491,13 @@ static void cfs_ip_ar_min_max(struct addrrange *ar, __u32 *min_nid, tmp_ip_addr = ((min_ip[0] << 24) | (min_ip[1] << 16) | (min_ip[2] << 8) | min_ip[3]); - if (min_nid != NULL) + if (min_nid) *min_nid = tmp_ip_addr; tmp_ip_addr = ((max_ip[0] << 24) | (max_ip[1] << 16) | (max_ip[2] << 8) | max_ip[3]); - if (max_nid != NULL) + if (max_nid) *max_nid = tmp_ip_addr; } @@ -522,9 +526,9 @@ static void cfs_num_ar_min_max(struct addrrange *ar, __u32 *min_nid, } } - if (min_nid != NULL) + if (min_nid) *min_nid = min_addr; - if (max_nid != NULL) + if (max_nid)
[PATCH 2/3] staging: lustre: white space cleanups for nidstring.c
Remove the remaining white spaces in nidstring.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/nidstrings.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index ee04c3b..7df8599 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -799,11 +799,11 @@ libcfs_ip_addr2str(__u32 addr, char *str, size_t size) static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) { - unsigned inta; - unsigned intb; - unsigned intc; - unsigned intd; - int n = nob; /* XscanfX */ + unsigned int a; + unsigned int b; + unsigned int c; + unsigned int d; + int n = nob; /* XscanfX */ /* numeric IP? */ if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 && @@ -902,7 +902,7 @@ libcfs_decnum_addr2str(__u32 addr, char *str, size_t size) static int libcfs_num_str2addr(const char *str, int nob, __u32 *addr) { - int n; + int n; n = nob; if (sscanf(str, "0x%x%n", addr, &n) >= 1 && n == nob) @@ -931,7 +931,7 @@ static int libcfs_num_parse(char *str, int len, struct list_head *list) { struct cfs_expr_list *el; - int rc; + int rc; rc = cfs_expr_list_parse(str, len, 0, MAX_NUMERIC_VALUE, &el); if (rc == 0) @@ -1054,7 +1054,7 @@ libcfs_namenum2netstrfns(const char *name) static struct netstrfns * libcfs_name2netstrfns(const char *name) { - inti; + int i; for (i = 0; i < libcfs_nnetstrfns; i++) if (!strcmp(libcfs_netstrfns[i].nf_name, name)) @@ -1201,7 +1201,7 @@ libcfs_str2net_internal(const char *str, __u32 *net) __u32 libcfs_str2net(const char *str) { - __u32 net; + __u32 net; if (libcfs_str2net_internal(str, &net)) return net; -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] make nidstring.c kernel style compliant
Last patch set to make nidstring.c and nidstr.h both report no errors with checkpatch and removal of the remaining white spaces. James Simmons (3): staging: lustre: checkpatch cleanups for nidstring.c staging: lustre: white space cleanups for nidstring.c staging: lustre: checkpatch cleanups for nidstr.h drivers/staging/lustre/include/linux/lnet/nidstr.h |9 ++- drivers/staging/lustre/lnet/lnet/nidstrings.c | 98 +++- 2 files changed, 60 insertions(+), 47 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: lustre: checkpatch cleanups for nidstr.h
With nidstr.h now having the latest fixes we can now clean up all the remaining checkpatch errors for this header. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/nidstr.h |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 46ad914..ad591d2 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -34,8 +34,10 @@ * Lustre Network Driver types. */ enum { - /* Only add to these values (i.e. don't ever change or redefine them): -* network addresses depend on them... */ + /* +* Only add to these values (i.e. don't ever change or redefine them): +* network addresses depend on them... +*/ QSWLND = 1, SOCKLND = 2, GMLND = 3, @@ -67,6 +69,7 @@ static inline char *libcfs_lnd2str(__u32 lnd) return libcfs_lnd2str_r(lnd, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + int libcfs_str2lnd(const char *str); char *libcfs_net2str_r(__u32 net, char *buf, size_t buf_size); static inline char *libcfs_net2str(__u32 net) @@ -74,12 +77,14 @@ static inline char *libcfs_net2str(__u32 net) return libcfs_net2str_r(net, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size); static inline char *libcfs_nid2str(lnet_nid_t nid) { return libcfs_nid2str_r(nid, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + __u32 libcfs_str2net(const char *str); lnet_nid_t libcfs_str2nid(const char *str); int libcfs_str2anynid(lnet_nid_t *nid, const char *str); -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 00/10] Drivers: hv: Miscellaneous fixes.
Miscellaneous fixes. In this version I have addressed review comments from Vitaly Kuznetsov . Also fixed up the authorship of the patch: drivers/hv: cleanup synic msrs if vmbus connect failed Andrey Smetanin (1): drivers/hv: cleanup synic msrs if vmbus connect failed Jake Oshins (3): drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num drivers:hv: Export the API to invoke a hypercall on Hyper-V drivers:hv: Define the channel type for Hyper-V PCI Express pass-through K. Y. Srinivasan (1): Drivers: hv: util: Increase the timeout for util services Olaf Hering (5): Drivers: hv: utils: run polling callback always in interrupt context tools: hv: report ENOSPC errors in hv_fcopy_daemon tools: hv: remove repeated HV_FCOPY string Drivers: hv: util: catch allocation errors Drivers: hv: utils: use memdup_user in hvt_op_write drivers/hv/channel_mgmt.c |3 +++ drivers/hv/hv.c | 20 ++-- drivers/hv/hv_fcopy.c | 37 +++-- drivers/hv/hv_kvp.c | 31 --- drivers/hv/hv_snapshot.c| 29 +++-- drivers/hv/hv_utils_transport.c | 18 ++ drivers/hv/hyperv_vmbus.h | 13 +++-- drivers/hv/vmbus_drv.c | 21 - include/linux/hyperv.h | 14 ++ include/uapi/linux/hyperv.h |1 + tools/hv/hv_fcopy_daemon.c | 24 +++- 11 files changed, 122 insertions(+), 89 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 10/10] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through
From: Jake Oshins This defines the channel type for PCI front-ends in Hyper-V VMs. Signed-off-by: Jake Oshins Signed-off-by: K. Y. Srinivasan --- drivers/hv/channel_mgmt.c |3 +++ include/linux/hyperv.h| 11 +++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 652afd1..a77646b 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -358,6 +358,7 @@ enum { SCSI, NIC, ND_NIC, + PCIE, MAX_PERF_CHN, }; @@ -375,6 +376,8 @@ static const struct hv_vmbus_device_id hp_devs[] = { { HV_NIC_GUID, }, /* NetworkDirect Guest RDMA */ { HV_ND_GUID, }, + /* PCI Express Pass Through */ + { HV_PCIE_GUID, }, }; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index ea0a0e3..5587899 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1140,6 +1140,17 @@ u64 hv_do_hypercall(u64 control, void *input, void *output); } /* + * PCI Express Pass Through + * {44C4F61D--4400-9D52-802E27EDE19F} + */ + +#define HV_PCIE_GUID \ + .guid = { \ + 0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \ + 0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \ + } + +/* * Common header for Hyper-V ICs */ -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 01/10] Drivers: hv: util: Increase the timeout for util services
Util services such as KVP and FCOPY need assistance from daemon's running in user space. Increase the timeout so we don't prematurely terminate the transaction in the kernel. Host sets up a 60 second timeout for all util driver transactions. The host will retry the transaction if it times out. Set the guest timeout at 30 seconds. Signed-off-by: K. Y. Srinivasan --- V2: Added additional details to commit log - Olaf drivers/hv/hv_fcopy.c |3 ++- drivers/hv/hv_kvp.c |3 ++- drivers/hv/hyperv_vmbus.h |5 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index db4b887..bbdec50 100644 --- a/drivers/hv/hv_fcopy.c +++ b/drivers/hv/hv_fcopy.c @@ -275,7 +275,8 @@ void hv_fcopy_onchannelcallback(void *context) * Send the information to the user-level daemon. */ schedule_work(&fcopy_send_work); - schedule_delayed_work(&fcopy_timeout_work, 5*HZ); + schedule_delayed_work(&fcopy_timeout_work, + HV_UTIL_TIMEOUT * HZ); return; } icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index 74c38a9..e6aa33a 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -668,7 +668,8 @@ void hv_kvp_onchannelcallback(void *context) * user-mode not responding. */ schedule_work(&kvp_sendkey_work); - schedule_delayed_work(&kvp_timeout_work, 5*HZ); + schedule_delayed_work(&kvp_timeout_work, + HV_UTIL_TIMEOUT * HZ); return; diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 3d70e36..f26599b 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -31,6 +31,11 @@ #include /* + * Timeout for services such as KVP and fcopy. + */ +#define HV_UTIL_TIMEOUT 30 + +/* * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent * is set by CPUID(HVCPUID_VERSION_FEATURES). */ -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 07/10] drivers/hv: cleanup synic msrs if vmbus connect failed
From: Andrey Smetanin Before vmbus_connect() synic is setup per vcpu - this means hypervisor receives writes at synic msr's and probably allocate hypervisor resources per synic setup. If vmbus_connect() failed for some reason it's neccessary to cleanup synic setup by call hv_synic_cleanup() at each vcpu to get a chance to free allocated resources by hypervisor per synic. This patch does appropriate cleanup in case of vmbus_connect() failure. Signed-off-by: Andrey Smetanin Signed-off-by: Denis V. Lunev Reviewed-by: Vitaly Kuznetsov CC: "K. Y. Srinivasan" CC: Haiyang Zhang CC: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- V2: Fixed up the name of the author (Denis) drivers/hv/vmbus_drv.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index f19b6f7..3297731 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -867,7 +867,7 @@ static int vmbus_bus_init(int irq) on_each_cpu(hv_synic_init, NULL, 1); ret = vmbus_connect(); if (ret) - goto err_alloc; + goto err_connect; if (vmbus_proto_version > VERSION_WIN7) cpu_hotplug_disable(); @@ -885,6 +885,8 @@ static int vmbus_bus_init(int irq) return 0; +err_connect: + on_each_cpu(hv_synic_cleanup, NULL, 1); err_alloc: hv_synic_free(); hv_remove_vmbus_irq(); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 06/10] Drivers: hv: utils: use memdup_user in hvt_op_write
From: Olaf Hering Use memdup_user to handle OOM. Fixes: 14b50f80c32d ('Drivers: hv: util: introduce hv_utils_transport abstraction') Signed-off-by: Olaf Hering Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv_utils_transport.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c index 1505ee6..24b2766 100644 --- a/drivers/hv/hv_utils_transport.c +++ b/drivers/hv/hv_utils_transport.c @@ -80,11 +80,10 @@ static ssize_t hvt_op_write(struct file *file, const char __user *buf, hvt = container_of(file->f_op, struct hvutil_transport, fops); - inmsg = kzalloc(count, GFP_KERNEL); - if (copy_from_user(inmsg, buf, count)) { - kfree(inmsg); - return -EFAULT; - } + inmsg = memdup_user(buf, count); + if (IS_ERR(inmsg)) + return PTR_ERR(inmsg); + if (hvt->on_msg(inmsg, count)) return -EFAULT; kfree(inmsg); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 05/10] Drivers: hv: util: catch allocation errors
From: Olaf Hering Catch allocation errors in hvutil_transport_send. Fixes: 14b50f80c32d ('Drivers: hv: util: introduce hv_utils_transport abstraction') Signed-off-by: Olaf Hering Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv_utils_transport.c |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c index 6a9d80a..1505ee6 100644 --- a/drivers/hv/hv_utils_transport.c +++ b/drivers/hv/hv_utils_transport.c @@ -204,9 +204,12 @@ int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len) goto out_unlock; } hvt->outmsg = kzalloc(len, GFP_KERNEL); - memcpy(hvt->outmsg, msg, len); - hvt->outmsg_len = len; - wake_up_interruptible(&hvt->outmsg_q); + if (hvt->outmsg) { + memcpy(hvt->outmsg, msg, len); + hvt->outmsg_len = len; + wake_up_interruptible(&hvt->outmsg_q); + } else + ret = -ENOMEM; out_unlock: mutex_unlock(&hvt->outmsg_lock); return ret; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 02/10] Drivers: hv: utils: run polling callback always in interrupt context
From: Olaf Hering All channel interrupts are bound to specific VCPUs in the guest at the point channel is created. While currently, we invoke the polling function on the correct CPU (the CPU to which the channel is bound to) in some cases we may run the polling function in a non-interrupt context. This potentially can cause an issue as the polling function can be interrupted by the channel callback function. Fix the issue by running the polling function on the appropriate CPU at interrupt level. Additional details of the issue being addressed by this patch are given below: Currently hv_fcopy_onchannelcallback is called from interrupts and also via the ->write function of hv_utils. Since the used global variables to maintain state are not thread safe the state can get out of sync. This affects the variable state as well as the channel inbound buffer. As suggested by KY adjust hv_poll_channel to always run the given callback on the cpu which the channel is bound to. This avoids the need for locking because all the util services are single threaded and only one transaction is active at any given point in time. Additionally, remove the context variable, they will always be the same as recv_channel. Signed-off-by: Olaf Hering Signed-off-by: K. Y. Srinivasan --- V2: Added the check to catch unsolicited daemon writes - Vitaly drivers/hv/hv_fcopy.c | 34 +- drivers/hv/hv_kvp.c | 28 ++-- drivers/hv/hv_snapshot.c | 29 +++-- drivers/hv/hyperv_vmbus.h |6 +- 4 files changed, 35 insertions(+), 62 deletions(-) diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index bbdec50..06a7166 100644 --- a/drivers/hv/hv_fcopy.c +++ b/drivers/hv/hv_fcopy.c @@ -51,7 +51,6 @@ static struct { struct hv_fcopy_hdr *fcopy_msg; /* current message */ struct vmbus_channel *recv_channel; /* chn we got the request */ u64 recv_req_id; /* request ID. */ - void *fcopy_context; /* for the channel callback */ } fcopy_transaction; static void fcopy_respond_to_host(int error); @@ -67,6 +66,13 @@ static struct hvutil_transport *hvt; */ static int dm_reg_value; +static void fcopy_poll_wrapper(void *channel) +{ + /* Transaction is finished, reset the state here to avoid races. */ + fcopy_transaction.state = HVUTIL_READY; + hv_fcopy_onchannelcallback(channel); +} + static void fcopy_timeout_func(struct work_struct *dummy) { /* @@ -74,13 +80,7 @@ static void fcopy_timeout_func(struct work_struct *dummy) * process the pending transaction. */ fcopy_respond_to_host(HV_E_FAIL); - - /* Transaction is finished, reset the state. */ - if (fcopy_transaction.state > HVUTIL_READY) - fcopy_transaction.state = HVUTIL_READY; - - hv_poll_channel(fcopy_transaction.fcopy_context, - hv_fcopy_onchannelcallback); + hv_poll_channel(fcopy_transaction.recv_channel, fcopy_poll_wrapper); } static int fcopy_handle_handshake(u32 version) @@ -108,9 +108,9 @@ static int fcopy_handle_handshake(u32 version) return -EINVAL; } pr_debug("FCP: userspace daemon ver. %d registered\n", version); + /* Forward state for hv_fcopy_onchannelcallback */ fcopy_transaction.state = HVUTIL_READY; - hv_poll_channel(fcopy_transaction.fcopy_context, - hv_fcopy_onchannelcallback); + hv_poll_channel(fcopy_transaction.recv_channel, fcopy_poll_wrapper); return 0; } @@ -227,15 +227,8 @@ void hv_fcopy_onchannelcallback(void *context) int util_fw_version; int fcopy_srv_version; - if (fcopy_transaction.state > HVUTIL_READY) { - /* -* We will defer processing this callback once -* the current transaction is complete. -*/ - fcopy_transaction.fcopy_context = context; + if (fcopy_transaction.state > HVUTIL_READY) return; - } - fcopy_transaction.fcopy_context = NULL; vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen, &requestid); @@ -305,9 +298,8 @@ static int fcopy_on_msg(void *msg, int len) if (cancel_delayed_work_sync(&fcopy_timeout_work)) { fcopy_transaction.state = HVUTIL_USERSPACE_RECV; fcopy_respond_to_host(*val); - fcopy_transaction.state = HVUTIL_READY; - hv_poll_channel(fcopy_transaction.fcopy_context, - hv_fcopy_onchannelcallback); + hv_poll_channel(fcopy_transaction.recv_channel, + fcopy_poll_wrapper); } return 0; diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index e6aa33a..2a3420c 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -66,7 +66,6 @@ static struct { str
[PATCH V2 09/10] drivers:hv: Export the API to invoke a hypercall on Hyper-V
From: Jake Oshins This patch exposes the function that hv_vmbus.ko uses to make hypercalls. This is necessary for retargeting an interrupt when it is given a new affinity. Since we are exporting this API, rename the API as it will be visible outside the hv.c file. Signed-off-by: Jake Oshins Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv.c | 20 ++-- drivers/hv/hyperv_vmbus.h |2 +- include/linux/hyperv.h|1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 6341be8..7a06933 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -89,9 +89,9 @@ static int query_hypervisor_info(void) } /* - * do_hypercall- Invoke the specified hypercall + * hv_do_hypercall- Invoke the specified hypercall */ -static u64 do_hypercall(u64 control, void *input, void *output) +u64 hv_do_hypercall(u64 control, void *input, void *output) { u64 input_address = (input) ? virt_to_phys(input) : 0; u64 output_address = (output) ? virt_to_phys(output) : 0; @@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output) return hv_status_lo | ((u64)hv_status_hi << 32); #endif /* !x86_64 */ } +EXPORT_SYMBOL_GPL(hv_do_hypercall); #ifdef CONFIG_X86_64 static cycle_t read_hv_clock_tsc(struct clocksource *arg) @@ -315,7 +316,7 @@ int hv_post_message(union hv_connection_id connection_id, { struct hv_input_post_message *aligned_msg; - u16 status; + u64 status; if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT) return -EMSGSIZE; @@ -329,11 +330,10 @@ int hv_post_message(union hv_connection_id connection_id, aligned_msg->payload_size = payload_size; memcpy((void *)aligned_msg->payload, payload, payload_size); - status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) - & 0x; + status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL); put_cpu(); - return status; + return status & 0x; } @@ -343,13 +343,13 @@ int hv_post_message(union hv_connection_id connection_id, * * This involves a hypercall. */ -u16 hv_signal_event(void *con_id) +int hv_signal_event(void *con_id) { - u16 status; + u64 status; - status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0x); + status = hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL); - return status; + return status & 0x; } static int hv_ce_set_next_event(unsigned long delta, diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 40c0c855..64950d8 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -592,7 +592,7 @@ extern int hv_post_message(union hv_connection_id connection_id, enum hv_message_type message_type, void *payload, size_t payload_size); -extern u16 hv_signal_event(void *con_id); +extern int hv_signal_event(void *con_id); extern int hv_synic_alloc(void); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 02393b6..ea0a0e3 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -983,6 +983,7 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, bool fb_overlap_ok); int vmbus_cpu_number_to_vp_number(int cpu_number); +u64 hv_do_hypercall(u64 control, void *input, void *output); /** * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 04/10] tools: hv: remove repeated HV_FCOPY string
From: Olaf Hering HV_FCOPY is already used as identifier in syslog. Signed-off-by: Olaf Hering Signed-off-by: K. Y. Srinivasan --- tools/hv/hv_fcopy_daemon.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c index f1d7426..fdc9ca4 100644 --- a/tools/hv/hv_fcopy_daemon.c +++ b/tools/hv/hv_fcopy_daemon.c @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) } openlog("HV_FCOPY", 0, LOG_USER); - syslog(LOG_INFO, "HV_FCOPY starting; pid is:%d", getpid()); + syslog(LOG_INFO, "starting; pid is:%d", getpid()); fcopy_fd = open("/dev/vmbus/hv_fcopy", O_RDWR); @@ -215,7 +215,7 @@ int main(int argc, char *argv[]) } kernel_modver = *(__u32 *)buffer; in_handshake = 0; - syslog(LOG_INFO, "HV_FCOPY: kernel module version: %d", + syslog(LOG_INFO, "kernel module version: %d", kernel_modver); continue; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 08/10] drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num
From: Jake Oshins This patch exposes the mapping between Linux CPU number and Hyper-V virtual processor number. This is necessary because the hypervisor needs to know which virtual processors to target when making a mapping in the Interrupt Redirection Table in the I/O MMU. Signed-off-by: Jake Oshins Signed-off-by: K. Y. Srinivasan --- drivers/hv/vmbus_drv.c | 17 + include/linux/hyperv.h |2 ++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 3297731..c01b689 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1193,6 +1193,23 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, } EXPORT_SYMBOL_GPL(vmbus_allocate_mmio); +/** + * vmbus_cpu_number_to_vp_number() - Map CPU to VP. + * @cpu_number: CPU number in Linux terms + * + * This function returns the mapping between the Linux processor + * number and the hypervisor's virtual processor number, useful + * in making hypercalls and such that talk about specific + * processors. + * + * Return: Virtual processor number in Hyper-V terms + */ +int vmbus_cpu_number_to_vp_number(int cpu_number) +{ + return hv_context.vp_index[cpu_number]; +} +EXPORT_SYMBOL_GPL(vmbus_cpu_number_to_vp_number); + static int vmbus_acpi_add(struct acpi_device *device) { acpi_status result; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 54733d5..02393b6 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -982,6 +982,8 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, resource_size_t size, resource_size_t align, bool fb_overlap_ok); +int vmbus_cpu_number_to_vp_number(int cpu_number); + /** * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device * -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2 03/10] tools: hv: report ENOSPC errors in hv_fcopy_daemon
From: Olaf Hering Currently some "Unspecified error 0x80004005" is reported on the Windows side if something fails. Handle the ENOSPC case and return ERROR_DISK_FULL, which allows at least Copy-VMFile to report a meaning full error. Signed-off-by: Olaf Hering Signed-off-by: K. Y. Srinivasan --- include/uapi/linux/hyperv.h |1 + tools/hv/hv_fcopy_daemon.c | 20 +--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h index e4c0a35..e347b24 100644 --- a/include/uapi/linux/hyperv.h +++ b/include/uapi/linux/hyperv.h @@ -313,6 +313,7 @@ enum hv_kvp_exchg_pool { #define HV_INVALIDARG 0x80070057 #define HV_GUID_NOTFOUND 0x80041002 #define HV_ERROR_ALREADY_EXISTS0x80070050 +#define HV_ERROR_DISK_FULL 0x80070070 #define ADDR_FAMILY_NONE 0x00 #define ADDR_FAMILY_IPV4 0x01 diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c index 5480e4e..f1d7426 100644 --- a/tools/hv/hv_fcopy_daemon.c +++ b/tools/hv/hv_fcopy_daemon.c @@ -37,12 +37,14 @@ static int target_fd; static char target_fname[W_MAX_PATH]; +static unsigned long long filesize; static int hv_start_fcopy(struct hv_start_fcopy *smsg) { int error = HV_E_FAIL; char *q, *p; + filesize = 0; p = (char *)smsg->path_name; snprintf(target_fname, sizeof(target_fname), "%s/%s", (char *)smsg->path_name, (char *)smsg->file_name); @@ -98,14 +100,26 @@ done: static int hv_copy_data(struct hv_do_fcopy *cpmsg) { ssize_t bytes_written; + int ret = 0; bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size, cpmsg->offset); - if (bytes_written != cpmsg->size) - return HV_E_FAIL; + filesize += cpmsg->size; + if (bytes_written != cpmsg->size) { + switch (errno) { + case ENOSPC: + ret = HV_ERROR_DISK_FULL; + break; + default: + ret = HV_E_FAIL; + break; + } + syslog(LOG_ERR, "pwrite failed to write %llu bytes: %ld (%s)", + filesize, (long)bytes_written, strerror(errno)); + } - return 0; + return ret; } static int hv_copy_finished(void) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/7] drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num
From: Jake Oshins This patch exposes the mapping between Linux CPU number and Hyper-V virtual processor number. This is necessary because the hypervisor needs to know which virtual processor to target when making a mapping in the Interrupt Redirection Table in the I/O MMU. Signed-off-by: Jake Oshins --- drivers/hv/vmbus_drv.c | 17 + include/linux/hyperv.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index f19b6f7..c89d0e5 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1191,6 +1191,23 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, } EXPORT_SYMBOL_GPL(vmbus_allocate_mmio); +/** + * vmbus_cpu_number_to_vp_number() - Map CPU to VP. + * @cpu_number: CPU number in Linux terms + * + * This function returns the mapping between the Linux processor + * number and the hypervisor's virtual processor number, useful + * in making hypercalls and such that talk about specific + * processors. + * + * Return: Virtual processor number in Hyper-V terms + */ +int vmbus_cpu_number_to_vp_number(int cpu_number) +{ + return hv_context.vp_index[cpu_number]; +} +EXPORT_SYMBOL_GPL(vmbus_cpu_number_to_vp_number); + static int vmbus_acpi_add(struct acpi_device *device) { acpi_status result; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 54733d5..02393b6 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -982,6 +982,8 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, resource_size_t size, resource_size_t align, bool fb_overlap_ok); +int vmbus_cpu_number_to_vp_number(int cpu_number); + /** * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device * -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 4/7] PCI: Add fwnode_handle to pci_sysdata
From: Jake Oshins This patch adds an fwnode_handle to struct pci_sysdata, which is used by the next patch in the series when trying to locate an IRQ domain associated with a root PCI bus. Signed-off-by: Jake Oshins --- arch/x86/include/asm/pci.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 4625943..10213a1 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -20,6 +20,9 @@ struct pci_sysdata { #ifdef CONFIG_X86_64 void*iommu; /* IOMMU private data */ #endif +#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN + void*fwnode;/* IRQ domain for MSI assignment */ +#endif }; extern int pci_routeirq; @@ -41,6 +44,14 @@ static inline int pci_proc_domain(struct pci_bus *bus) } #endif +#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN +static inline void *pci_fwnode(struct pci_bus *bus) +{ + struct pci_sysdata *sd = bus->sysdata; + return sd->fwnode; +} +#endif + /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 0/7] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs
From: Jake Oshins This patch series incorporates feedback from Gerry Liu (jiang@linux.intel.com). First, export functions that allow correlating Hyper-V virtual processors and Linux cpus, along with the means for invoking a hypercall that targets interrupts at chosen vectors on specfic cpus. Second, mark various parts of IRQ domain related code as exported, so that this PCI front-end can implement an IRQ domain as part of a module. (The alternative would be to pull all this into the kernel, which would pull in a lot of other Hyper-V related code, as this IRQ domain depends on hv_vmbus.ko.) Third, modify PCI so that new root PCI buses can be marked with an associated fwnode_handle, and so that root PCI buses can look up their associated IRQ domain by that handle. Fourth, introduce a new driver, hv_pcifront, which eposes root PCI buses in a Hyper-V VM. These root PCI buses expose real PCIe devices, or PCI Virtual Functions. Jake Oshins (7): drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num drivers:hv: Export hv_do_hypercall() PCI: Make it possible to implement a PCI MSI IRQ Domain in a module. PCI: Add fwnode_handle to pci_sysdata PCI: irqdomain: Look up IRQ domain by fwnode_handle drivers:hv: Define the channel type for Hyper-V PCI Express pass-through PCI: hv: New paravirtual PCI front-end for Hyper-V VMs MAINTAINERS|1 + arch/x86/include/asm/msi.h |4 + arch/x86/include/asm/pci.h | 11 + arch/x86/kernel/apic/msi.c |5 +- arch/x86/kernel/apic/vector.c |2 + drivers/hv/hv.c| 20 +- drivers/hv/hyperv_vmbus.h |2 +- drivers/hv/vmbus_drv.c | 17 + drivers/pci/Kconfig|7 + drivers/pci/host/Makefile |1 + drivers/pci/host/hv_pcifront.c | 2267 drivers/pci/msi.c |4 + drivers/pci/probe.c| 13 + include/linux/hyperv.h | 14 + kernel/irq/chip.c |1 + kernel/irq/irqdomain.c |2 + 16 files changed, 2358 insertions(+), 13 deletions(-) create mode 100644 drivers/pci/host/hv_pcifront.c -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 2/7] drivers:hv: Export hv_do_hypercall()
From: Jake Oshins This patch exposes the function that hv_vmbus.ko uses to make hypercalls. This is necessary for retargeting an interrupt when it is given a new affinity and vector. Signed-off-by: Jake Oshins --- drivers/hv/hv.c | 20 ++-- drivers/hv/hyperv_vmbus.h | 2 +- include/linux/hyperv.h| 1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 6341be8..7a06933 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -89,9 +89,9 @@ static int query_hypervisor_info(void) } /* - * do_hypercall- Invoke the specified hypercall + * hv_do_hypercall- Invoke the specified hypercall */ -static u64 do_hypercall(u64 control, void *input, void *output) +u64 hv_do_hypercall(u64 control, void *input, void *output) { u64 input_address = (input) ? virt_to_phys(input) : 0; u64 output_address = (output) ? virt_to_phys(output) : 0; @@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output) return hv_status_lo | ((u64)hv_status_hi << 32); #endif /* !x86_64 */ } +EXPORT_SYMBOL_GPL(hv_do_hypercall); #ifdef CONFIG_X86_64 static cycle_t read_hv_clock_tsc(struct clocksource *arg) @@ -315,7 +316,7 @@ int hv_post_message(union hv_connection_id connection_id, { struct hv_input_post_message *aligned_msg; - u16 status; + u64 status; if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT) return -EMSGSIZE; @@ -329,11 +330,10 @@ int hv_post_message(union hv_connection_id connection_id, aligned_msg->payload_size = payload_size; memcpy((void *)aligned_msg->payload, payload, payload_size); - status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) - & 0x; + status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL); put_cpu(); - return status; + return status & 0x; } @@ -343,13 +343,13 @@ int hv_post_message(union hv_connection_id connection_id, * * This involves a hypercall. */ -u16 hv_signal_event(void *con_id) +int hv_signal_event(void *con_id) { - u16 status; + u64 status; - status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0x); + status = hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL); - return status; + return status & 0x; } static int hv_ce_set_next_event(unsigned long delta, diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 3d70e36..18c66fc 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -587,7 +587,7 @@ extern int hv_post_message(union hv_connection_id connection_id, enum hv_message_type message_type, void *payload, size_t payload_size); -extern u16 hv_signal_event(void *con_id); +extern int hv_signal_event(void *con_id); extern int hv_synic_alloc(void); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 02393b6..ea0a0e3 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -983,6 +983,7 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, bool fb_overlap_ok); int vmbus_cpu_number_to_vp_number(int cpu_number); +u64 hv_do_hypercall(u64 control, void *input, void *output); /** * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 5/7] PCI: irqdomain: Look up IRQ domain by fwnode_handle
From: Jake Oshins This patch adds a second way of finding an IRQ domain associated with a root PCI bus. After looking to see if one can be found through the OF tree, it attempts to look up the IRQ domain through an fwnode_handle stored in the pci_sysdata struct. Signed-off-by: Jake Oshins --- drivers/pci/probe.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f441d1b..3d5d7d6 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -671,6 +671,19 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) */ d = pci_host_bridge_of_msi_domain(bus); +#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN + /* +* If no IRQ domain was found via the OF tree, try looking it up +* directly through the fwnode_handle. +*/ + if (!d) { + if (pci_fwnode(bus)) { + d = irq_find_matching_fwnode(pci_fwnode(bus), +DOMAIN_BUS_PCI_MSI); + } + } +#endif + return d; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 3/7] PCI: Make it possible to implement a PCI MSI IRQ Domain in a module.
From: Jake Oshins The Linux kernel already has the concpet of IRQ domain, whereing a component can expose a set of IRQs which are managed by a particular interrupt controller chip or other subsystem. The PCI driver exposes the notion of an IRQ domain for Message-Signaled Interrupts (MSI) from PCI Express devices. This patch exposes the functions which are necessary for making an MSI IRQ domain within a module. Signed-off-by: Jake Oshins --- arch/x86/include/asm/msi.h| 4 arch/x86/kernel/apic/msi.c| 5 +++-- arch/x86/kernel/apic/vector.c | 2 ++ drivers/pci/msi.c | 4 kernel/irq/chip.c | 1 + kernel/irq/irqdomain.c| 2 ++ 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/msi.h b/arch/x86/include/asm/msi.h index 93724cc..e8b7924 100644 --- a/arch/x86/include/asm/msi.h +++ b/arch/x86/include/asm/msi.h @@ -1,7 +1,11 @@ #ifndef _ASM_X86_MSI_H #define _ASM_X86_MSI_H #include +#include typedef struct irq_alloc_info msi_alloc_info_t; +int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec, + msi_alloc_info_t *arg); + #endif /* _ASM_X86_MSI_H */ diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index 5f1feb6..bdb28fc 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -96,8 +96,8 @@ static irq_hw_number_t pci_msi_get_hwirq(struct msi_domain_info *info, return arg->msi_hwirq; } -static int pci_msi_prepare(struct irq_domain *domain, struct device *dev, - int nvec, msi_alloc_info_t *arg) +int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec, + msi_alloc_info_t *arg) { struct pci_dev *pdev = to_pci_dev(dev); struct msi_desc *desc = first_pci_msi_entry(pdev); @@ -113,6 +113,7 @@ static int pci_msi_prepare(struct irq_domain *domain, struct device *dev, return 0; } +EXPORT_SYMBOL_GPL(pci_msi_prepare); static void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc) { diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 836d11b..f3ac5e1 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -29,6 +29,7 @@ struct apic_chip_data { }; struct irq_domain *x86_vector_domain; +EXPORT_SYMBOL_GPL(x86_vector_domain); static DEFINE_RAW_SPINLOCK(vector_lock); static cpumask_var_t vector_cpumask; static struct irq_chip lapic_controller; @@ -66,6 +67,7 @@ struct irq_cfg *irqd_cfg(struct irq_data *irq_data) return data ? &data->cfg : NULL; } +EXPORT_SYMBOL_GPL(irqd_cfg); struct irq_cfg *irq_cfg(unsigned int irq) { diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 53e4632..3915a99 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -257,6 +257,7 @@ void pci_msi_mask_irq(struct irq_data *data) { msi_set_mask_bit(data, 1); } +EXPORT_SYMBOL_GPL(pci_msi_mask_irq); /** * pci_msi_unmask_irq - Generic irq chip callback to unmask PCI/MSI interrupts @@ -266,6 +267,7 @@ void pci_msi_unmask_irq(struct irq_data *data) { msi_set_mask_bit(data, 0); } +EXPORT_SYMBOL_GPL(pci_msi_unmask_irq); void default_restore_msi_irqs(struct pci_dev *dev) { @@ -1126,6 +1128,7 @@ struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc) { return to_pci_dev(desc->dev); } +EXPORT_SYMBOL(msi_desc_to_pci_dev); void *msi_desc_to_pci_sysdata(struct msi_desc *desc) { @@ -1285,6 +1288,7 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode, domain->bus_token = DOMAIN_BUS_PCI_MSI; return domain; } +EXPORT_SYMBOL_GPL(pci_msi_create_irq_domain); /** * pci_msi_domain_alloc_irqs - Allocate interrupts for @dev in @domain diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 1520645..2414775 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -950,6 +950,7 @@ void irq_chip_ack_parent(struct irq_data *data) data = data->parent_data; data->chip->irq_ack(data); } +EXPORT_SYMBOL_GPL(irq_chip_ack_parent); /** * irq_chip_mask_parent - Mask the parent interrupt diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 22aa961..174d7e0 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -60,6 +60,7 @@ struct fwnode_handle *irq_domain_alloc_fwnode(void *data) fwid->fwnode.type = FWNODE_IRQCHIP; return &fwid->fwnode; } +EXPORT_SYMBOL_GPL(irq_domain_alloc_fwnode); /** * irq_domain_free_fwnode - Free a non-OF-backed fwnode_handle @@ -77,6 +78,7 @@ void irq_domain_free_fwnode(struct fwnode_handle *fwnode) kfree(fwid->name); kfree(fwid); } +EXPORT_SYMBOL_GPL(irq_domain_free_fwnode); /** * __irq_domain_add() - Allocate a new irq_domain data structure -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-deve
[PATCH v4 7/7] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs
From: Jake Oshins This patch introduces a new driver which exposes a root PCI bus whenever a PCI Express device is passed through to a guest VM under Hyper-V. The device can be single- or multi-function. The interrupts for the devices are managed by an IRQ domain, implemented within the driver. Signed-off-by: Jake Oshins --- MAINTAINERS|1 + drivers/pci/Kconfig|7 + drivers/pci/host/Makefile |1 + drivers/pci/host/hv_pcifront.c | 2267 4 files changed, 2276 insertions(+) create mode 100644 drivers/pci/host/hv_pcifront.c diff --git a/MAINTAINERS b/MAINTAINERS index a2d50fe..a1205b4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5073,6 +5073,7 @@ F:arch/x86/kernel/cpu/mshyperv.c F: drivers/hid/hid-hyperv.c F: drivers/hv/ F: drivers/input/serio/hyperv-keyboard.c +F: drivers/pci/host/hv_pcifront.c F: drivers/net/hyperv/ F: drivers/scsi/storvsc_drv.c F: drivers/video/fbdev/hyperv_fb.c diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 73de4ef..9b82d93 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -118,4 +118,11 @@ config PCI_LABEL def_bool y if (DMI || ACPI) select NLS +config HYPERV_VPCI +tristate "Hyper-V PCI Frontend" +depends on PCI && X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN +help + The PCI device frontend driver allows the kernel to import arbitrary + PCI devices from a PCI backend to support PCI driver domains. + source "drivers/pci/host/Kconfig" diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile index 140d66f..39581fb 100644 --- a/drivers/pci/host/Makefile +++ b/drivers/pci/host/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o obj-$(CONFIG_PCI_IMX6) += pci-imx6.o +obj-$(CONFIG_HYPERV_VPCI) += hv_pcifront.o obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o diff --git a/drivers/pci/host/hv_pcifront.c b/drivers/pci/host/hv_pcifront.c new file mode 100644 index 000..73f296e --- /dev/null +++ b/drivers/pci/host/hv_pcifront.c @@ -0,0 +1,2267 @@ +/* + * Copyright (c) Microsoft Corporation. + * + * Author: + * Jake Oshins + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * 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, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Protocol versions. The low word is the minor version, the high word the major + * version. + */ + +#define PCI_MAKE_VERSION(major, minor) ((__u32)(((major) << 16) | (major))) +#define PCI_MAJOR_VERSION(version) ((__u32)(version) >> 16) +#define PCI_MINOR_VERSION(version) ((__u32)(version) & 0xff) + +enum { + PCI_PROTOCOL_VERSION_1_1 = PCI_MAKE_VERSION(1, 1), + PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1 +}; + +#define PCI_CONFIG_MMIO_LENGTH 0x2000 +#define MAX_SUPPORTED_MSI_MESSAGES 0x400 + +/* + * Message Types + */ + +enum pci_message_type { + /* +* Version 1.1 +*/ + PCI_MESSAGE_BASE= 0x4249, + PCI_BUS_RELATIONS = PCI_MESSAGE_BASE + 0, + PCI_QUERY_BUS_RELATIONS = PCI_MESSAGE_BASE + 1, + PCI_POWER_STATE_CHANGE = PCI_MESSAGE_BASE + 4, + PCI_QUERY_RESOURCE_REQUIREMENTS = PCI_MESSAGE_BASE + 5, + PCI_QUERY_RESOURCE_RESOURCES= PCI_MESSAGE_BASE + 6, + PCI_BUS_D0ENTRY = PCI_MESSAGE_BASE + 7, + PCI_BUS_D0EXIT = PCI_MESSAGE_BASE + 8, + PCI_READ_BLOCK = PCI_MESSAGE_BASE + 9, + PCI_WRITE_BLOCK = PCI_MESSAGE_BASE + 0xA, + PCI_EJECT = PCI_MESSAGE_BASE + 0xB, + PCI_QUERY_STOP = PCI_MESSAGE_BASE + 0xC, + PCI_REENABLE= PCI_MESSAGE_BASE + 0xD, + PCI_QUERY_STOP_FAILED = PCI_MESSAGE_BASE + 0xE, + PCI_EJECTION_COMPLETE = PCI_MESSAGE_BASE + 0xF, + PCI_RESOURCES_ASSIGNED = PCI_MESSAGE_BASE + 0x10, + PCI_RESOURCES_RELEASED = PCI_MESSAGE_BASE + 0x11, + PCI_INVALIDATE_BLOCK= PCI_MESSAGE_BASE + 0x12, + PCI_QUERY_PROTOCOL_VERSION = PCI_MESSAGE_BASE + 0x13, + PCI_CREATE_INTERRUPT_MESSAGE= PCI_MESSAGE_BASE + 0x14, + PCI_DELETE_INTERRUPT_MESSAGE=
[PATCH v4 6/7] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through
From: Jake Oshins This defines the channel type for PCI front-ends in Hyper-V VMs. Signed-off-by: Jake Oshins --- include/linux/hyperv.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index ea0a0e3..5587899 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1140,6 +1140,17 @@ u64 hv_do_hypercall(u64 control, void *input, void *output); } /* + * PCI Express Pass Through + * {44C4F61D--4400-9D52-802E27EDE19F} + */ + +#define HV_PCIE_GUID \ + .guid = { \ + 0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \ + 0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \ + } + +/* * Common header for Hyper-V ICs */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 5/5] staging: fsl-mc: Management Complex restool driver
> -Original Message- > From: Wood Scott-B07421 > Sent: Tuesday, October 27, 2015 12:17 AM > To: Pan Lijun-B44306 > Cc: gre...@linuxfoundation.org; a...@arndb.de; de...@driverdev.osuosl.org; > linux-ker...@vger.kernel.org; Yoder Stuart-B08248 > ; katz Itai-RM05202 ; > Rivera Jose-B46482 ; Li Yang-Leo-R58472 > ; ag...@suse.de; Hamciuc Bogdan-BHAMCIU1 > ; Marginean Alexandru-R89243 > ; Sharma Bhupesh-B45370 > ; Erez Nir-RM30794 > ; Schmitt Richard-B43082 > ; dan.carpen...@oracle.com > Subject: Re: [PATCH 5/5] staging: fsl-mc: Management Complex restool driver > > On Sun, 2015-10-25 at 17:41 -0500, Lijun Pan wrote: > > The kernel support for the restool (a user space resource management > > tool) is a driver for the /dev/dprc.N device file. > > Its purpose is to provide an ioctl interface, which the restool uses > > to interact with the MC bus driver and with the MC firmware. > > We allocate a dpmcp at driver initialization, and keep that dpmcp > > until driver exit. > > We use that dpmcp by default. > > If that dpmcp is in use, we create another portal at run time and > > destroy the newly created portal after use. > > The ioctl RESTOOL_SEND_MC_COMMAND sends user space command to fsl- > mc > > bus and utilizes the fsl-mc bus to communicate with MC firmware. > > The ioctl RESTOOL_DPRC_SYNC request the mc-bus launch objects scan > > under root dprc. > > In order to support multiple root dprc, we utilize the bus notify > > mechanism to scan fsl_mc_bus_type for the newly added root dprc. > > After discovering the root dprc, it creates a miscdevice /dev/dprc.N > > to associate with this root dprc. > > > > Signed-off-by: Lijun Pan > > --- > > drivers/staging/fsl-mc/bus/Kconfig | 7 +- > > drivers/staging/fsl-mc/bus/Makefile | 3 + > > drivers/staging/fsl-mc/bus/mc-ioctl.h | 24 ++ > > drivers/staging/fsl-mc/bus/mc-restool.c | 488 > > > > 4 files changed, 521 insertions(+), 1 deletion(-) create mode 100644 > > drivers/staging/fsl-mc/bus/mc-ioctl.h > > create mode 100644 drivers/staging/fsl-mc/bus/mc-restool.c > > > > diff --git a/drivers/staging/fsl-mc/bus/Kconfig b/drivers/staging/fsl- > > mc/bus/Kconfig index 0d779d9..39c6ef9 100644 > > --- a/drivers/staging/fsl-mc/bus/Kconfig > > +++ b/drivers/staging/fsl-mc/bus/Kconfig > > @@ -21,4 +21,9 @@ config FSL_MC_BUS > > Only enable this option when building the kernel for > > Freescale QorQIQ LS2 SoCs. > > > > - > > +config FSL_MC_RESTOOL > > +tristate "Freescale Management Complex (MC) restool driver" > > +depends on FSL_MC_BUS > > +help > > + Driver that provides kernel support for the Freescale Management > > + Complex resource manager user-space tool. > > diff --git a/drivers/staging/fsl-mc/bus/Makefile > > b/drivers/staging/fsl- mc/bus/Makefile index 25433a9..28b5fc0 100644 > > --- a/drivers/staging/fsl-mc/bus/Makefile > > +++ b/drivers/staging/fsl-mc/bus/Makefile > > @@ -15,3 +15,6 @@ mc-bus-driver-objs := mc-bus.o \ > > mc-allocator.o \ > > dpmcp.o \ > > dpbp.o > > + > > +# MC restool kernel support > > +obj-$(CONFIG_FSL_MC_RESTOOL) += mc-restool.o > > diff --git a/drivers/staging/fsl-mc/bus/mc-ioctl.h > > b/drivers/staging/fsl- mc/bus/mc-ioctl.h new file mode 100644 index > > 000..e52f907 > > --- /dev/null > > +++ b/drivers/staging/fsl-mc/bus/mc-ioctl.h > > @@ -0,0 +1,24 @@ > > +/* > > + * Freescale Management Complex (MC) ioclt interface > > ioctl > > > + * > > + * Copyright (C) 2014 Freescale Semiconductor, Inc. > > + * Author: Lijun Pan > > + * > > + * This file is licensed under the terms of the GNU General Public > > + * License version 2. This program is licensed "as is" without any > > + * warranty of any kind, whether express or implied. > > + */ > > +#ifndef _FSL_MC_IOCTL_H_ > > +#define _FSL_MC_IOCTL_H_ > > + > > +#include > > + > > +#define RESTOOL_IOCTL_TYPE 'R' > > + > > +#define RESTOOL_DPRC_SYNC \ > > + _IO(RESTOOL_IOCTL_TYPE, 0x2) > > + > > +#define RESTOOL_SEND_MC_COMMAND \ > > + _IOWR(RESTOOL_IOCTL_TYPE, 0x4, struct mc_command) > > Look at Documentation/ioctl/ioctl-number.txt and reserve a range within 'R' > that doesn't conflict. > > Add thorough documentation of this API. What path do you recommend me to put documentation of this API? > > I'm not sure how it's usually handled with staging drivers, but eventually > this > will need to move to an appropriate uapi header. Is this functionality even > needed before the driver comes out of staging? I don't see "userspace restool > support" in drivers/staging/fsl-mc/TODO. > > Don't reference struct mc_command without including the header that defines > it. > > > +#endif /* _FSL_MC_IOCTL_H_ */ > > diff --git a/drivers/staging/fsl-mc/bus/mc-restool.c > > b/drivers/staging/fsl- mc/bus/mc-restool.c new file mode 100644 index > > 000..a219172 > > --- /dev/null > > +++ b/drivers/staging/fsl-
Re: [PATCH v4 5/7] PCI: irqdomain: Look up IRQ domain by fwnode_handle
On Fri, Oct 30, 2015 at 1:46 AM, wrote: > From: Jake Oshins > > This patch adds a second way of finding an IRQ domain associated with > a root PCI bus. After looking to see if one can be found through > the OF tree, it attempts to look up the IRQ domain through an > fwnode_handle stored in the pci_sysdata struct. > +#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN > + /* > +* If no IRQ domain was found via the OF tree, try looking it up > +* directly through the fwnode_handle. > +*/ > + if (!d) { > + if (pci_fwnode(bus)) { Isn't it the same to if (!d && pci_fwnode(bus)) d = ... ? > + d = irq_find_matching_fwnode(pci_fwnode(bus), > +DOMAIN_BUS_PCI_MSI); > + } > + } > +#endif -- With Best Regards, Andy Shevchenko ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 6/7] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through
On Fri, Oct 30, 2015 at 1:46 AM, wrote: > From: Jake Oshins > > This defines the channel type for PCI front-ends in Hyper-V VMs. > > Signed-off-by: Jake Oshins > --- > include/linux/hyperv.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h > index ea0a0e3..5587899 100644 > --- a/include/linux/hyperv.h > +++ b/include/linux/hyperv.h > @@ -1140,6 +1140,17 @@ u64 hv_do_hypercall(u64 control, void *input, void > *output); > } > > /* > + * PCI Express Pass Through > + * {44C4F61D--4400-9D52-802E27EDE19F} > + */ > + > +#define HV_PCIE_GUID \ > + .guid = { \ > + 0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \ > + 0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \ > + } What about #include UUID_LE(...) And you may use uuid_le type instead of custom raw buffer. > + > +/* > * Common header for Hyper-V ICs > */ > > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- With Best Regards, Andy Shevchenko ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 4/7] PCI: Add fwnode_handle to pci_sysdata
On 2015/10/30 7:46, ja...@microsoft.com wrote: > From: Jake Oshins > > This patch adds an fwnode_handle to struct pci_sysdata, which is > used by the next patch in the series when trying to locate an > IRQ domain associated with a root PCI bus. > > Signed-off-by: Jake Oshins > --- > arch/x86/include/asm/pci.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h > index 4625943..10213a1 100644 > --- a/arch/x86/include/asm/pci.h > +++ b/arch/x86/include/asm/pci.h > @@ -20,6 +20,9 @@ struct pci_sysdata { > #ifdef CONFIG_X86_64 > void*iommu; /* IOMMU private data */ > #endif > +#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN > + void*fwnode;/* IRQ domain for MSI assignment */ > +#endif > }; > > extern int pci_routeirq; > @@ -41,6 +44,14 @@ static inline int pci_proc_domain(struct pci_bus *bus) > } > #endif > > +#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN > +static inline void *pci_fwnode(struct pci_bus *bus) > +{ > + struct pci_sysdata *sd = bus->sysdata; > + return sd->fwnode; > +} > +#endif Hi Jakeo, I would be better that if the function name indicates that we are getting PCI host bridge(root bus) firmware node. And you also need some magic here to avoid breaking compilation on other archs: in arch/x86/include/asm/pci.h #define pci_fwnode pci_fwnode in include/asm-generic/pci.h #ifndef pci_fwnode #define pci_fwnode(bus) ((void)(bus),NULL) #endif Thanks, Gerry > + > /* Can be used to override the logic in pci_scan_bus for skipping > already-configured bus numbers - to be used for buggy BIOSes > or architectures with incomplete PCI setup by the loader */ > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: comedi: fixed comment, added a new line
On Thu, Oct 29, 2015 at 11:52:33PM +0100, Philippe Loctaux wrote: > >From 16dae6c28a46ae257dcedd51d973aee7821053f3 Mon Sep 17 00:00:00 2001 > From: Philippe Loctaux > Date: Thu, 29 Oct 2015 22:45:16 +0100 > Subject: [PATCH] Staging: comedi: fixed comment, added a new line Why is this header all in here? > > Signed-off-by: Philippe Loctaux No changelog comment saying why you did this? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/17] staging: wilc1000: wilc_wlan_cfg_set: add argument struct net_device
This patch adds new argument net_device and use netdev private data member wilc instead of g_linux_wlan, pass dev to the functions also. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/coreconfigurator.c | 3 +- drivers/staging/wilc1000/linux_wlan.c | 86 ++--- drivers/staging/wilc1000/wilc_wlan.c| 9 ++- drivers/staging/wilc1000/wilc_wlan.h| 4 +- 4 files changed, 53 insertions(+), 49 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 530d64a..74fb556 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -616,7 +616,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids, } else if (mode == SET_CFG) { for (counter = 0; counter < count; counter++) { PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id); - if (!wilc_wlan_cfg_set(!counter, + if (!wilc_wlan_cfg_set(dev, + !counter, wids[counter].id, wids[counter].val, wids[counter].size, diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 4ed324c..6ffa2a1 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -662,53 +662,53 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni *(int *)c_val = 1; - if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) goto _fail_; /*to tell fw that we are going to use PC test - WILC specific*/ c_val[0] = 0; - if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = INFRASTRUCTURE; - if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_BSS_TYPE, c_val, 1, 0, 0)) goto _fail_; /* c_val[0] = RATE_AUTO; */ c_val[0] = RATE_AUTO; - if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = G_MIXED_11B_2_MODE; - if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0)) goto _fail_; c_val[0] = G_SHORT_PREAMBLE; - if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_PREAMBLE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = AUTO_PROT; - if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0)) goto _fail_; c_val[0] = ACTIVE_SCAN; - if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_SCAN_TYPE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = SITE_SURVEY_OFF; - if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_SITE_SURVEY, c_val, 1, 0, 0)) goto _fail_; *((int *)c_val) = 0x; /* Never use RTS-CTS */ - if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0)) goto _fail_; *((int *)c_val) = 2346; - if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0)) goto _fail_; /* SSID */ @@ -719,23 +719,23 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni /* to enable Broadcast SSID suppport ) */ /* -- */ c_val[0] = 0; - if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_BCAST_SSID, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(dev, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
[PATCH 05/17] staging: wilc1000: wilc_wlan_cfg_commit: add argument struct net_device
Add argument struct net_device and pass dev to the functions as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/wilc_wlan.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a72fa8c..75b0616 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1732,7 +1732,8 @@ void wilc_wlan_cleanup(struct net_device *dev) } -static int wilc_wlan_cfg_commit(int type, u32 drvHandler) +static int wilc_wlan_cfg_commit(struct net_device *dev, + int type, u32 drvHandler) { wilc_wlan_dev_t *p = &g_wlan; wilc_cfg_frame_t *cfg = &p->cfg_frame; @@ -1796,7 +1797,7 @@ int wilc_wlan_cfg_set(struct net_device *dev, int start, u32 wid, u8 *buffer, PRINT_D(RX_DBG, "Processing cfg_set()\n"); p->cfg_frame_in_use = 1; - if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler)) + if (wilc_wlan_cfg_commit(dev, WILC_CFG_SET, drvHandler)) ret_size = 0; if (linux_wlan_lock_timeout(&wilc->cfg_event, @@ -1837,7 +1838,7 @@ int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit, if (commit) { p->cfg_frame_in_use = 1; - if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler)) + if (wilc_wlan_cfg_commit(dev, WILC_CFG_QUERY, drvHandler)) ret_size = 0; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/17] staging: wilc1000: wilc_wlan_cfg_get: add argument struct net_device
Adds argument struct net_device and use netdev private data member wilc instead of g_linux_wlan, pass dev to the functions as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/coreconfigurator.c | 3 ++- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c| 8 ++-- drivers/staging/wilc1000/wilc_wlan.h| 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 3b4a950..530d64a 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -595,7 +595,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids, for (counter = 0; counter < count; counter++) { PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter, (counter == count - 1)); - if (!wilc_wlan_cfg_get(!counter, + if (!wilc_wlan_cfg_get(dev, + !counter, wids[counter].id, (counter == count - 1), drv)) { diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d0161cd..4ed324c 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1153,7 +1153,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) wilc_bus_set_max_speed(); - if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) { + if (wilc_wlan_cfg_get(dev, 1, WID_FIRMWARE_VERSION, 1, 0)) { int size; char Firmware_ver[20]; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 16224ce..768fd30 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1809,12 +1809,16 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, return ret_size; } -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) +int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit, + u32 drvHandler) { wilc_wlan_dev_t *p = &g_wlan; u32 offset; int ret_size; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; + wilc = nic->wilc; if (p->cfg_frame_in_use) return 0; @@ -1834,7 +1838,7 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) ret_size = 0; - if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event, + if (linux_wlan_lock_timeout(&wilc->cfg_event, CFG_PKTS_TIMEOUT)) { PRINT_D(TX_DBG, "Get Timed Out\n"); ret_size = 0; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 2eb7e20..2879a93 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -305,7 +305,8 @@ void wilc_handle_isr(void *wilc); void wilc_wlan_cleanup(struct net_device *dev); int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int commit, u32 drvHandler); -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler); +int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit, + u32 drvHandler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/17] staging: wilc1000: remove unused function remove_TCP_related
Just remove unused function remove_TCP_related. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/wilc_wlan.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index b503f07..c8ce1f6 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -349,16 +349,6 @@ static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_ent } return 0; } -static inline int remove_TCP_related(void) -{ - wilc_wlan_dev_t *p = &g_wlan; - unsigned long flags; - - spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); - - spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); - return 0; -} static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/17] staging: wilc1000: send_config_pkt: add argument struct net_device
This patch adds new argument struct net_device and pass dev to the function as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/coreconfigurator.c | 3 +- drivers/staging/wilc1000/coreconfigurator.h | 3 +- drivers/staging/wilc1000/host_interface.c | 196 +--- drivers/staging/wilc1000/wilc_wlan_if.h | 1 + 4 files changed, 156 insertions(+), 47 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index e10c6ff..3b4a950 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -586,7 +586,8 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo) * @date 1 Mar 2012 * @version 1.0 */ -s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv) +s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids, + u32 count, u32 drv) { s32 counter = 0, ret = 0; diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 6294d92..1ea5f47 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -127,7 +127,8 @@ typedef struct { size_t ie_len; } tstrDisconnectNotifInfo; -s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv); +s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids, + u32 count, u32 drv); s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 17826f3..3a4fdc0 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -329,6 +329,9 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv, { s32 result = 0; struct wid wid; + struct net_device *dev; + + dev = hif_drv->priv->dev; wid.id = (u16)WID_CURRENT_CHANNEL; wid.type = WID_CHAR; @@ -337,7 +340,7 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting channel\n"); - result = send_config_pkt(SET_CFG, &wid, 1, + result = send_config_pkt(dev, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -353,13 +356,17 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv, { s32 result = 0; struct wid wid; + struct net_device *dev; + + dev = hif_drv->priv->dev; wid.id = (u16)WID_SET_DRV_HANDLER; wid.type = WID_INT; wid.val = (s8 *)&hif_drv_handler->handler; wid.size = sizeof(u32); - result = send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler); + result = send_config_pkt(dev, SET_CFG, &wid, 1, +hif_drv_handler->handler); if (!hif_drv) up(&hif_sema_driver); @@ -377,13 +384,16 @@ static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv, { s32 result = 0; struct wid wid; + struct net_device *dev; + + dev = hif_drv->priv->dev; wid.id = (u16)WID_SET_OPERATION_MODE; wid.type = WID_INT; wid.val = (s8 *)&hif_op_mode->mode; wid.size = sizeof(u32); - result = send_config_pkt(SET_CFG, &wid, 1, + result = send_config_pkt(dev, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if ((hif_op_mode->mode) == IDLE_MODE) @@ -402,6 +412,9 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) s32 result = 0; struct wid wid; char firmwareIPAddress[4] = {0}; + struct net_device *dev; + + dev = hif_drv->priv->dev; if (pu8IPAddr[0] < 192) pu8IPAddr[0] = 0; @@ -415,7 +428,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) wid.val = (u8 *)pu8IPAddr; wid.size = IP_ALEN; - result = send_config_pkt(SET_CFG, &wid, 1, + result = send_config_pkt(dev, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx); @@ -434,13 +447,16 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) { s32 result = 0; struct wid wid; + struct net_device *dev; + + dev = hif_drv->priv->dev; wid.id = (u16)WID_IP_ADDRESS; wid.type = WID_STR; wid.val = kmalloc(IP_ALEN, GFP_KERNEL); wid.size = IP_ALEN; - result = send_config_pkt(GET_CFG, &wid, 1, + result = send_config_pkt(dev, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val)
[PATCH 06/17] staging: wilc1000: wilc_wlan_txq_add_cfg_pkt: add argument net_device
This patch adds new argument struct net_device and use netdev private data member wilc instead of g_linux_wlan, pass dev to the function. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/wilc_wlan.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 75b0616..ec4bff4 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -484,15 +484,20 @@ bool is_TCP_ACK_Filter_Enabled(void) return EnableTCPAckFilter; } -static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) +static int wilc_wlan_txq_add_cfg_pkt(struct net_device *dev, +u8 *buffer, u32 buffer_size) { wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; + + wilc = nic->wilc; PRINT_D(TX_DBG, "Adding config packet ...\n"); if (p->quit) { PRINT_D(TX_DBG, "Return due to clear function\n"); - up(&g_linux_wlan->cfg_event); + up(&wilc->cfg_event); return 0; } @@ -1763,7 +1768,7 @@ static int wilc_wlan_cfg_commit(struct net_device *dev, * Add to TX queue **/ - if (!wilc_wlan_txq_add_cfg_pkt(&cfg->wid_header[0], total_len)) + if (!wilc_wlan_txq_add_cfg_pkt(dev, &cfg->wid_header[0], total_len)) return -1; return 0; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/17] staging: wilc1000: wilc_wlan_stop: add argument struct net_device
This patch adds new argument struct net_device and pass dev to the functions. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 6ffa2a1..1019a19 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -935,7 +935,7 @@ void wilc1000_wlan_deinit(struct net_device *dev) PRINT_D(INIT_DBG, "Deinitializing IRQ\n"); deinit_irq(dev); - wilc_wlan_stop(); + wilc_wlan_stop(dev); PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n"); wilc_wlan_cleanup(dev); @@ -1176,7 +1176,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) return 0; /*success*/ _fail_fw_start_: - wilc_wlan_stop(); + wilc_wlan_stop(dev); _fail_irq_enable_: #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c8ce1f6..d4eef3d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1598,7 +1598,7 @@ void wilc_wlan_global_reset(void) p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0); release_bus(RELEASE_ONLY); } -int wilc_wlan_stop(void) +int wilc_wlan_stop(struct net_device *dev) { wilc_wlan_dev_t *p = &g_wlan; u32 reg = 0; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 519f352..fa66783 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -297,7 +297,7 @@ typedef struct { int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size); int wilc_wlan_start(void); -int wilc_wlan_stop(void); +int wilc_wlan_stop(struct net_device *dev); int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/17] staging: wilc1000: define wiphy private data priv in struct host_if_drv
This patch defines wiphy private data priv in struct host_if_drv and set priv to priv in host_if_drv to reference it's wiphy private data. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/host_interface.h | 1 + drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 72c4797..f9efb5a 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -260,6 +260,7 @@ enum p2p_listen_state { }; struct host_if_drv { + struct wilc_priv *priv; struct user_scan_req usr_scan_req; struct user_conn_req usr_conn_req; struct remain_ch remain_on_ch; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 32b93d3..8554f6f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3478,6 +3478,7 @@ int wilc_init_host_int(struct net_device *net) s32Error = host_int_init(net, &priv->hWILCWFIDrv); if (s32Error) PRINT_ER("Error while initializing hostinterface\n"); + priv->hWILCWFIDrv->priv = priv; return s32Error; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/17] staging: wilc1000: wilc_wlan_txq_add_to_head: add new argument net_device
This patch adds new argument struct net_device and use netdev private data member wilc instead of g_linux_wlan, pass dev to the function as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/wilc_wlan.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index ec4bff4..b503f07 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -227,15 +227,21 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, up(&wilc->txq_event); } -static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) +static int wilc_wlan_txq_add_to_head(struct net_device *dev, +struct txq_entry_t *tqe) { + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; - if (linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs, + + wilc = nic->wilc; + + if (linux_wlan_lock_timeout(&wilc->txq_add_to_head_cs, CFG_PKTS_TIMEOUT)) return -1; - spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); + spin_lock_irqsave(&wilc->txq_spinlock, flags); if (p->txq_head == NULL) { tqe->next = NULL; @@ -251,14 +257,14 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) p->txq_entries += 1; PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); - spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); - up(&g_linux_wlan->txq_add_to_head_cs); + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); + up(&wilc->txq_add_to_head_cs); /** * wake up TX queue **/ - up(&g_linux_wlan->txq_event); + up(&wilc->txq_event); PRINT_D(TX_DBG, "Wake up the txq_handler\n"); return 0; @@ -520,7 +526,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct net_device *dev, **/ PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n"); - if (wilc_wlan_txq_add_to_head(tqe)) + if (wilc_wlan_txq_add_to_head(dev, tqe)) return 0; return 1; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/17] staging: wilc1000: chip_sleep_manually: add argument struct net_device
This patch add new argument struct net_device and pass dev to the function as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3a4fdc0..1263b5e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -271,7 +271,6 @@ static struct host_if_drv *join_req_drv; static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); -extern void chip_sleep_manually(u32 u32SleepTime); extern int linux_wlan_get_num_conn_ifcs(void); static int add_handler_in_list(struct host_if_drv *handler) @@ -2993,7 +2992,8 @@ static int hostIFthread(void *pvArg) PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); if (!linux_wlan_get_num_conn_ifcs()) - chip_sleep_manually(INFINITE_SLEEP_TIME); + chip_sleep_manually(hif_drv->priv->dev, + INFINITE_SLEEP_TIME); Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index e8afa6b..93fae34 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -810,7 +810,7 @@ static inline void chip_wakeup(void) genuChipPSstate = CHIP_WAKEDUP; } #endif -void chip_sleep_manually(u32 u32SleepTime) +void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime) { if (genuChipPSstate != CHIP_WAKEDUP) { /* chip is already sleeping. Do nothing */ diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 194c24c..c948c25 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -311,4 +311,5 @@ int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit, int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); +void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime); #endif -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/17] staging: wilc1000: wilc_wlan_firmware_download: add argument net_device
Add new argument struct net_device and pass dev to the function as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 3 ++- drivers/staging/wilc1000/wilc_wlan.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 1019a19..bb37f5b 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -624,7 +624,7 @@ static int linux_wlan_firmware_download(struct net_device *dev) * do the firmware download **/ PRINT_D(INIT_DBG, "Downloading Firmware ...\n"); - ret = wilc_wlan_firmware_download(wilc->firmware->data, + ret = wilc_wlan_firmware_download(dev, wilc->firmware->data, wilc->firmware->size); if (ret < 0) goto _FAIL_; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c464cd7..e8afa6b 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1415,7 +1415,8 @@ void wilc_handle_isr(void *wilc) * Firmware download * / -int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) +int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer, + u32 buffer_size) { wilc_wlan_dev_t *p = &g_wlan; u32 offset; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index fa66783..194c24c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -295,7 +295,8 @@ typedef struct { u32 seq_no; } wilc_cfg_rsp_t; -int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size); +int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer, + u32 buffer_size); int wilc_wlan_start(void); int wilc_wlan_stop(struct net_device *dev); int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/17] staging: wilc1000: remove unused function wilc_wlan_global_reset
Remove unused function wilc_wlan_global_reset. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/wilc_wlan.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index d4eef3d..c464cd7 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1589,15 +1589,6 @@ int wilc_wlan_start(void) return (ret < 0) ? ret : 0; } -void wilc_wlan_global_reset(void) -{ - - wilc_wlan_dev_t *p = &g_wlan; - - acquire_bus(ACQUIRE_AND_WAKEUP); - p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0); - release_bus(RELEASE_ONLY); -} int wilc_wlan_stop(struct net_device *dev) { wilc_wlan_dev_t *p = &g_wlan; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/17] staging: wilc1000: wilc_wlan_start: add argument struct net_device
This patch adds new argument struct net_device and pass dev to the function. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index bb37f5b..2226ddb 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -584,7 +584,7 @@ static int linux_wlan_start_firmware(struct net_device *dev) /* start firmware */ PRINT_D(INIT_DBG, "Starting Firmware ...\n"); - ret = wilc_wlan_start(); + ret = wilc_wlan_start(dev); if (ret < 0) { PRINT_ER("Failed to start Firmware\n"); goto _fail_; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 93fae34..894466f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1489,7 +1489,7 @@ _fail_1: * Common * / -int wilc_wlan_start(void) +int wilc_wlan_start(struct net_device *dev) { wilc_wlan_dev_t *p = &g_wlan; u32 reg = 0; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index c948c25..73e01a7 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -297,7 +297,7 @@ typedef struct { int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer, u32 buffer_size); -int wilc_wlan_start(void); +int wilc_wlan_start(struct net_device *dev); int wilc_wlan_stop(struct net_device *dev); int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/17] staging: wilc1000: release_bus: add argument struct wilc
This patch adds new argument struct wilc and use it instead of g_linux_wlan, pass wilc to the functions as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/wilc_wlan.c | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a61dbea..898f60e 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -122,13 +122,13 @@ static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire) } } -static inline void release_bus(BUS_RELEASE_T release) +static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release) { #ifdef WILC_OPTIMIZE_SLEEP_INT if (release == RELEASE_ALLOW_SLEEP) chip_allow_sleep(); #endif - mutex_unlock(&g_linux_wlan->hif_cs); + mutex_unlock(&wilc->hif_cs); } / * @@ -831,7 +831,7 @@ void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime) g_wlan.hif_func.hif_write_reg(0x10a8, 1); genuChipPSstate = CHIP_SLEEPING_MANUAL; - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); } @@ -954,7 +954,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) * wait for vmm table is ready **/ PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); usleep_range(3000, 3000); acquire_bus(wilc, ACQUIRE_AND_WAKEUP); } @@ -1002,7 +1002,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) entries = ((reg >> 3) & 0x3f); break; } else { - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); usleep_range(3000, 3000); acquire_bus(wilc, ACQUIRE_AND_WAKEUP); PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg); @@ -1047,7 +1047,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) /* since copying data into txb takes some time, then * allow the bus lock to be released let the RX task go. */ - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); /** * Copy data to the TX buffer @@ -1126,7 +1126,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) _end_: - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); if (ret != 1) break; } while (0); @@ -1412,7 +1412,7 @@ void wilc_handle_isr(void *wilc) #endif wilc_unknown_isr_ext(); } - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); } / @@ -1473,7 +1473,7 @@ int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer, offset += size2; size -= size2; } - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); if (!ret) { /*EIO 5*/ @@ -1522,7 +1522,7 @@ int wilc_wlan_start(struct net_device *dev) ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CFG, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n"); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); /* EIO 5*/ ret = -5; return ret; @@ -1563,7 +1563,7 @@ int wilc_wlan_start(struct net_device *dev) ret = p->hif_func.hif_write_reg(WILC_GP_REG_1, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n"); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); /* EIO 5*/ ret = -5; return ret; @@ -1577,7 +1577,7 @@ int wilc_wlan_start(struct net_device *dev) ret = p->hif_func.hif_read_reg(0x1000, &chipid); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n"); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); /* EIO 5*/
[PATCH 14/17] staging: wilc1000: acquire_bus: add new argument struct wilc
This patch adds struct wilc and use it instead of g_linux_wlan, pass dev to the functions as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/wilc_wlan.c | 47 ++-- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 894466f..a61dbea 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -109,10 +109,10 @@ static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP; /*acquire_bus() and release_bus() are made static inline functions*/ /*as a temporary workaround to fix a problem of receiving*/ /*unknown interrupt from FW*/ -static inline void acquire_bus(BUS_ACQUIRE_T acquire) +static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire) { - mutex_lock(&g_linux_wlan->hif_cs); + mutex_lock(&wilc->hif_cs); #ifndef WILC_OPTIMIZE_SLEEP_INT if (genuChipPSstate != CHIP_WAKEDUP) #endif @@ -812,11 +812,16 @@ static inline void chip_wakeup(void) #endif void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime) { + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; + + wilc = nic->wilc; + if (genuChipPSstate != CHIP_WAKEDUP) { /* chip is already sleeping. Do nothing */ return; } - acquire_bus(ACQUIRE_ONLY); + acquire_bus(wilc, ACQUIRE_ONLY); #ifdef WILC_OPTIMIZE_SLEEP_INT chip_allow_sleep(); @@ -921,7 +926,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) PRINT_D(TX_DBG, "Mark the last entry in VMM table - number of previous entries = %d\n", i); vmm_table[i] = 0x0; /* mark the last element to 0 */ } - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); counter = 0; do { @@ -951,7 +956,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); release_bus(RELEASE_ALLOW_SLEEP); usleep_range(3000, 3000); - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); } } while (!p->quit); @@ -999,7 +1004,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) } else { release_bus(RELEASE_ALLOW_SLEEP); usleep_range(3000, 3000); - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg); } } while (--timeout); @@ -1102,7 +1107,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) /** * lock the bus **/ - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); ret = p->hif_func.hif_clear_int_ext(ENABLE_TX_VMM); if (!ret) { @@ -1385,7 +1390,7 @@ void wilc_handle_isr(void *wilc) { u32 int_status; - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); g_wlan.hif_func.hif_read_int(&int_status); if (int_status & PLL_INT_EXT) @@ -1423,6 +1428,10 @@ int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer, u32 addr, size, size2, blksz; u8 *dma_buffer; int ret = 0; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; + + wilc = nic->wilc; blksz = BIT(12); /* Allocate a DMA coherent buffer. */ @@ -1447,7 +1456,7 @@ int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer, addr = BYTE_SWAP(addr); size = BYTE_SWAP(size); #endif - acquire_bus(ACQUIRE_ONLY); + acquire_bus(wilc, ACQUIRE_ONLY); offset += 8; while (((int)size) && (offset < buffer_size)) { if (size <= blksz) @@ -1495,6 +1504,10 @@ int wilc_wlan_start(struct net_device *dev) u32 reg = 0; int ret; u32 chipid; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; + + wilc = nic->wilc; /** * Set the host interface @@ -1505,7 +1518,7 @@ int wilc_wlan_start(struct net_device *dev) } else if (p->io_func.io_type == HIF_SPI) { reg = 1; } - a
[PATCH 17/17] staging: wilc1000: wilc_netdev_init: use wilc instead of g_linux_wlan
Use wilc instead of g_linux_wlan. g_liux_wlan is not used anymore, just delete it. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan.c | 22 +++--- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3801a00..5d4e64f 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -112,7 +112,6 @@ static void wilc_set_multicast_list(struct net_device *dev); * for now - in frmw_to_linux there should be private data to be passed to it * and this data should be pointer to net device */ -struct wilc *g_linux_wlan; bool bEnablePS = true; static const struct net_device_ops wilc_netdev_ops = { @@ -1702,15 +1701,16 @@ int wilc_netdev_init(struct wilc **wilc) int i; perInterface_wlan_t *nic; struct net_device *ndev; + struct wilc *wl; sema_init(&close_exit_sync, 0); /*create the common structure*/ - g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL); - if (!g_linux_wlan) + wl = kzalloc(sizeof(struct wilc), GFP_KERNEL); + if (!wl) return -ENOMEM; - *wilc = g_linux_wlan; + *wilc = wl; register_inetaddr_notifier(&g_dev_notifier); @@ -1737,11 +1737,11 @@ int wilc_netdev_init(struct wilc **wilc) } else strcpy(ndev->name, "p2p%d"); - nic->u8IfIdx = g_linux_wlan->vif_num; + nic->u8IfIdx = wl->vif_num; nic->wilc_netdev = ndev; - nic->wilc = *wilc; - g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev; - g_linux_wlan->vif_num++; + nic->wilc = wl; + wl->vif[wl->vif_num].ndev = ndev; + wl->vif_num++; ndev->netdev_ops = &wilc_netdev_ops; { @@ -1781,13 +1781,13 @@ int wilc_netdev_init(struct wilc **wilc) } #ifndef WILC_SDIO - if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) { + if (!linux_spi_init(&wl->wilc_spidev)) { PRINT_ER("Can't initialize SPI\n"); return -1; /* ERROR */ } - g_linux_wlan->wilc_spidev = wilc_spi_dev; + wl->wilc_spidev = wilc_spi_dev; #else - g_linux_wlan->wilc_sdio_func = local_sdio_func; + wl->wilc_sdio_func = local_sdio_func; #endif return 0; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 31d5ac9..54d798c 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -206,7 +206,6 @@ struct WILC_WFI_mon_priv { struct net_device *real_ndev; }; -extern struct wilc *g_linux_wlan; extern struct net_device *WILC_WFI_devs[]; void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); void linux_wlan_mac_indicate(struct wilc *wilc, int flag); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/17] staging: wilc1000: linux_wlan_get_num_conn_ifcs: add argument net_device
This patch add new argument struct net_device and use netdev private data member wilc instead of g_linux_wlan, pass dev to the function as well. Signed-off-by: Glen Lee --- drivers/staging/wilc1000/host_interface.c | 4 +--- drivers/staging/wilc1000/linux_wlan.c | 10 +++--- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 1263b5e..2a8330e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -271,8 +271,6 @@ static struct host_if_drv *join_req_drv; static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); -extern int linux_wlan_get_num_conn_ifcs(void); - static int add_handler_in_list(struct host_if_drv *handler) { int i; @@ -2991,7 +2989,7 @@ static int hostIFthread(void *pvArg) del_timer(&hif_drv->scan_timer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); - if (!linux_wlan_get_num_conn_ifcs()) + if (!linux_wlan_get_num_conn_ifcs(hif_drv->priv->dev)) chip_sleep_manually(hif_drv->priv->dev, INFINITE_SLEEP_TIME); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2226ddb..3801a00 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -421,14 +421,18 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID) } /*Function to get number of connected interfaces*/ -int linux_wlan_get_num_conn_ifcs(void) +int linux_wlan_get_num_conn_ifcs(struct net_device *dev) { u8 i = 0; u8 null_bssid[6] = {0}; u8 ret_val = 0; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; - for (i = 0; i < g_linux_wlan->vif_num; i++) - if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6)) + wilc = nic->wilc; + + for (i = 0; i < wilc->vif_num; i++) + if (memcmp(wilc->vif[i].bssid, null_bssid, 6)) ret_val++; return ret_val; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 07917ea..31d5ac9 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -219,4 +219,5 @@ void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue); int linux_wlan_get_firmware(struct net_device *dev); +int linux_wlan_get_num_conn_ifcs(struct net_device *dev); #endif -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel