Re: [PATCH 2/2] staging: most: avoid assignment in if

2015-11-27 Thread Dan Carpenter
Just ignore the checkpatch warning.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next] hv_netvsc: rework link status change handling

2015-11-27 Thread Vitaly Kuznetsov
There are several issues in hv_netvsc driver with regards to link status
change handling:
- RNDIS_STATUS_NETWORK_CHANGE results in calling userspace helper doing
  '/etc/init.d/network restart' and this is inappropriate and broken for
  many reasons.
- link_watch infrastructure only sends one notification per second and
  in case of e.g. paired disconnect/connect events we get only one
  notification with last status. This makes it impossible to handle such
  situations in userspace.

Redo link status changes handling in the following way:
- Create a list of reconfig events in network device context.
- On a reconfig event add it to the list of events and schedule
  netvsc_link_change().
- In netvsc_link_change() ensure 2-second delay between link status
  changes.
- Handle RNDIS_STATUS_NETWORK_CHANGE as a paired disconnect/connect event.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/net/hyperv/hyperv_net.h |  14 +++-
 drivers/net/hyperv/netvsc_drv.c | 142 +++-
 2 files changed, 108 insertions(+), 48 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 5fa98f5..7661a12 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -177,7 +177,6 @@ struct rndis_device {
 
enum rndis_device_state state;
bool link_state;
-   bool link_change;
atomic_t new_req_id;
 
spinlock_t request_lock;
@@ -644,11 +643,24 @@ struct netvsc_stats {
struct u64_stats_sync syncp;
 };
 
+struct netvsc_reconfig {
+   struct list_head list;
+   u32 event;
+};
+
 /* The context of the netvsc device  */
 struct net_device_context {
/* point back to our device context */
struct hv_device *device_ctx;
+   /* reconfigure work */
struct delayed_work dwork;
+   /* last reconfig time */
+   unsigned long last_reconfig;
+   /* reconfig events */
+   struct list_head reconfig_events;
+   /* list protection */
+   spinlock_t lock;
+
struct work_struct work;
u32 msg_enable; /* debug level */
 
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 409b48e..268a058 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -42,6 +42,7 @@
 
 
 #define RING_SIZE_MIN 64
+#define LINKCHANGE_INT (2 * HZ)
 static int ring_size = 128;
 module_param(ring_size, int, S_IRUGO);
 MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
@@ -647,37 +648,33 @@ void netvsc_linkstatus_callback(struct hv_device 
*device_obj,
struct net_device *net;
struct net_device_context *ndev_ctx;
struct netvsc_device *net_device;
-   struct rndis_device *rdev;
-
-   net_device = hv_get_drvdata(device_obj);
-   rdev = net_device->extension;
+   struct netvsc_reconfig *event;
+   unsigned long flags;
 
-   switch (indicate->status) {
-   case RNDIS_STATUS_MEDIA_CONNECT:
-   rdev->link_state = false;
-   break;
-   case RNDIS_STATUS_MEDIA_DISCONNECT:
-   rdev->link_state = true;
-   break;
-   case RNDIS_STATUS_NETWORK_CHANGE:
-   rdev->link_change = true;
-   break;
-   default:
+   /* Handle link change statuses only */
+   if (indicate->status != RNDIS_STATUS_NETWORK_CHANGE &&
+   indicate->status != RNDIS_STATUS_MEDIA_CONNECT &&
+   indicate->status != RNDIS_STATUS_MEDIA_DISCONNECT)
return;
-   }
 
+   net_device = hv_get_drvdata(device_obj);
net = net_device->ndev;
 
if (!net || net->reg_state != NETREG_REGISTERED)
return;
 
ndev_ctx = netdev_priv(net);
-   if (!rdev->link_state) {
-   schedule_delayed_work(&ndev_ctx->dwork, 0);
-   schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20));
-   } else {
-   schedule_delayed_work(&ndev_ctx->dwork, 0);
-   }
+
+   event = kzalloc(sizeof(*event), GFP_ATOMIC);
+   if (!event)
+   return;
+   event->event = indicate->status;
+
+   spin_lock_irqsave(&ndev_ctx->lock, flags);
+   list_add_tail(&event->list, &ndev_ctx->reconfig_events);
+   spin_unlock_irqrestore(&ndev_ctx->lock, flags);
+
+   schedule_delayed_work(&ndev_ctx->dwork, 0);
 }
 
 /*
@@ -1009,12 +1006,9 @@ static const struct net_device_ops device_ops = {
 };
 
 /*
- * Send GARP packet to network peers after migrations.
- * After Quick Migration, the network is not immediately operational in the
- * current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add
- * another netif_notify_peers() into a delayed work, otherwise GARP packet
- * will not be sent after quick migration, and cause network disconnection.
- * Also, we update the carrier status here.
+ * Handle link status changes. For RNDIS_STATUS_NETWORK_CHANGE emulate link
+ * down/up sequence. In case of RND

Re: [PATCH v4 0/7] staging: sm750fb: refactor lynxfb_pci_probe

2015-11-27 Thread Mike Rapoport
On Sun, Nov 08, 2015 at 11:52:16AM +0200, Mike Rapoport wrote:
> Hi,
> 
> These patches refactor the lynxfb_pci_probe

Any comments on this? Should I resend?
 
> v4 changes:
> * address Dan's comments
> 
> v3 changes:
> * rebased on current Greg's staging-testing
> 
> v2 changes:
> * add pci_disable_device on the cleanup path
> * return actual error rather than ENODEV
> 
> 
> Mike Rapoport (7):
>   staging: sm750fb: disable PCI device if lynxfb_pci_probe fails
>   staging: sm750fb: lynxfb_pci_probe: return actual errors
>   staging: sm750fb: lynxfb_pci_remove: remove unused variable
>   staging: sm750fb: replace dual member of sm750_dev with fb_count
>   staging: sm750fb: introduce sm750fb_frambuffer_release
>   staging: sm750fb: introduce sm750fb_frambuffer_alloc
>   staging: sm750fb: lynxfb_pci_probe: remove some pr_info
> 
>  drivers/staging/sm750fb/sm750.c | 183 
> +---
>  drivers/staging/sm750fb/sm750.h |   2 +-
>  2 files changed, 80 insertions(+), 105 deletions(-)
> 
> -- 
> 1.9.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/18] staging: sm750fb: change some register fields defines

2015-11-27 Thread Mike Rapoport
On Mon, Nov 16, 2015 at 09:59:49AM +0200, Mike Rapoport wrote:
> Hi,
> 
> This is the first set of patches that aim to replace custom defines for
> register fields. The ultimate goal is to have MSB:LSB notation for register
> fields and FIELD_* macros removed. 

I'd highly appreciate some feedback on these...
 
> Mike Rapoport (18):
>   staging: sm750fb: hw_sm750(le)_deWait: rename dwVal to val
>   staging: sm750fb: use BIT macro for DE_STATE1 single-bit field
>   staging: sm750fb: use BIT macro for DE_STATE2 single-bit fields
>   staging: sm750fb: remove unused DE_STATE2_DE_RESERVED
>   staging: sm750fb: use BIT macro for SYSTEM_CTRL single-bit fields
>   staging: sm750fb: change definition of SYSTEM_CTRL multi-bit fields
>   staging: sm750fb: ddk750_initHw: rename ulReg to reg
>   staging: sm750fb: use BIT macro for MISC_CTRL single-bit fields
>   staging: sm750fb: ddk750_sii164: fix defines for i2c{Read,Write}reg
>   staging: sm750fb: use BIT macro for GPIO_MUX single-bit fields
>   staging: sm750fb: change definition of MISC_CTRL multi-bit fields
>   staging: sm750fb: use BIT macro for CURRENT_GATE single-bit fields
>   staging: sm750fb: set{Memory,Master}Clock: rename ulReg to reg
>   staging: sm750fb: change definition of CURRENT_GATE multi-bit fields
>   staging: sm750fb: use BIT macro for MODE0_GATE single-bit fields
>   staging: sm750fb: change definition of MODE0_GATE multi-bit fields
>   staging: sm750fb: use BIT macro for POWER_MODE_CTRL single-bit fields
>   staging: sm750fb: change definition of POWER_MODE_CTRL multi-bit field
> 
>  drivers/staging/sm750fb/ddk750_chip.c|  83 +++--
>  drivers/staging/sm750fb/ddk750_display.c |  24 +-
>  drivers/staging/sm750fb/ddk750_hwi2c.c   |   7 +-
>  drivers/staging/sm750fb/ddk750_power.c   |  43 ++-
>  drivers/staging/sm750fb/ddk750_power.h   |  11 +-
>  drivers/staging/sm750fb/ddk750_reg.h | 503 
> ++-
>  drivers/staging/sm750fb/ddk750_sii164.c  |   4 +-
>  drivers/staging/sm750fb/sm750_hw.c   |  57 ++--
>  8 files changed, 256 insertions(+), 476 deletions(-)
> 
> -- 
> 1.9.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 0/7] staging: sm750fb: refactor lynxfb_pci_probe

2015-11-27 Thread Dan Carpenter
On Fri, Nov 27, 2015 at 09:30:23PM +0200, Mike Rapoport wrote:
> On Sun, Nov 08, 2015 at 11:52:16AM +0200, Mike Rapoport wrote:
> > Hi,
> > 
> > These patches refactor the lynxfb_pci_probe
> 
> Any comments on this? Should I resend?

No.  Wait for Greg to get to it.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/18] staging: sm750fb: change some register fields defines

2015-11-27 Thread Dan Carpenter
Just wait for Greg.  He'll get to it eventually.  It won't be lost or
silently dropped.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: lustre: ptlrpc: constify ptlrpc_sec_cops structs

2015-11-27 Thread Aya Mahfouz
Constifies ptlrpc_sec_cops structures in the lustre driver
since they are not modified after their initialization.

Detected and found using Coccinelle.

Suggested-by: Julia Lawall 
Signed-off-by: Aya Mahfouz 
---
Changelog:
v2: added const to a ptlrpc_sec_cops structure
in the definition of ptlrpc_sec_policy

 drivers/staging/lustre/lustre/include/lustre_sec.h | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec.c | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c| 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h 
b/drivers/staging/lustre/lustre/include/lustre_sec.h
index dd1033b..de35e2f 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -779,7 +779,7 @@ struct ptlrpc_sec_policy {
struct module  *sp_owner;
char   *sp_name;
__u16  sp_policy; /* policy number */
-   struct ptlrpc_sec_cops   *sp_cops;   /* client ops */
+   const struct ptlrpc_sec_cops *sp_cops;   /* client ops */
struct ptlrpc_sec_sops   *sp_sops;   /* server ops */
 };
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 39f5261..f959897 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -1580,7 +1580,7 @@ int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req,
   int segment, int newsize)
 {
struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
-   struct ptlrpc_sec_cops *cops;
+   const struct ptlrpc_sec_cops *cops;
struct lustre_msg *msg = req->rq_reqmsg;
 
LASSERT(ctx);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
index ebfa609..ffdad15 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
@@ -378,7 +378,7 @@ static struct ptlrpc_ctx_ops null_ctx_ops = {
.verify  = null_ctx_verify,
 };
 
-static struct ptlrpc_sec_cops null_sec_cops = {
+static const struct ptlrpc_sec_cops null_sec_cops = {
.create_sec  = null_create_sec,
.destroy_sec= null_destroy_sec,
.lookup_ctx  = null_lookup_ctx,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
index f448b45..71351de 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
@@ -956,7 +956,7 @@ static struct ptlrpc_ctx_ops plain_ctx_ops = {
.unwrap_bulk= plain_cli_unwrap_bulk,
 };
 
-static struct ptlrpc_sec_cops plain_sec_cops = {
+static const struct ptlrpc_sec_cops plain_sec_cops = {
.create_sec  = plain_create_sec,
.destroy_sec= plain_destroy_sec,
.kill_sec  = plain_kill_sec,
-- 
2.4.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel