[PATCH V6 0/8] introduce Hyper-V VM Socket(hv_sock)

2016-01-26 Thread Dexuan Cui
Changes since v1:
- updated "[PATCH 6/7] hvsock: introduce Hyper-V VM Sockets feature"
- added __init and __exit for the module init/exit functions
- net/hv_sock/Kconfig: "default m" -> "default m if HYPERV"
- MODULE_LICENSE: "Dual MIT/GPL" -> "Dual BSD/GPL" 

Changes since v2:
- fixed various coding issue pointed out by David Miller
- fixed indentation issues
- removed pr_debug in net/hv_sock/af_hvsock.c
- used reverse-Chrismas-tree style for local variables.
- EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL

Changes since v3:
- fixed a few coding issue pointed by Vitaly Kuznetsov and Dan Carpenter
- fixed the ret value in vmbus_recvpacket_hvsock on error
- fixed the style of multi-line comment: vmbus_get_hvsock_rw_status()

Changes since v4 (https://lkml.org/lkml/2015/7/28/404):
- addressed all the comments about V4.
- treat the hvsock offers/channels as special VMBus devices
- add a mechanism to pass hvsock events to the hvsock driver
- fixed some corner cases with proper locking when a connection is closed
- rebased to the latest Greg's tree

Changes since v5 (https://lkml.org/lkml/2015/12/24/103):
- addressed the coding style issues (Vitaly Kuznetsov & David Miller, thanks!)
- used a better coding for the per-channel rescind callback (Thank Vitaly!)
- avoided the introduction of new VMBUS driver APIs vmbus_sendpacket_hvsock()
and vmbus_recvpacket_hvsock() and used vmbus_sendpacket()/vmbus_recvpacket()
in the higher level (i.e., the vmsock driver). Thank Vitaly!

Hyper-V VM Socket (hv_sock) is a byte-stream based communication mechanism
between Windowsd 10 (or later) host and a guest. It's kind of TCP over
VMBus, but the transportation layer (VMBus) is much simpler than IP.
With Hyper-V VM Sockets, applications between the host and a guest can
talk with each other directly by the traditional BSD-style socket APIs.

The patchset implements the necessary support in the guest side by adding
the necessary new APIs in the vmbus driver, and introducing a new driver
hv_sock.ko, which implements_a new socket address family AF_HYPERV.

I know the kernel has already had a VM Sockets driver (AF_VSOCK) based
on VMware's VMCI (net/vmw_vsock/, drivers/misc/vmw_vmci), and KVM is
proposing AF_VSOCK of virtio version:
http://thread.gmane.org/gmane.linux.network/365205.

However, though Hyper-V VM Sockets may seem conceptually similar to
AF_VOSCK, there are differences in the transportation layer, and IMO these
make the direct code reusing impractical:

1. In AF_VSOCK, the endpoint type is: , but in
AF_HYPERV, the endpoint type is: . Here GUID
is 128-bit.

2. AF_VSOCK supports SOCK_DGRAM, while AF_HYPERV doesn't.

3. AF_VSOCK supports some special sock opts, like SO_VM_SOCKETS_BUFFER_SIZE,
SO_VM_SOCKETS_BUFFER_MIN/MAX_SIZE and SO_VM_SOCKETS_CONNECT_TIMEOUT.
These are meaningless to AF_HYPERV.

4. Some AF_VSOCK's VMCI transportation ops are meanless to AF_HYPERV/VMBus,
like.notify_recv_init
.notify_recv_pre_block
.notify_recv_pre_dequeue
.notify_recv_post_dequeue
.notify_send_init
.notify_send_pre_block
.notify_send_pre_enqueue
.notify_send_post_enqueue
etc.

So I think we'd better introduce a new address family: AF_HYPERV.

Please review the patchset.

Looking forward to your comments!

Dexuan Cui (9):
  Drivers: hv: vmbus: add a helper function to set a channel's pending
send size
  Drivers: hv: vmbus: define the new offer type for Hyper-V socket
(hvsock)
  Drivers: hv: vmbus: define a new VMBus message type for hvsock
  Drivers: hv: ring_buffer: enhance hv_ringbuffer_read() to support
hvsock
  Drivers: hv: vmbus: add APIs to send/recv hvsock packets
  Drivers: hv: vmbus: add a hvsock flag in struct hv_driver
  Drivers: hv: vmbus: add a mechanism to pass hvsock events to the
hvsock driver
  Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()
  hvsock: introduce Hyper-V VM Sockets feature

 MAINTAINERS |2 +
 drivers/hv/channel.c|   84 ++-
 drivers/hv/channel_mgmt.c   |   53 +-
 drivers/hv/connection.c |4 +-
 drivers/hv/hyperv_vmbus.h   |   13 +-
 drivers/hv/ring_buffer.c|   54 +-
 drivers/hv/vmbus_drv.c  |4 +
 include/linux/hyperv.h  |   88 +++
 include/linux/socket.h  |4 +-
 include/net/af_hvsock.h |   44 ++
 include/uapi/linux/hyperv.h |   16 +
 net/Kconfig |1 +
 net/Makefile|1 +
 net/hv_sock/Kconfig |   10 +
 net/hv_sock/Makefile|3 +
 net/hv_sock/af_hvsock.c | 1473 +++
 16 files changed, 1830 insertions(+), 24 deletions(-)
 create mode 100644 include/net/af_hvsock.h
 create mode 100644 net/hv_sock/Kconfig
 create mode 100644 net/hv_sock/Makefile
 create mode 100644 net/hv_sock/af_hvsock.c

-- 
2.1.4

Dexuan Cui (8):
  Drivers: hv: vmbus: add a helper function to set a channel's pending
send size
  Drivers: hv: vmbus: define the new offer type for Hyper-V socket
(hvsock)

[PATCH V6 1/8] Drivers: hv: vmbus: add a helper function to set a channel's pending send size

2016-01-26 Thread Dexuan Cui
This will be used by the coming net/hvsock driver.

Signed-off-by: Dexuan Cui 
---
 include/linux/hyperv.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 753dbad..e4867a7 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -790,6 +790,12 @@ static inline void *get_per_channel_state(struct 
vmbus_channel *c)
return c->per_channel_state;
 }
 
+static inline void set_channel_pending_send_size(struct vmbus_channel *c,
+u32 size)
+{
+   c->outbound.ring_buffer->pending_send_sz = size;
+}
+
 void vmbus_onmessage(void *context);
 
 int vmbus_request_offers(void);
-- 
2.1.0

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


[PATCH V6 2/8] Drivers: hv: vmbus: define the new offer type for Hyper-V socket (hvsock)

2016-01-26 Thread Dexuan Cui
A helper function is also added.

Signed-off-by: Dexuan Cui 
---
 include/linux/hyperv.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index e4867a7..c0eddd7 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -235,6 +235,7 @@ struct vmbus_channel_offer {
 #define VMBUS_CHANNEL_LOOPBACK_OFFER   0x100
 #define VMBUS_CHANNEL_PARENT_OFFER 0x200
 #define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION   0x400
+#define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER 0x2000
 
 struct vmpacket_descriptor {
u16 type;
@@ -769,6 +770,12 @@ struct vmbus_channel {
enum hv_signal_policy  signal_policy;
 };
 
+static inline bool is_hvsock_channel(const struct vmbus_channel *c)
+{
+   return !!(c->offermsg.offer.chn_flags &
+ VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER);
+}
+
 static inline void set_channel_signal_state(struct vmbus_channel *c,
enum hv_signal_policy policy)
 {
-- 
2.1.0

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


[PATCH V6 3/8] Drivers: hv: vmbus: vmbus_sendpacket_ctl: hvsock: avoid unnecessary signaling

2016-01-26 Thread Dexuan Cui
When the hvsock channel's outbound ringbuffer is full (i.e.,
hv_ringbuffer_write() returns -EAGAIN), we should avoid the unnecessary
signaling the host.

Signed-off-by: Dexuan Cui 
---
 drivers/hv/channel.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 1161d68..3f04533 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -659,6 +659,9 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, 
void *buffer,
 * If we cannot write to the ring-buffer; signal the host
 * even if we may not have written anything. This is a rare
 * enough condition that it should not matter.
+* NOTE: in this case, the hvsock channel is an exception, because
+* it looks the host side's hvsock implementation has a throttling
+* mechanism which can hurt the performance otherwise.
 */
 
if (channel->signal_policy)
@@ -666,7 +669,8 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, 
void *buffer,
else
kick_q = true;
 
-   if (((ret == 0) && kick_q && signal) || (ret))
+   if (((ret == 0) && kick_q && signal) ||
+   (ret && !is_hvsock_channel(channel)))
vmbus_setevent(channel);
 
return ret;
-- 
2.1.0

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


[PATCH V6 5/8] Drivers: hv: vmbus: add a hvsock flag in struct hv_driver

2016-01-26 Thread Dexuan Cui
Only the coming hv_sock driver has a "true" value for this flag.

We treat the hvsock offers/channels as special VMBus devices.
Since the hv_sock driver handles all the hvsock offers/channels, we need to
tweak vmbus_match() for hv_sock driver, so we introduce this flag.

Signed-off-by: Dexuan Cui 
---
 drivers/hv/vmbus_drv.c |  4 
 include/linux/hyperv.h | 14 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 328e4c3..c1c9d71 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -562,6 +562,10 @@ static int vmbus_match(struct device *device, struct 
device_driver *driver)
struct hv_driver *drv = drv_to_hv_drv(driver);
struct hv_device *hv_dev = device_to_hv_device(device);
 
+   /* The hv_sock driver handles all hv_sock offers. */
+   if (is_hvsock_channel(hv_dev->channel))
+   return drv->hvsock;
+
if (hv_vmbus_get_id(drv->id_table, &hv_dev->dev_type))
return 1;
 
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index b835d80..5587711 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -964,6 +964,20 @@ extern void vmbus_ontimer(unsigned long data);
 struct hv_driver {
const char *name;
 
+   /*
+* A hvsock offer, which has a VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER
+* channel flag, actually doesn't mean a synthetic device because the
+* offer's if_type/if_instance can change for every new hvsock
+* connection.
+*
+* However, to facilitate the notification of new-offer/rescind-offer
+* from vmbus driver to hvsock driver, we can handle hvsock offer as
+* a special vmbus device, and hence we need the below flag to
+* indicate if the driver is the hvsock driver or not: we need to
+* specially treat the hvosck offer & driver in vmbus_match().
+*/
+   bool hvsock;
+
/* the device type supported by this driver */
uuid_le dev_type;
const struct hv_vmbus_device_id *id_table;
-- 
2.1.0

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


[PATCH V6 4/8] Drivers: hv: vmbus: define a new VMBus message type for hvsock

2016-01-26 Thread Dexuan Cui
A function to send the type of message is also added.

The coming net/hvsock driver will use this function to proactively request
the host to offer a VMBus channel for a new hvsock connection.

Signed-off-by: Dexuan Cui 
---
 drivers/hv/channel.c  | 15 +++
 drivers/hv/channel_mgmt.c |  4 
 include/linux/hyperv.h| 13 +
 3 files changed, 32 insertions(+)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 3f04533..fcab234 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -219,6 +219,21 @@ error0:
 }
 EXPORT_SYMBOL_GPL(vmbus_open);
 
+/* Used for Hyper-V Socket: a guest client's connect() to the host */
+int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
+ const uuid_le *shv_host_servie_id)
+{
+   struct vmbus_channel_tl_connect_request conn_msg;
+
+   memset(&conn_msg, 0, sizeof(conn_msg));
+   conn_msg.header.msgtype = CHANNELMSG_TL_CONNECT_REQUEST;
+   conn_msg.guest_endpoint_id = *shv_guest_servie_id;
+   conn_msg.host_service_id = *shv_host_servie_id;
+
+   return vmbus_post_msg(&conn_msg, sizeof(conn_msg));
+}
+EXPORT_SYMBOL_GPL(vmbus_send_tl_connect_request);
+
 /*
  * create_gpadl_header - Creates a gpadl for the specified buffer
  */
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 1c1ad47..4611b50 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -825,6 +825,10 @@ struct vmbus_channel_message_table_entry
{CHANNELMSG_VERSION_RESPONSE,   1, vmbus_onversion_response},
{CHANNELMSG_UNLOAD, 0, NULL},
{CHANNELMSG_UNLOAD_RESPONSE,1, vmbus_unload_response},
+   {CHANNELMSG_18, 0, NULL},
+   {CHANNELMSG_19, 0, NULL},
+   {CHANNELMSG_20, 0, NULL},
+   {CHANNELMSG_TL_CONNECT_REQUEST, 0, NULL},
 };
 
 /*
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index c0eddd7..b835d80 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -392,6 +392,10 @@ enum vmbus_channel_message_type {
CHANNELMSG_VERSION_RESPONSE = 15,
CHANNELMSG_UNLOAD   = 16,
CHANNELMSG_UNLOAD_RESPONSE  = 17,
+   CHANNELMSG_18   = 18,
+   CHANNELMSG_19   = 19,
+   CHANNELMSG_20   = 20,
+   CHANNELMSG_TL_CONNECT_REQUEST   = 21,
CHANNELMSG_COUNT
 };
 
@@ -562,6 +566,13 @@ struct vmbus_channel_initiate_contact {
u64 monitor_page2;
 } __packed;
 
+/* Hyper-V socket: guest's connect()-ing to host */
+struct vmbus_channel_tl_connect_request {
+   struct vmbus_channel_message_header header;
+   uuid_le guest_endpoint_id;
+   uuid_le host_service_id;
+} __packed;
+
 struct vmbus_channel_version_response {
struct vmbus_channel_message_header header;
u8 version_supported;
@@ -1255,4 +1266,6 @@ void hv_process_channel_removal(struct vmbus_channel 
*channel, u32 relid);
 
 extern __u32 vmbus_proto_version;
 
+int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
+ const uuid_le *shv_host_servie_id);
 #endif /* _HYPERV_H */
-- 
2.1.0

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


[PATCH V6 7/8] Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()

2016-01-26 Thread Dexuan Cui
The hvsock driver needs this API to release all the resources related
to the channel.

Signed-off-by: Dexuan Cui 
---
 drivers/hv/channel_mgmt.c | 33 -
 drivers/hv/connection.c   |  4 ++--
 include/linux/hyperv.h|  2 ++
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index b782944..68607d8 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -195,6 +195,7 @@ void hv_process_channel_removal(struct vmbus_channel 
*channel, u32 relid)
vmbus_release_relid(relid);
 
BUG_ON(!channel->rescind);
+   BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
 
if (channel->target_cpu != get_cpu()) {
put_cpu();
@@ -206,9 +207,7 @@ void hv_process_channel_removal(struct vmbus_channel 
*channel, u32 relid)
}
 
if (channel->primary_channel == NULL) {
-   mutex_lock(&vmbus_connection.channel_mutex);
list_del(&channel->listentry);
-   mutex_unlock(&vmbus_connection.channel_mutex);
 
primary_channel = channel;
} else {
@@ -251,6 +250,7 @@ static void vmbus_process_offer(struct vmbus_channel 
*newchannel)
struct vmbus_channel *channel;
bool fnew = true;
unsigned long flags;
+   int ret;
 
/* Make sure this is a new offer */
mutex_lock(&vmbus_connection.channel_mutex);
@@ -330,7 +330,11 @@ static void vmbus_process_offer(struct vmbus_channel 
*newchannel)
 * binding which eventually invokes the device driver's AddDevice()
 * method.
 */
-   if (vmbus_device_register(newchannel->device_obj) != 0) {
+   mutex_lock(&vmbus_connection.channel_mutex);
+   ret = vmbus_device_register(newchannel->device_obj);
+   mutex_unlock(&vmbus_connection.channel_mutex);
+
+   if (ret != 0) {
pr_err("unable to add child device object (relid %d)\n",
newchannel->offermsg.child_relid);
kfree(newchannel->device_obj);
@@ -592,6 +596,8 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
struct device *dev;
 
rescind = (struct vmbus_channel_rescind_offer *)hdr;
+
+   mutex_lock(&vmbus_connection.channel_mutex);
channel = relid2channel(rescind->child_relid);
 
if (channel == NULL) {
@@ -600,7 +606,7 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
 * vmbus_process_offer(), we have already invoked
 * vmbus_release_relid() on error.
 */
-   return;
+   goto out;
}
 
spin_lock_irqsave(&channel->lock, flags);
@@ -610,7 +616,7 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
if (channel->device_obj) {
if (channel->chn_rescind_callback) {
channel->chn_rescind_callback(channel);
-   return;
+   goto out;
}
/*
 * We will have to unregister this device from the
@@ -625,7 +631,24 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
hv_process_channel_removal(channel,
channel->offermsg.child_relid);
}
+
+out:
+   mutex_unlock(&vmbus_connection.channel_mutex);
+}
+
+
+void vmbus_hvsock_device_unregister(struct vmbus_channel *channel)
+{
+   mutex_lock(&vmbus_connection.channel_mutex);
+
+   BUG_ON(!is_hvsock_channel(channel));
+
+   channel->rescind = true;
+   vmbus_device_unregister(channel->device_obj);
+
+   mutex_unlock(&vmbus_connection.channel_mutex);
 }
+EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister);
 
 /*
  * vmbus_onoffers_delivered -
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 3dc5a9c..deb48e6 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -288,7 +288,8 @@ struct vmbus_channel *relid2channel(u32 relid)
struct list_head *cur, *tmp;
struct vmbus_channel *cur_sc;
 
-   mutex_lock(&vmbus_connection.channel_mutex);
+   BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
+
list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
if (channel->offermsg.child_relid == relid) {
found_channel = channel;
@@ -307,7 +308,6 @@ struct vmbus_channel *relid2channel(u32 relid)
}
}
}
-   mutex_unlock(&vmbus_connection.channel_mutex);
 
return found_channel;
 }
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index ff89d4c..acbbcb1 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1041,6 +1041,8 @@ int __must_check __vmbus_driver_register(struct hv_driver 
*hv_driver,
 const

[PATCH V6 6/8] Drivers: hv: vmbus: add a per-channel rescind callback

2016-01-26 Thread Dexuan Cui
This will be used by the coming hv_sock driver.

Signed-off-by: Dexuan Cui 
---
 drivers/hv/channel_mgmt.c | 11 +++
 include/linux/hyperv.h|  9 +
 2 files changed, 20 insertions(+)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 4611b50..b782944 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -608,6 +608,10 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
spin_unlock_irqrestore(&channel->lock, flags);
 
if (channel->device_obj) {
+   if (channel->chn_rescind_callback) {
+   channel->chn_rescind_callback(channel);
+   return;
+   }
/*
 * We will have to unregister this device from the
 * driver core.
@@ -977,3 +981,10 @@ bool vmbus_are_subchannels_present(struct vmbus_channel 
*primary)
return ret;
 }
 EXPORT_SYMBOL_GPL(vmbus_are_subchannels_present);
+
+void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel,
+   void (*chn_rescind_cb)(struct vmbus_channel *))
+{
+   channel->chn_rescind_callback = chn_rescind_cb;
+}
+EXPORT_SYMBOL_GPL(vmbus_set_chn_rescind_callback);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 5587711..ff89d4c 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -740,6 +740,12 @@ struct vmbus_channel {
void (*sc_creation_callback)(struct vmbus_channel *new_sc);
 
/*
+* Channel rescind callback. Some channels (the hvsock ones), need to
+* register a callback which is invoked in vmbus_onoffer_rescind().
+*/
+   void (*chn_rescind_callback)(struct vmbus_channel *channel);
+
+   /*
 * The spinlock to protect the structure. It is being used to protect
 * test-and-set access to various attributes of the structure as well
 * as all sc_list operations.
@@ -825,6 +831,9 @@ int vmbus_request_offers(void);
 void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
void (*sc_cr_cb)(struct vmbus_channel *new_sc));
 
+void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel,
+   void (*chn_rescind_cb)(struct vmbus_channel *));
+
 /*
  * Retrieve the (sub) channel on which to send an outgoing request.
  * When a primary channel has multiple sub-channels, we choose a
-- 
2.1.0

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


[PATCH V6 8/8] hvsock: introduce Hyper-V Socket feature

2016-01-26 Thread Dexuan Cui
Hyper-V socket (hvsock) supplies a byte-stream based communication
mechanism between the host and a guest. It's kind of like TCP over VMBus,
but the transportation layer (VMBus) is much simpler than IP. With
Hyper-V Socket, applications between the host and a guest can talk
to each other directly by the traditional BSD-style socket APIs.

Hyper-V Socket is only available on new Windows hosts. The patch
implements the necessary support in the guest side by introducing
a new socket address family AF_HYPERV.

Signed-off-by: Dexuan Cui 
Cc: Vitaly Kuznetsov 
---
 MAINTAINERS |2 +
 include/linux/hyperv.h  |   16 +
 include/linux/socket.h  |4 +-
 include/net/af_hvsock.h |   51 ++
 include/uapi/linux/hyperv.h |   16 +
 net/Kconfig |1 +
 net/Makefile|1 +
 net/hv_sock/Kconfig |   10 +
 net/hv_sock/Makefile|3 +
 net/hv_sock/af_hvsock.c | 1480 +++
 10 files changed, 1583 insertions(+), 1 deletion(-)
 create mode 100644 include/net/af_hvsock.h
 create mode 100644 net/hv_sock/Kconfig
 create mode 100644 net/hv_sock/Makefile
 create mode 100644 net/hv_sock/af_hvsock.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 10b3f33..86eb25b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5200,7 +5200,9 @@ F:drivers/input/serio/hyperv-keyboard.c
 F: drivers/net/hyperv/
 F: drivers/scsi/storvsc_drv.c
 F: drivers/video/fbdev/hyperv_fb.c
+F: net/hv_sock/
 F: include/linux/hyperv.h
+F: include/net/af_hvsock.h
 F: tools/hv/
 F: Documentation/ABI/stable/sysfs-bus-vmbus
 
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index acbbcb1..4bbc7f6 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1293,4 +1293,20 @@ extern __u32 vmbus_proto_version;
 
 int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
  const uuid_le *shv_host_servie_id);
+struct vmpipe_proto_header {
+   u32 pkt_type;
+   u32 data_size;
+} __packed;
+
+#define HVSOCK_HEADER_LEN  (sizeof(struct vmpacket_descriptor) + \
+sizeof(struct vmpipe_proto_header))
+
+/* See 'prev_indices' in hv_ringbuffer_read(), hv_ringbuffer_write() */
+#define PREV_INDICES_LEN   (sizeof(u64))
+
+#define HVSOCK_PKT_LEN(payload_len)(HVSOCK_HEADER_LEN + \
+   ALIGN((payload_len), 8) + \
+   PREV_INDICES_LEN)
+#define HVSOCK_MIN_PKT_LEN HVSOCK_PKT_LEN(1)
+
 #endif /* _HYPERV_H */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5bf59c8..d5ef612 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -200,7 +200,8 @@ struct ucred {
 #define AF_ALG 38  /* Algorithm sockets*/
 #define AF_NFC 39  /* NFC sockets  */
 #define AF_VSOCK   40  /* vSockets */
-#define AF_MAX 41  /* For now.. */
+#define AF_HYPERV  41  /* Hyper-V virtual sockets  */
+#define AF_MAX 42  /* For now.. */
 
 /* Protocol families, same as address families. */
 #define PF_UNSPEC  AF_UNSPEC
@@ -246,6 +247,7 @@ struct ucred {
 #define PF_ALG AF_ALG
 #define PF_NFC AF_NFC
 #define PF_VSOCK   AF_VSOCK
+#define PF_HYPERV  AF_HYPERV
 #define PF_MAX AF_MAX
 
 /* Maximum queue length specifiable by listen.  */
diff --git a/include/net/af_hvsock.h b/include/net/af_hvsock.h
new file mode 100644
index 000..a5aa28d
--- /dev/null
+++ b/include/net/af_hvsock.h
@@ -0,0 +1,51 @@
+#ifndef __AF_HVSOCK_H__
+#define __AF_HVSOCK_H__
+
+#include 
+#include 
+#include 
+
+#define VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV (5 * PAGE_SIZE)
+#define VMBUS_RINGBUFFER_SIZE_HVSOCK_SEND (5 * PAGE_SIZE)
+
+#define HVSOCK_RCV_BUF_SZ  VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV
+#define HVSOCK_SND_BUF_SZ  PAGE_SIZE
+
+#define sk_to_hvsock(__sk)((struct hvsock_sock *)(__sk))
+#define hvsock_to_sk(__hvsk)   ((struct sock *)(__hvsk))
+
+struct hvsock_sock {
+   /* sk must be the first member. */
+   struct sock sk;
+
+   struct sockaddr_hv local_addr;
+   struct sockaddr_hv remote_addr;
+
+   /* protected by the global hvsock_mutex */
+   struct list_head bound_list;
+   struct list_head connected_list;
+
+   struct list_head accept_queue;
+   /* used by enqueue and dequeue */
+   struct mutex accept_queue_mutex;
+
+   struct delayed_work dwork;
+
+   u32 peer_shutdown;
+
+   struct vmbus_channel *channel;
+
+   struct {
+   struct vmpipe_proto_header hdr;
+   char buf[HVSOCK_SND_BUF_SZ];
+   } __packed send;
+
+   struct {
+   struct vmpipe_proto_header hdr;
+   char buf[HVSOCK_RCV_BUF_SZ];
+   unsigned int data_len;
+   unsigned int data_offset;
+   } __packed recv;
+};
+
+#e

[PATCH] staging: wilc1000: fix alignment for open parenthesis

2016-01-26 Thread Chaehyun Lim
This patch fixes the check found by checkpatch.pl
CHECK: Alignment should match open parenthesis

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 90 +++
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 98627a6..716f359 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -303,7 +303,7 @@ static s32 handle_set_channel(struct wilc_vif *vif,
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
 
if (result) {
PRINT_ER("Failed to set channel\n");
@@ -350,7 +350,7 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
wid.size = sizeof(u32);
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
 
if ((hif_op_mode->mode) == IDLE_MODE)
up(&hif_sema_driver);
@@ -383,7 +383,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 
*ip_addr, u8 idx)
wid.size = IP_ALEN;
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
 
host_int_get_ipaddress(vif, firmware_ip_addr, idx);
 
@@ -408,7 +408,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 
idx)
wid.size = IP_ALEN;
 
result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
 
@@ -451,7 +451,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to set mac address\n");
result = -EFAULT;
@@ -473,7 +473,7 @@ static s32 handle_get_mac_address(struct wilc_vif *vif,
wid.size = ETH_ALEN;
 
result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
 
if (result) {
PRINT_ER("Failed to get mac address\n");
@@ -939,7 +939,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif,
wid.size = sizeof(char);
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
 
if (result) {
PRINT_ER("Failed to set abort running scan\n");
@@ -1356,7 +1356,7 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
-wilc_get_vif_idx(vif));
+ wilc_get_vif_idx(vif));
if (result)
PRINT_ER("Failed to send dissconect config packet\n");
 
@@ -1750,8 +1750,8 @@ static int Handle_Key(struct wilc_vif *vif,
strWIDList[3].val = (s8 *)pu8keybuf;
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG,
-   strWIDList, 4,
-   wilc_get_vif_idx(vif));
+ strWIDList, 4,
+ wilc_get_vif_idx(vif));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & ADDKEY) {
PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
@@ -1772,8 +1772,8 @@ static int Handle_Key(struct wilc_vif *vif,
wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2;
 
result = wilc_send_config_pkt(vif->wilc, SET_CFG,
-   &wid, 1,
-   wilc_get_vif_idx(vif));
+ &wid, 1,
+ wilc_get_vif_idx(vif));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & REMOVEKEY) {
PRINT_D(HOSTINF_DBG, "Removing key\n");
@@ -1785,8 +1785,8 @@ sta

Re: [PATCH V6 8/8] hvsock: introduce Hyper-V Socket feature

2016-01-26 Thread Olaf Hering
On Tue, Jan 26, Dexuan Cui wrote:

> +#define AF_MAX   42  /* For now.. */

Maybe net/core/sock.c needs additional strings for the new socket?

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


Re: [PATCH 16/26] libceph: Use skcipher

2016-01-26 Thread Herbert Xu
On Mon, Jan 25, 2016 at 05:18:47PM +0100, Ilya Dryomov wrote:
> 
> Could you get rid of ivsize instead of assigning to it - see the
> attached diff?

How about an incremental patch like this? Thanks!

---8<---
From: Ilya Dryomov 
Subject: libceph: Remove unnecessary ivsize variables

This patch removes the unnecessary ivsize variabls as they always
have the value of AES_BLOCK_SIZE.

Signed-off-by: Ilya Dryomov 

diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index fb9cb2b..db2847a 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -166,8 +166,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm);
int ret;
-   int ivsize = AES_BLOCK_SIZE;
-   char iv[ivsize];
+   char iv[AES_BLOCK_SIZE];
size_t zero_padding = (0x10 - (src_len & 0x0f));
char pad[16];
 
@@ -186,7 +185,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
goto out_tfm;
 
crypto_skcipher_setkey((void *)tfm, key, key_len);
-   memcpy(iv, aes_iv, ivsize);
+   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
 
skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL);
@@ -229,8 +228,7 @@ static int ceph_aes_encrypt2(const void *key, int key_len, 
void *dst,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm);
int ret;
-   int ivsize = AES_BLOCK_SIZE;
-   char iv[ivsize];
+   char iv[AES_BLOCK_SIZE];
size_t zero_padding = (0x10 - ((src1_len + src2_len) & 0x0f));
char pad[16];
 
@@ -250,7 +248,7 @@ static int ceph_aes_encrypt2(const void *key, int key_len, 
void *dst,
goto out_tfm;
 
crypto_skcipher_setkey((void *)tfm, key, key_len);
-   memcpy(iv, aes_iv, ivsize);
+   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
 
skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL);
@@ -294,8 +292,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm);
char pad[16];
-   int ivsize = AES_BLOCK_SIZE;
-   char iv[16];
+   char iv[AES_BLOCK_SIZE];
int ret;
int last_byte;
 
@@ -310,7 +307,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
goto out_tfm;
 
crypto_skcipher_setkey((void *)tfm, key, key_len);
-   memcpy(iv, aes_iv, ivsize);
+   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
 
skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL);
@@ -363,8 +360,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm);
char pad[16];
-   int ivsize = AES_BLOCK_SIZE;
-   char iv[ivsize];
+   char iv[AES_BLOCK_SIZE];
int ret;
int last_byte;
 
@@ -380,7 +376,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
goto out_tfm;
 
crypto_skcipher_setkey((void *)tfm, key, key_len);
-   memcpy(iv, aes_iv, ivsize);
+   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
 
skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL);

-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 04/22] staging: iio: Fix dependencies for !HAS_IOMEM archs

2016-01-26 Thread Geert Uytterhoeven
On Mon, Jan 25, 2016 at 11:24 PM, Richard Weinberger  wrote:
> Not every arch has io memory.
> So, unbreak the build by fixing the dependencies.
>
> Signed-off-by: Richard Weinberger 

Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 16/26] libceph: Use skcipher

2016-01-26 Thread Ilya Dryomov
On Tue, Jan 26, 2016 at 11:54 AM, Herbert Xu
 wrote:
> On Mon, Jan 25, 2016 at 05:18:47PM +0100, Ilya Dryomov wrote:
>>
>> Could you get rid of ivsize instead of assigning to it - see the
>> attached diff?
>
> How about an incremental patch like this? Thanks!
>
> ---8<---
> From: Ilya Dryomov 
> Subject: libceph: Remove unnecessary ivsize variables
>
> This patch removes the unnecessary ivsize variabls as they always
> have the value of AES_BLOCK_SIZE.
>
> Signed-off-by: Ilya Dryomov 
>
> diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
> index fb9cb2b..db2847a 100644
> --- a/net/ceph/crypto.c
> +++ b/net/ceph/crypto.c
> @@ -166,8 +166,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
> struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
> SKCIPHER_REQUEST_ON_STACK(req, tfm);
> int ret;
> -   int ivsize = AES_BLOCK_SIZE;
> -   char iv[ivsize];
> +   char iv[AES_BLOCK_SIZE];
> size_t zero_padding = (0x10 - (src_len & 0x0f));
> char pad[16];
>
> @@ -186,7 +185,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
> goto out_tfm;
>
> crypto_skcipher_setkey((void *)tfm, key, key_len);
> -   memcpy(iv, aes_iv, ivsize);
> +   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
>
> skcipher_request_set_tfm(req, tfm);
> skcipher_request_set_callback(req, 0, NULL, NULL);
> @@ -229,8 +228,7 @@ static int ceph_aes_encrypt2(const void *key, int 
> key_len, void *dst,
> struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
> SKCIPHER_REQUEST_ON_STACK(req, tfm);
> int ret;
> -   int ivsize = AES_BLOCK_SIZE;
> -   char iv[ivsize];
> +   char iv[AES_BLOCK_SIZE];
> size_t zero_padding = (0x10 - ((src1_len + src2_len) & 0x0f));
> char pad[16];
>
> @@ -250,7 +248,7 @@ static int ceph_aes_encrypt2(const void *key, int 
> key_len, void *dst,
> goto out_tfm;
>
> crypto_skcipher_setkey((void *)tfm, key, key_len);
> -   memcpy(iv, aes_iv, ivsize);
> +   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
>
> skcipher_request_set_tfm(req, tfm);
> skcipher_request_set_callback(req, 0, NULL, NULL);
> @@ -294,8 +292,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
> struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
> SKCIPHER_REQUEST_ON_STACK(req, tfm);
> char pad[16];
> -   int ivsize = AES_BLOCK_SIZE;
> -   char iv[16];
> +   char iv[AES_BLOCK_SIZE];
> int ret;
> int last_byte;
>
> @@ -310,7 +307,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
> goto out_tfm;
>
> crypto_skcipher_setkey((void *)tfm, key, key_len);
> -   memcpy(iv, aes_iv, ivsize);
> +   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
>
> skcipher_request_set_tfm(req, tfm);
> skcipher_request_set_callback(req, 0, NULL, NULL);
> @@ -363,8 +360,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
> struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
> SKCIPHER_REQUEST_ON_STACK(req, tfm);
> char pad[16];
> -   int ivsize = AES_BLOCK_SIZE;
> -   char iv[ivsize];
> +   char iv[AES_BLOCK_SIZE];
> int ret;
> int last_byte;
>
> @@ -380,7 +376,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
> goto out_tfm;
>
> crypto_skcipher_setkey((void *)tfm, key, key_len);
> -   memcpy(iv, aes_iv, ivsize);
> +   memcpy(iv, aes_iv, AES_BLOCK_SIZE);
>
> skcipher_request_set_tfm(req, tfm);
> skcipher_request_set_callback(req, 0, NULL, NULL);

LGTM.  You want to take it through crypto?

Thanks,

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


Re: [PATCH 16/26] libceph: Use skcipher

2016-01-26 Thread Herbert Xu
On Tue, Jan 26, 2016 at 12:29:57PM +0100, Ilya Dryomov wrote:
>
> LGTM.  You want to take it through crypto?

That's probably the easiest route since I'd like to take the first
patch through cryptodev.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] added fbtft ssd1305 controller support

2016-01-26 Thread Alexey Mednyy
Signed-off-by: Alexey Mednyy 
---
 drivers/staging/fbtft/Kconfig  |   6 +
 drivers/staging/fbtft/Makefile |   1 +
 drivers/staging/fbtft/fb_ssd1305.c | 271 +
 3 files changed, 278 insertions(+)
 create mode 100644 drivers/staging/fbtft/fb_ssd1305.c

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index 883ff5b..0bfc776 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -117,6 +117,12 @@ config FB_TFT_SSD1289
help
  Framebuffer support for SSD1289
 
+config FB_TFT_SSD1305
+tristate "FB driver for the SSD1305 OLED Controller"
+depends on FB_TFT
+help
+  Framebuffer support for SSD1305
+
 config FB_TFT_SSD1306
tristate "FB driver for the SSD1306 OLED Controller"
depends on FB_TFT
diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
index 4f9071d..1ddc764 100644
--- a/drivers/staging/fbtft/Makefile
+++ b/drivers/staging/fbtft/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_FB_TFT_RA8875)  += fb_ra8875.o
 obj-$(CONFIG_FB_TFT_S6D02A1) += fb_s6d02a1.o
 obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o
 obj-$(CONFIG_FB_TFT_SSD1289) += fb_ssd1289.o
+obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1305.o
 obj-$(CONFIG_FB_TFT_SSD1306) += fb_ssd1306.o
 obj-$(CONFIG_FB_TFT_SSD1331) += fb_ssd1331.o
 obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o
diff --git a/drivers/staging/fbtft/fb_ssd1305.c 
b/drivers/staging/fbtft/fb_ssd1305.c
new file mode 100644
index 000..2f65fb8
--- /dev/null
+++ b/drivers/staging/fbtft/fb_ssd1305.c
@@ -0,0 +1,271 @@
+/*
+ * FB driver for the SSD1305 OLED Controller
+ *
+ * based on SSD1306 driver by Noralf Tronnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "fbtft.h"
+
+#define DRVNAME"fb_ssd1305"
+#define WIDTH  128
+#define HEIGHT 64
+
+/*
+ *
+ *
+ * write_reg() caveat:
+ *
+ *This doesn't work because D/C has to be LOW for both values:
+ *  write_reg(par, val1, val2);
+ *
+ *Do it like this:
+ *   write_reg(par, val1);
+ *  write_reg(par, val2);
+*/
+
+/* Init sequence taken from the Adafruit SSD1306 Arduino library */
+static int init_display(struct fbtft_par *par)
+{
+   par->fbtftops.reset(par);
+
+   if (par->gamma.curves[0] == 0) {
+   mutex_lock(&par->gamma.lock);
+   if (par->info->var.yres == 64)
+   par->gamma.curves[0] = 0xCF;
+   else
+   par->gamma.curves[0] = 0x8F;
+   mutex_unlock(&par->gamma.lock);
+   }
+
+   /* Set Display OFF */
+   write_reg(par, 0xAE);
+
+   /* Set Display Clock Divide Ratio/ Oscillator Frequency */
+   write_reg(par, 0xD5);
+   write_reg(par, 0x80);
+
+   /* Set Multiplex Ratio */
+   write_reg(par, 0xA8);
+   if (par->info->var.yres == 64)
+   write_reg(par, 0x3F);
+   else
+   write_reg(par, 0x1F);
+
+   /* Set Display Offset */
+   write_reg(par, 0xD3);
+   write_reg(par, 0x0);
+
+   /* Set Display Start Line */
+   write_reg(par, 0x40 | 0x0);
+
+   /* Charge Pump Setting */
+   write_reg(par, 0x8D);
+   /* A[2] = 1b, Enable charge pump during display on */
+   write_reg(par, 0x14);
+
+   /* Set Memory Addressing Mode */
+   write_reg(par, 0x20);
+   /* Vertical addressing mode  */
+   write_reg(par, 0x01);
+
+   /*Set Segment Re-map */
+   /* column address 127 is mapped to SEG0 */
+   write_reg(par, 0xA0 | ((par->info->var.rotate == 180) ? 0x0 : 0x1));
+
+   /* Set COM Output Scan Direction */
+   /* remapped mode. Scan from COM[N-1] to COM0 */
+   write_reg(par, ((par->info->var.rotate == 180) ? 0xC8 : 0xC0));
+
+   /* Set COM Pins Hardware Configuration */
+   write_reg(par, 0xDA);
+   if (par->info->var.yres == 64)
+   /* A[4]=1b, Alternative COM pin configuration */
+   write_reg(par, 0x12);
+   else
+   /* A[4]=0b, Sequential COM pin configuration */
+   write_reg(par, 0x02);
+
+   /* Set Pre-charge Period */
+   write_reg(par, 0xD9);
+   write_reg(par, 0xF1);
+
+   /* Set VCOMH Deselect Level */
+   write_reg(par, 0xDB);
+   /* according to the datasheet, this value is out of bounds */
+   write_reg(par, 0x40);
+
+   /* Entire Display O

[PATCH] add fbtft ssd1325 controller support

2016-01-26 Thread Alexey Mednyy
Signed-off-by: Alexey Mednyy 
---
 drivers/staging/fbtft/Kconfig  |   6 +
 drivers/staging/fbtft/Makefile |   1 +
 drivers/staging/fbtft/fb_ssd1325.c | 266 +
 3 files changed, 273 insertions(+)
 create mode 100644 drivers/staging/fbtft/fb_ssd1325.c

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index 0bfc776..6f5e824 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -129,6 +129,12 @@ config FB_TFT_SSD1306
help
  Framebuffer support for SSD1306
 
+config FB_TFT_SSD1325
+tristate "FB driver for the SSD1325 OLED Controller"
+depends on FB_TFT
+help
+  Framebuffer support for SSD1305
+
 config FB_TFT_SSD1331
tristate "FB driver for the SSD1331 LCD Controller"
depends on FB_TFT
diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
index 1ddc764..2725ea9 100644
--- a/drivers/staging/fbtft/Makefile
+++ b/drivers/staging/fbtft/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o
 obj-$(CONFIG_FB_TFT_SSD1289) += fb_ssd1289.o
 obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1305.o
 obj-$(CONFIG_FB_TFT_SSD1306) += fb_ssd1306.o
+obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1325.o
 obj-$(CONFIG_FB_TFT_SSD1331) += fb_ssd1331.o
 obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o
 obj-$(CONFIG_FB_TFT_ST7735R) += fb_st7735r.o
diff --git a/drivers/staging/fbtft/fb_ssd1325.c 
b/drivers/staging/fbtft/fb_ssd1325.c
new file mode 100644
index 000..cdb96be
--- /dev/null
+++ b/drivers/staging/fbtft/fb_ssd1325.c
@@ -0,0 +1,266 @@
+/*
+ * FB driver for the SSD1325 OLED Controller
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "fbtft.h"
+
+#define DRVNAME"fb_ssd1325"
+#define WIDTH  128
+#define HEIGHT 64
+
+#define GAMMA_NUM   1
+#define GAMMA_LEN   15
+#define DEFAULT_GAMMA "7 1 1 1 1 2 2 3 3 4 4 5 5 6 6"
+
+/*
+ * write_reg() caveat:
+ *
+ *This doesn't work because D/C has to be LOW for both values:
+ *  write_reg(par, val1, val2);
+ *
+ *Do it like this:
+ *  write_reg(par, val1);
+ *  write_reg(par, val2);
+ */
+
+/* Init sequence taken from the Adafruit SSD1306 Arduino library */
+static int init_display(struct fbtft_par *par)
+{
+   par->fbtftops.reset(par);
+
+   gpio_set_value(par->gpio.cs, 0);
+
+   write_reg(par, 0xb3);
+   write_reg(par, 0xf0);
+   write_reg(par, 0xae);
+   write_reg(par, 0xa1);
+   write_reg(par, 0x00);
+   write_reg(par, 0xa8);
+   write_reg(par, 0x3f);
+   write_reg(par, 0xa0);
+   write_reg(par, 0x45);
+   write_reg(par, 0xa2);
+   write_reg(par, 0x40);
+   write_reg(par, 0x75);
+   write_reg(par, 0x00);
+   write_reg(par, 0x3f);
+   write_reg(par, 0x15);
+   write_reg(par, 0x00);
+   write_reg(par, 0x7f);
+   write_reg(par, 0xa4);
+   write_reg(par, 0xaf);
+
+   return 0;
+}
+
+static uint8_t rgb565_to_g16(uint16_t pixel)
+{
+   uint16_t b = pixel & 0x1f;
+   uint16_t g = (pixel & (0x3f << 5)) >> 5;
+   uint16_t r = (pixel & (0x1f << (5 + 6))) >> (5 + 6);
+
+   pixel = (299 * r + 587 * g + 114 * b) / 195;
+   if (pixel > 255)
+   pixel = 255;
+   return (uint8_t) pixel / 16;
+}
+
+/* Check if all necessary GPIOS defined */
+static int verify_gpios(struct fbtft_par *par)
+{
+   int i;
+
+   dev_dbg(par->info->device, "%s()\n", __func__);
+
+   if (par->gpio.wr < 0) {
+   dev_err(par->info->device,
+   "Missing info about 'wr' (aka E) gpio. Aborting.\n");
+   return -EINVAL;
+   }
+   for (i = 0; i < 8; ++i) {
+   if (par->gpio.db[i] < 0) {
+   dev_err(par->info->device,
+   "Missing info about 'db[%i]' gpio. Aborting.\n",
+   i);
+   return -EINVAL;
+   }
+   }
+   if (par->gpio.dc < 0) {
+   dev_err(par->info->device,
+   "Missing info about 'dc' gpio. Aborting.\n");
+   return -EINVAL;
+   }
+   if (par->gpio.rd < 0) {
+   dev_err(par->info->device,
+   "Missing info about 'rd' gpio. Aborting.\n");
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+static unsigned long
+request_gpios_matc

Re: [PATCH] added fbtft ssd1305 controller support

2016-01-26 Thread Dan Carpenter

The subject should be:

[PATCH] Staging: fbtft: added ssd1305 controller support

On Tue, Jan 26, 2016 at 04:07:24PM +0300, Alexey Mednyy wrote:
> Signed-off-by: Alexey Mednyy 
> ---
>  drivers/staging/fbtft/Kconfig  |   6 +
>  drivers/staging/fbtft/Makefile |   1 +
>  drivers/staging/fbtft/fb_ssd1305.c | 271 
> +
>  3 files changed, 278 insertions(+)
>  create mode 100644 drivers/staging/fbtft/fb_ssd1305.c
> 
> diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
> index 883ff5b..0bfc776 100644
> --- a/drivers/staging/fbtft/Kconfig
> +++ b/drivers/staging/fbtft/Kconfig
> @@ -117,6 +117,12 @@ config FB_TFT_SSD1289
>   help
> Framebuffer support for SSD1289
>  
> +config FB_TFT_SSD1305
> +tristate "FB driver for the SSD1305 OLED Controller"
> +depends on FB_TFT
> +help
> +  Framebuffer support for SSD1305

Maybe say who the vendor is or where this is used or something.
Checkpatch is supposed to complain about this kind of stuff.  :(

> +
>  config FB_TFT_SSD1306
>   tristate "FB driver for the SSD1306 OLED Controller"
>   depends on FB_TFT
> diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
> index 4f9071d..1ddc764 100644
> --- a/drivers/staging/fbtft/Makefile
> +++ b/drivers/staging/fbtft/Makefile
> @@ -21,6 +21,7 @@ obj-$(CONFIG_FB_TFT_RA8875)  += fb_ra8875.o
>  obj-$(CONFIG_FB_TFT_S6D02A1) += fb_s6d02a1.o
>  obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o
>  obj-$(CONFIG_FB_TFT_SSD1289) += fb_ssd1289.o
> +obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1305.o
>  obj-$(CONFIG_FB_TFT_SSD1306) += fb_ssd1306.o
>  obj-$(CONFIG_FB_TFT_SSD1331) += fb_ssd1331.o
>  obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o
> diff --git a/drivers/staging/fbtft/fb_ssd1305.c 
> b/drivers/staging/fbtft/fb_ssd1305.c
> new file mode 100644
> index 000..2f65fb8
> --- /dev/null
> +++ b/drivers/staging/fbtft/fb_ssd1305.c
> @@ -0,0 +1,271 @@
> +/*
> + * FB driver for the SSD1305 OLED Controller
> + *
> + * based on SSD1306 driver by Noralf Tronnes
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "fbtft.h"
> +
> +#define DRVNAME  "fb_ssd1305"
> +#define WIDTH128
> +#define HEIGHT   64

WIDTH and HEIGHT don't add anything.  Just say ".width = 128,".

> +
> +/*
> + *
> + *
> + * write_reg() caveat:
> + *
> + *This doesn't work because D/C has to be LOW for both values:
> + *  write_reg(par, val1, val2);
> + *
> + *Do it like this:
> + *   write_reg(par, val1);
> + *  write_reg(par, val2);

Clean up this comment a bit.

> +*/
> +
> +/* Init sequence taken from the Adafruit SSD1306 Arduino library */
> +static int init_display(struct fbtft_par *par)
> +{
> + par->fbtftops.reset(par);
> +
> + if (par->gamma.curves[0] == 0) {
> + mutex_lock(&par->gamma.lock);
> + if (par->info->var.yres == 64)
> + par->gamma.curves[0] = 0xCF;
> + else
> + par->gamma.curves[0] = 0x8F;
> + mutex_unlock(&par->gamma.lock);
> + }
> +
> + /* Set Display OFF */
> + write_reg(par, 0xAE);
> +
> + /* Set Display Clock Divide Ratio/ Oscillator Frequency */
> + write_reg(par, 0xD5);
> + write_reg(par, 0x80);
> +
> + /* Set Multiplex Ratio */
> + write_reg(par, 0xA8);
> + if (par->info->var.yres == 64)
> + write_reg(par, 0x3F);
> + else
> + write_reg(par, 0x1F);
> +
> + /* Set Display Offset */
> + write_reg(par, 0xD3);
> + write_reg(par, 0x0);
> +
> + /* Set Display Start Line */
> + write_reg(par, 0x40 | 0x0);
> +
> + /* Charge Pump Setting */
> + write_reg(par, 0x8D);
> + /* A[2] = 1b, Enable charge pump during display on */
> + write_reg(par, 0x14);
> +
> + /* Set Memory Addressing Mode */
> + write_reg(par, 0x20);
> + /* Vertical addressing mode  */
> + write_reg(par, 0x01);
> +
> + /*Set Segment Re-map */
> + /* column address 127 is mapped to SEG0 */
> + write_reg(par, 0xA0 | ((par->info->var.rotate == 180) ? 0x0 : 0x1));
> +
> + /* Set COM Output Scan Direction */
> + /* remapped mode. Scan from COM[N-1] to COM0 */
> + write_reg(par, ((par->info->var.rotate == 180) ? 0xC8 : 0xC0));
> +
> + /* Set COM Pins Hardware Configuration */
> + 

Re: [PATCH] add fbtft ssd1325 controller support

2016-01-26 Thread Dan Carpenter
Same stuff.  Run checkpatch.pl.

> + gpio_set_value(par->gpio.dc, 1);
> + /* Write data */
> +
> + ret =
> + par->fbtftops.write(par, par->txbuf.buf,
> + par->info->var.xres * par->info->var.yres / 2);

Clean that line.

> +static struct fbtft_display display = {
> + .regwidth = 8,
> + .width = WIDTH,
> + .height = HEIGHT,
> + .txbuflen = WIDTH * HEIGHT / 2,

The other driver didn't have a txbuflen.  What does that do?  (I have
barely looked at fbtft before so I don't know).

regards,
dan carpenter

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


Re: [PATCH] added fbtft ssd1305 controller support

2016-01-26 Thread Alexey Mednyy



On 01/26/2016 05:00 PM, Dan Carpenter wrote:

The subject should be:

[PATCH] Staging: fbtft: added ssd1305 controller support

On Tue, Jan 26, 2016 at 04:07:24PM +0300, Alexey Mednyy wrote:

Signed-off-by: Alexey Mednyy 
---
  drivers/staging/fbtft/Kconfig  |   6 +
  drivers/staging/fbtft/Makefile |   1 +
  drivers/staging/fbtft/fb_ssd1305.c | 271 +
  3 files changed, 278 insertions(+)
  create mode 100644 drivers/staging/fbtft/fb_ssd1305.c

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index 883ff5b..0bfc776 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -117,6 +117,12 @@ config FB_TFT_SSD1289
help
  Framebuffer support for SSD1289
  
+config FB_TFT_SSD1305

+tristate "FB driver for the SSD1305 OLED Controller"
+depends on FB_TFT
+help
+  Framebuffer support for SSD1305

Maybe say who the vendor is or where this is used or something.
Checkpatch is supposed to complain about this kind of stuff.  :(
I just followed other descriptions above and below mine, every other 
fbtft drivers have this short description. Do I really need longer 
description?



+
  config FB_TFT_SSD1306
tristate "FB driver for the SSD1306 OLED Controller"
depends on FB_TFT
diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
index 4f9071d..1ddc764 100644
--- a/drivers/staging/fbtft/Makefile
+++ b/drivers/staging/fbtft/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_FB_TFT_RA8875)  += fb_ra8875.o
  obj-$(CONFIG_FB_TFT_S6D02A1) += fb_s6d02a1.o
  obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o
  obj-$(CONFIG_FB_TFT_SSD1289) += fb_ssd1289.o
+obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1305.o
  obj-$(CONFIG_FB_TFT_SSD1306) += fb_ssd1306.o
  obj-$(CONFIG_FB_TFT_SSD1331) += fb_ssd1331.o
  obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o
diff --git a/drivers/staging/fbtft/fb_ssd1305.c 
b/drivers/staging/fbtft/fb_ssd1305.c
new file mode 100644
index 000..2f65fb8
--- /dev/null
+++ b/drivers/staging/fbtft/fb_ssd1305.c
@@ -0,0 +1,271 @@
+/*
+ * FB driver for the SSD1305 OLED Controller
+ *
+ * based on SSD1306 driver by Noralf Tronnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "fbtft.h"
+
+#define DRVNAME"fb_ssd1305"
+#define WIDTH  128
+#define HEIGHT 64

WIDTH and HEIGHT don't add anything.  Just say ".width = 128,".


+
+/*
+ *
+ *
+ * write_reg() caveat:
+ *
+ *This doesn't work because D/C has to be LOW for both values:
+ *  write_reg(par, val1, val2);
+ *
+ *Do it like this:
+ *   write_reg(par, val1);
+ *  write_reg(par, val2);

Clean up this comment a bit.


+*/
+
+/* Init sequence taken from the Adafruit SSD1306 Arduino library */
+static int init_display(struct fbtft_par *par)
+{
+   par->fbtftops.reset(par);
+
+   if (par->gamma.curves[0] == 0) {
+   mutex_lock(&par->gamma.lock);
+   if (par->info->var.yres == 64)
+   par->gamma.curves[0] = 0xCF;
+   else
+   par->gamma.curves[0] = 0x8F;
+   mutex_unlock(&par->gamma.lock);
+   }
+
+   /* Set Display OFF */
+   write_reg(par, 0xAE);
+
+   /* Set Display Clock Divide Ratio/ Oscillator Frequency */
+   write_reg(par, 0xD5);
+   write_reg(par, 0x80);
+
+   /* Set Multiplex Ratio */
+   write_reg(par, 0xA8);
+   if (par->info->var.yres == 64)
+   write_reg(par, 0x3F);
+   else
+   write_reg(par, 0x1F);
+
+   /* Set Display Offset */
+   write_reg(par, 0xD3);
+   write_reg(par, 0x0);
+
+   /* Set Display Start Line */
+   write_reg(par, 0x40 | 0x0);
+
+   /* Charge Pump Setting */
+   write_reg(par, 0x8D);
+   /* A[2] = 1b, Enable charge pump during display on */
+   write_reg(par, 0x14);
+
+   /* Set Memory Addressing Mode */
+   write_reg(par, 0x20);
+   /* Vertical addressing mode  */
+   write_reg(par, 0x01);
+
+   /*Set Segment Re-map */
+   /* column address 127 is mapped to SEG0 */
+   write_reg(par, 0xA0 | ((par->info->var.rotate == 180) ? 0x0 : 0x1));
+
+   /* Set COM Output Scan Direction */
+   /* remapped mode. Scan from COM[N-1] to COM0 */
+   write_reg(par, ((par->info->var.rotate == 180) ? 0xC8 : 0xC0));
+
+   /* Set COM Pins Hardware Configurat

Re: [PATCH] add fbtft ssd1325 controller support

2016-01-26 Thread Alexey Mednyy



On 01/26/2016 05:09 PM, Dan Carpenter wrote:

Same stuff.  Run checkpatch.pl.


+   gpio_set_value(par->gpio.dc, 1);
+   /* Write data */
+
+   ret =
+   par->fbtftops.write(par, par->txbuf.buf,
+   par->info->var.xres * par->info->var.yres / 2);

Clean that line.


+static struct fbtft_display display = {
+   .regwidth = 8,
+   .width = WIDTH,
+   .height = HEIGHT,
+   .txbuflen = WIDTH * HEIGHT / 2,

The other driver didn't have a txbuflen.  What does that do?  (I have
barely looked at fbtft before so I don't know).

fbtft core creates 16bpp framebuffer, and default
txbuflen = display->width * display->height * bpp / 8;

so setting txbuflen saves some space in my case, I have 4bpp display.


regards,
dan carpenter



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


[PATCH v2] added fbtft ssd1305 controller support

2016-01-26 Thread Alexey Mednyy
Signed-off-by: Alexey Mednyy 
---
 drivers/staging/fbtft/Kconfig  |   6 ++
 drivers/staging/fbtft/Makefile |   1 +
 drivers/staging/fbtft/fb_ssd1305.c | 216 +
 3 files changed, 223 insertions(+)
 create mode 100644 drivers/staging/fbtft/fb_ssd1305.c

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index 883ff5b..0bfc776 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -117,6 +117,12 @@ config FB_TFT_SSD1289
help
  Framebuffer support for SSD1289
 
+config FB_TFT_SSD1305
+tristate "FB driver for the SSD1305 OLED Controller"
+depends on FB_TFT
+help
+  Framebuffer support for SSD1305
+
 config FB_TFT_SSD1306
tristate "FB driver for the SSD1306 OLED Controller"
depends on FB_TFT
diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
index 4f9071d..1ddc764 100644
--- a/drivers/staging/fbtft/Makefile
+++ b/drivers/staging/fbtft/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_FB_TFT_RA8875)  += fb_ra8875.o
 obj-$(CONFIG_FB_TFT_S6D02A1) += fb_s6d02a1.o
 obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o
 obj-$(CONFIG_FB_TFT_SSD1289) += fb_ssd1289.o
+obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1305.o
 obj-$(CONFIG_FB_TFT_SSD1306) += fb_ssd1306.o
 obj-$(CONFIG_FB_TFT_SSD1331) += fb_ssd1331.o
 obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o
diff --git a/drivers/staging/fbtft/fb_ssd1305.c 
b/drivers/staging/fbtft/fb_ssd1305.c
new file mode 100644
index 000..4b38c3f
--- /dev/null
+++ b/drivers/staging/fbtft/fb_ssd1305.c
@@ -0,0 +1,216 @@
+/*
+ * FB driver for the SSD1305 OLED Controller
+ *
+ * based on SSD1306 driver by Noralf Tronnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "fbtft.h"
+
+#define DRVNAME"fb_ssd1305"
+
+#define WIDTH 128
+#define HEIGHT 64
+
+/*
+ * write_reg() caveat:
+ *
+ *This doesn't work because D/C has to be LOW for both values:
+ *  write_reg(par, val1, val2);
+ *
+ *Do it like this:
+ *  write_reg(par, val1);
+ *  write_reg(par, val2);
+ */
+
+/* Init sequence taken from the Adafruit SSD1306 Arduino library */
+static int init_display(struct fbtft_par *par)
+{
+   par->fbtftops.reset(par);
+
+   if (par->gamma.curves[0] == 0) {
+   mutex_lock(&par->gamma.lock);
+   if (par->info->var.yres == 64)
+   par->gamma.curves[0] = 0xCF;
+   else
+   par->gamma.curves[0] = 0x8F;
+   mutex_unlock(&par->gamma.lock);
+   }
+
+   /* Set Display OFF */
+   write_reg(par, 0xAE);
+
+   /* Set Display Clock Divide Ratio/ Oscillator Frequency */
+   write_reg(par, 0xD5);
+   write_reg(par, 0x80);
+
+   /* Set Multiplex Ratio */
+   write_reg(par, 0xA8);
+   if (par->info->var.yres == 64)
+   write_reg(par, 0x3F);
+   else
+   write_reg(par, 0x1F);
+
+   /* Set Display Offset */
+   write_reg(par, 0xD3);
+   write_reg(par, 0x0);
+
+   /* Set Display Start Line */
+   write_reg(par, 0x40 | 0x0);
+
+   /* Charge Pump Setting */
+   write_reg(par, 0x8D);
+   /* A[2] = 1b, Enable charge pump during display on */
+   write_reg(par, 0x14);
+
+   /* Set Memory Addressing Mode */
+   write_reg(par, 0x20);
+   /* Vertical addressing mode  */
+   write_reg(par, 0x01);
+
+   /*
+* Set Segment Re-map
+* column address 127 is mapped to SEG0
+*/
+   write_reg(par, 0xA0 | ((par->info->var.rotate == 180) ? 0x0 : 0x1));
+
+   /*
+* Set COM Output Scan Direction
+* remapped mode. Scan from COM[N-1] to COM0
+*/
+   write_reg(par, ((par->info->var.rotate == 180) ? 0xC8 : 0xC0));
+
+   /* Set COM Pins Hardware Configuration */
+   write_reg(par, 0xDA);
+   if (par->info->var.yres == 64) {
+   /* A[4]=1b, Alternative COM pin configuration */
+   write_reg(par, 0x12);
+   } else {
+   /* A[4]=0b, Sequential COM pin configuration */
+   write_reg(par, 0x02);
+   }
+
+   /* Set Pre-charge Period */
+   write_reg(par, 0xD9);
+   write_reg(par, 0xF1);
+
+   /*
+* Entire Display ON
+* Resume to RAM content display. Output follows RAM content
+*/
+   write_reg(par, 0xA4);
+
+   /*
+

[PATCH v2] add fbtft ssd1325 controller support

2016-01-26 Thread Alexey Mednyy
Signed-off-by: Alexey Mednyy 
---
 drivers/staging/fbtft/Kconfig  |   6 ++
 drivers/staging/fbtft/Makefile |   1 +
 drivers/staging/fbtft/fb_ssd1325.c | 205 +
 3 files changed, 212 insertions(+)
 create mode 100644 drivers/staging/fbtft/fb_ssd1325.c

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index 0bfc776..6f5e824 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -129,6 +129,12 @@ config FB_TFT_SSD1306
help
  Framebuffer support for SSD1306
 
+config FB_TFT_SSD1325
+tristate "FB driver for the SSD1325 OLED Controller"
+depends on FB_TFT
+help
+  Framebuffer support for SSD1305
+
 config FB_TFT_SSD1331
tristate "FB driver for the SSD1331 LCD Controller"
depends on FB_TFT
diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile
index 1ddc764..2725ea9 100644
--- a/drivers/staging/fbtft/Makefile
+++ b/drivers/staging/fbtft/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o
 obj-$(CONFIG_FB_TFT_SSD1289) += fb_ssd1289.o
 obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1305.o
 obj-$(CONFIG_FB_TFT_SSD1306) += fb_ssd1306.o
+obj-$(CONFIG_FB_TFT_SSD1305) += fb_ssd1325.o
 obj-$(CONFIG_FB_TFT_SSD1331) += fb_ssd1331.o
 obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o
 obj-$(CONFIG_FB_TFT_ST7735R) += fb_st7735r.o
diff --git a/drivers/staging/fbtft/fb_ssd1325.c 
b/drivers/staging/fbtft/fb_ssd1325.c
new file mode 100644
index 000..15078bf
--- /dev/null
+++ b/drivers/staging/fbtft/fb_ssd1325.c
@@ -0,0 +1,205 @@
+/*
+ * FB driver for the SSD1325 OLED Controller
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "fbtft.h"
+
+#define DRVNAME"fb_ssd1325"
+
+#define WIDTH 128
+#define HEIGHT 64
+#define GAMMA_NUM   1
+#define GAMMA_LEN   15
+#define DEFAULT_GAMMA "7 1 1 1 1 2 2 3 3 4 4 5 5 6 6"
+
+/*
+ * write_reg() caveat:
+ *
+ *This doesn't work because D/C has to be LOW for both values:
+ *  write_reg(par, val1, val2);
+ *
+ *Do it like this:
+ *  write_reg(par, val1);
+ *  write_reg(par, val2);
+ */
+
+/* Init sequence taken from the Adafruit SSD1306 Arduino library */
+static int init_display(struct fbtft_par *par)
+{
+   par->fbtftops.reset(par);
+
+   gpio_set_value(par->gpio.cs, 0);
+
+   write_reg(par, 0xb3);
+   write_reg(par, 0xf0);
+   write_reg(par, 0xae);
+   write_reg(par, 0xa1);
+   write_reg(par, 0x00);
+   write_reg(par, 0xa8);
+   write_reg(par, 0x3f);
+   write_reg(par, 0xa0);
+   write_reg(par, 0x45);
+   write_reg(par, 0xa2);
+   write_reg(par, 0x40);
+   write_reg(par, 0x75);
+   write_reg(par, 0x00);
+   write_reg(par, 0x3f);
+   write_reg(par, 0x15);
+   write_reg(par, 0x00);
+   write_reg(par, 0x7f);
+   write_reg(par, 0xa4);
+   write_reg(par, 0xaf);
+
+   return 0;
+}
+
+static uint8_t rgb565_to_g16(u16 pixel)
+{
+   u16 b = pixel & 0x1f;
+   u16 g = (pixel & (0x3f << 5)) >> 5;
+   u16 r = (pixel & (0x1f << (5 + 6))) >> (5 + 6);
+
+   pixel = (299 * r + 587 * g + 114 * b) / 195;
+   if (pixel > 255)
+   pixel = 255;
+   return (uint8_t)pixel / 16;
+}
+
+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
+{
+   fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par,
+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe,
+ ye);
+
+   write_reg(par, 0x75);
+   write_reg(par, 0x00);
+   write_reg(par, 0x3f);
+   write_reg(par, 0x15);
+   write_reg(par, 0x00);
+   write_reg(par, 0x7f);
+}
+
+static int blank(struct fbtft_par *par, bool on)
+{
+   fbtft_par_dbg(DEBUG_BLANK, par, "%s(blank=%s)\n",
+ __func__, on ? "true" : "false");
+
+   if (on)
+   write_reg(par, 0xAE);
+   else
+   write_reg(par, 0xAF);
+   return 0;
+}
+
+/*
+ * Grayscale Lookup Table
+ * GS1 - GS15
+ * The "Gamma curve" contains the relative values between the entries
+ * in the Lookup table.
+ *
+ * 0 = Setting of GS1 < Setting of GS2 < Setting of GS3.<
+ * Setting of GS14 < Setting of GS15
+ */
+static int set_gamma(struct fbtft_par *par, unsigned long *curves)
+{
+   int i;
+
+   fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
+
+   for (i = 0; i <

Re: [PATCH 17/26] mac802154: Use skcipher

2016-01-26 Thread Stefan Schmidt

Hello.

On 24/01/16 14:18, Herbert Xu wrote:

This patch replaces uses of blkcipher with skcipher.

Signed-off-by: Herbert Xu 

---

  net/mac802154/llsec.c |   41 +++--
  net/mac802154/llsec.h |3 +--
  2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c
index a13d02b..6a3e1c2 100644
--- a/net/mac802154/llsec.c
+++ b/net/mac802154/llsec.c
@@ -17,9 +17,9 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
+#include 
  
  #include "ieee802154_i.h"

  #include "llsec.h"
@@ -144,18 +144,18 @@ llsec_key_alloc(const struct ieee802154_llsec_key 
*template)
goto err_tfm;
}
  
-	key->tfm0 = crypto_alloc_blkcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);

+   key->tfm0 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(key->tfm0))
goto err_tfm;
  
-	if (crypto_blkcipher_setkey(key->tfm0, template->key,

-   IEEE802154_LLSEC_KEY_SIZE))
+   if (crypto_skcipher_setkey(key->tfm0, template->key,
+  IEEE802154_LLSEC_KEY_SIZE))
goto err_tfm0;
  
  	return key;
  
  err_tfm0:

-   crypto_free_blkcipher(key->tfm0);
+   crypto_free_skcipher(key->tfm0);
  err_tfm:
for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
if (key->tfm[i])
@@ -175,7 +175,7 @@ static void llsec_key_release(struct kref *ref)
for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
crypto_free_aead(key->tfm[i]);
  
-	crypto_free_blkcipher(key->tfm0);

+   crypto_free_skcipher(key->tfm0);
kzfree(key);
  }
  
@@ -620,15 +620,17 @@ llsec_do_encrypt_unauth(struct sk_buff *skb, const struct mac802154_llsec *sec,

  {
u8 iv[16];
struct scatterlist src;
-   struct blkcipher_desc req = {
-   .tfm = key->tfm0,
-   .info = iv,
-   .flags = 0,
-   };
+   SKCIPHER_REQUEST_ON_STACK(req, key->tfm0);
+   int err;
  
  	llsec_geniv(iv, sec->params.hwaddr, &hdr->sec);

sg_init_one(&src, skb->data, skb->len);
-   return crypto_blkcipher_encrypt_iv(&req, &src, &src, skb->len);
+   skcipher_request_set_tfm(req, key->tfm0);
+   skcipher_request_set_callback(req, 0, NULL, NULL);
+   skcipher_request_set_crypt(req, &src, &src, skb->len, iv);
+   err = crypto_skcipher_encrypt(req);
+   skcipher_request_zero(req);
+   return err;
  }
  
  static struct crypto_aead*

@@ -830,11 +832,8 @@ llsec_do_decrypt_unauth(struct sk_buff *skb, const struct 
mac802154_llsec *sec,
unsigned char *data;
int datalen;
struct scatterlist src;
-   struct blkcipher_desc req = {
-   .tfm = key->tfm0,
-   .info = iv,
-   .flags = 0,
-   };
+   SKCIPHER_REQUEST_ON_STACK(req, key->tfm0);
+   int err;
  
  	llsec_geniv(iv, dev_addr, &hdr->sec);

data = skb_mac_header(skb) + skb->mac_len;
@@ -842,7 +841,13 @@ llsec_do_decrypt_unauth(struct sk_buff *skb, const struct 
mac802154_llsec *sec,
  
  	sg_init_one(&src, data, datalen);
  
-	return crypto_blkcipher_decrypt_iv(&req, &src, &src, datalen);

+   skcipher_request_set_tfm(req, key->tfm0);
+   skcipher_request_set_callback(req, 0, NULL, NULL);
+   skcipher_request_set_crypt(req, &src, &src, datalen, iv);
+
+   err = crypto_skcipher_decrypt(req);
+   skcipher_request_zero(req);
+   return err;
  }
  
  static int

diff --git a/net/mac802154/llsec.h b/net/mac802154/llsec.h
index 950578e..6f3b658 100644
--- a/net/mac802154/llsec.h
+++ b/net/mac802154/llsec.h
@@ -19,7 +19,6 @@
  
  #include 

  #include 
-#include 
  #include 
  #include 
  #include 
@@ -30,7 +29,7 @@ struct mac802154_llsec_key {
  
  	/* one tfm for each authsize (4/8/16) */

struct crypto_aead *tfm[3];
-   struct crypto_blkcipher *tfm0;
+   struct crypto_skcipher *tfm0;
  
  	struct kref ref;

  };


Reviewed-by: Stefan Schmidt 

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


[PATCH 00/11] sync framework de-staging: part 2 - de-stage

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

This patch series de-stage the sync framework and it a follow up on the 
clean up series I've sent last week:

http://thread.gmane.org/gmane.comp.video.dri.devel/145509   

Now in part 2 we finish the de-stage of the sync framework. It start with the   
move of sync_file from staging to drivers/dma-buf, followed by a bunch of clean 
ups on sync_timeline and sw_sync. Finally we de-stage the later two plus the
debug routines.

Gustavo Padovan (11):
  dma-buf/sync_file: de-stage sync_file
  staging/android: store last signaled value on sync timeline
  staging/android: remove .fill_driver_data() timeline ops
  staging/android: remove .{fence,timeline}_value_str() from
timeline_ops
  staging/android: remove struct sync_timeline_ops
  staging/android: remove sw_sync_timeline and sw_sync_pt
  staging/android: remove sw_sync.[ch] files
  staging/android: rename android_fence to timeline_fence
  dma-buf/sync_timeline: de-stage sync_timeline
  dma-buf/sync_file: bring debug back to sync file
  dma-buf/sync_file: bring sync_dump() back

 drivers/Kconfig|   2 +
 drivers/dma-buf/Kconfig|  21 ++
 drivers/dma-buf/Makefile   |   2 +
 drivers/dma-buf/sw_sync.h  |  32 ++
 drivers/dma-buf/sync_debug.c   | 374 +++
 drivers/dma-buf/sync_debug.h   |  35 ++
 drivers/dma-buf/sync_file.c| 451 +++
 drivers/dma-buf/sync_timeline.c| 222 +++
 drivers/staging/android/Kconfig|  19 -
 drivers/staging/android/Makefile   |   1 -
 drivers/staging/android/sw_sync.c  | 103 --
 drivers/staging/android/sw_sync.h  |  59 ---
 drivers/staging/android/sync.c | 652 -
 drivers/staging/android/sync.h | 261 -
 drivers/staging/android/sync_debug.c   | 372 ---
 drivers/staging/android/trace/sync.h   |  82 -
 drivers/staging/android/uapi/sw_sync.h |  32 --
 drivers/staging/android/uapi/sync.h|  97 -
 include/linux/sync_file.h  | 123 +++
 include/linux/sync_timeline.h  | 114 ++
 include/trace/events/sync_file.h   |  57 +++
 include/trace/events/sync_timeline.h   |  31 ++
 include/uapi/linux/sync.h  |  97 +
 23 files changed, 1561 insertions(+), 1678 deletions(-)
 create mode 100644 drivers/dma-buf/Kconfig
 create mode 100644 drivers/dma-buf/sw_sync.h
 create mode 100644 drivers/dma-buf/sync_debug.c
 create mode 100644 drivers/dma-buf/sync_debug.h
 create mode 100644 drivers/dma-buf/sync_file.c
 create mode 100644 drivers/dma-buf/sync_timeline.c
 delete mode 100644 drivers/staging/android/sw_sync.c
 delete mode 100644 drivers/staging/android/sw_sync.h
 delete mode 100644 drivers/staging/android/sync.c
 delete mode 100644 drivers/staging/android/sync.h
 delete mode 100644 drivers/staging/android/sync_debug.c
 delete mode 100644 drivers/staging/android/trace/sync.h
 delete mode 100644 drivers/staging/android/uapi/sw_sync.h
 delete mode 100644 drivers/staging/android/uapi/sync.h
 create mode 100644 include/linux/sync_file.h
 create mode 100644 include/linux/sync_timeline.h
 create mode 100644 include/trace/events/sync_file.h
 create mode 100644 include/trace/events/sync_timeline.h
 create mode 100644 include/uapi/linux/sync.h

-- 
2.5.0

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


[PATCH 03/11] staging/android: remove .fill_driver_data() timeline ops

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

The .fill_driver_data() ops was just a useless abstraction for
fence_ops op of the same name.

Now that we use fence->seqno to store the value it is cleaner to
remove the abstraction and fill the data directly.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c | 14 --
 drivers/staging/android/sync.c|  9 +
 drivers/staging/android/sync.h|  7 ---
 3 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index b9d53d3..428e22c 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,19 +38,6 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);
 
-static int sw_sync_fill_driver_data(struct fence *fence,
-   void *data, int size)
-{
-   struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-
-   if (size < sizeof(pt->value))
-   return -ENOMEM;
-
-   memcpy(data, &pt->value, sizeof(pt->value));
-
-   return sizeof(pt->value);
-}
-
 static void sw_sync_timeline_value_str(struct sync_timeline *sync_timeline,
   char *str, int size)
 {
@@ -68,7 +55,6 @@ static void sw_sync_fence_value_str(struct fence *fence, char 
*str, int size)
 
 static struct sync_timeline_ops sw_sync_timeline_ops = {
.driver_name = "sw_sync",
-   .fill_driver_data = sw_sync_fill_driver_data,
.timeline_value_str = sw_sync_timeline_value_str,
.fence_value_str = sw_sync_fence_value_str,
 };
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 4eea5c3..39af5fb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -185,11 +185,12 @@ static bool android_fence_enable_signaling(struct fence 
*fence)
 static int android_fence_fill_driver_data(struct fence *fence,
  void *data, int size)
 {
-   struct sync_timeline *parent = fence_parent(fence);
+   if (size < sizeof(fence->seqno))
+   return -ENOMEM;
+
+   memcpy(data, &fence->seqno, sizeof(fence->seqno));
 
-   if (!parent->ops->fill_driver_data)
-   return 0;
-   return parent->ops->fill_driver_data(fence, data, size);
+   return sizeof(fence->seqno);
 }
 
 static void android_fence_value_str(struct fence *fence,
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 4d3dfbf..500838b 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,10 +27,6 @@ struct sync_timeline;
 /**
  * struct sync_timeline_ops - sync object implementation ops
  * @driver_name:   name of the implementation
- * @fill_driver_data:  write implementation specific driver data to data.
- *   should return an error if there is not enough room
- *   as specified by size.  This information is returned
- *   to userspace by SYNC_IOC_FENCE_INFO.
  * @timeline_value_str: fill str with the value of the sync_timeline's counter
  * @fence_value_str:   fill str with the value of the fence
  */
@@ -38,9 +34,6 @@ struct sync_timeline_ops {
const char *driver_name;
 
/* optional */
-   int (*fill_driver_data)(struct fence *fence, void *data, int size);
-
-   /* optional */
void (*timeline_value_str)(struct sync_timeline *timeline, char *str,
   int size);
 
-- 
2.5.0

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


[PATCH 04/11] staging/android: remove .{fence, timeline}_value_str() from timeline_ops

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that the value of fence and the timeline are not stored by sw_sync
anymore we can remove this extra abstraction to retrieve this data.

This patch changes both fence_ops (.fence_value_str and
.timeline_value_str) to return the str directly.

It also clean up struct sync_timeline_ops by removing both ops from there.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c| 17 -
 drivers/staging/android/sync.c   | 16 ++--
 drivers/staging/android/sync.h   |  9 -
 drivers/staging/android/sync_debug.c | 12 ++--
 drivers/staging/android/trace/sync.h | 12 +++-
 5 files changed, 7 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index 428e22c..4200b12 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,25 +38,8 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);
 
-static void sw_sync_timeline_value_str(struct sync_timeline *sync_timeline,
-  char *str, int size)
-{
-   struct sw_sync_timeline *timeline =
-   (struct sw_sync_timeline *)sync_timeline;
-   snprintf(str, size, "%d", timeline->value);
-}
-
-static void sw_sync_fence_value_str(struct fence *fence, char *str, int size)
-{
-   struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-
-   snprintf(str, size, "%d", pt->value);
-}
-
 static struct sync_timeline_ops sw_sync_timeline_ops = {
.driver_name = "sw_sync",
-   .timeline_value_str = sw_sync_timeline_value_str,
-   .fence_value_str = sw_sync_fence_value_str,
 };
 
 struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 39af5fb..f2d298c 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -196,14 +196,7 @@ static int android_fence_fill_driver_data(struct fence 
*fence,
 static void android_fence_value_str(struct fence *fence,
char *str, int size)
 {
-   struct sync_timeline *parent = fence_parent(fence);
-
-   if (!parent->ops->fence_value_str) {
-   if (size)
-   *str = 0;
-   return;
-   }
-   parent->ops->fence_value_str(fence, str, size);
+   snprintf(str, size, "%d", fence->seqno);
 }
 
 static void android_fence_timeline_value_str(struct fence *fence,
@@ -211,12 +204,7 @@ static void android_fence_timeline_value_str(struct fence 
*fence,
 {
struct sync_timeline *parent = fence_parent(fence);
 
-   if (!parent->ops->timeline_value_str) {
-   if (size)
-   *str = 0;
-   return;
-   }
-   parent->ops->timeline_value_str(parent, str, size);
+   snprintf(str, size, "%d", parent->value);
 }
 
 static const struct fence_ops android_fence_ops = {
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 500838b..b1a4b06 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,18 +27,9 @@ struct sync_timeline;
 /**
  * struct sync_timeline_ops - sync object implementation ops
  * @driver_name:   name of the implementation
- * @timeline_value_str: fill str with the value of the sync_timeline's counter
- * @fence_value_str:   fill str with the value of the fence
  */
 struct sync_timeline_ops {
const char *driver_name;
-
-   /* optional */
-   void (*timeline_value_str)(struct sync_timeline *timeline, char *str,
-  int size);
-
-   /* optional */
-   void (*fence_value_str)(struct fence *fence, char *str, int size);
 };
 
 /**
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index b37412d..7517fb3 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -134,16 +134,8 @@ static void sync_print_obj(struct seq_file *s, struct 
sync_timeline *obj)
struct list_head *pos;
unsigned long flags;
 
-   seq_printf(s, "%s %s", obj->name, obj->ops->driver_name);
-
-   if (obj->ops->timeline_value_str) {
-   char value[64];
-
-   obj->ops->timeline_value_str(obj, value, sizeof(value));
-   seq_printf(s, ": %s", value);
-   }
-
-   seq_puts(s, "\n");
+   seq_printf(s, "%s %s: %d\n", obj->name, obj->ops->driver_name,
+  obj->value);
 
spin_lock_irqsave(&obj->child_list_lock, flags);
list_for_each(pos, &obj->child_list_head) {
diff --git a/drivers/staging/android/trace/sync.h 
b/drivers/staging/android/trace/sync.h
index a0f80f4..d7f6457f 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/drivers/staging/android/trace/sync.h
@@ -15,21 +15,15 @@ TRACE_EVENT(sync_timeline,
 
TP_S

[PATCH 02/11] staging/android: store last signaled value on sync timeline

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Now fence timeline is aware of the last signaled fence, as it
receives the increment to the current value in sync_timeline_signal().

That allow us to remove .has_signaled() from timeline_ops as we can
directly compare using timeline->value and fence->seqno in sync.c

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c | 16 ++--
 drivers/staging/android/sync.c| 15 +++
 drivers/staging/android/sync.h| 14 +-
 3 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index 3bee959..b9d53d3 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -30,7 +30,7 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, 
u32 value)
struct sw_sync_pt *pt;
 
pt = (struct sw_sync_pt *)
-   sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt));
+   sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt), value);
 
pt->value = value;
 
@@ -38,15 +38,6 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);
 
-static int sw_sync_fence_has_signaled(struct fence *fence)
-{
-   struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-   struct sw_sync_timeline *obj =
-   (struct sw_sync_timeline *)fence_parent(fence);
-
-   return (pt->value > obj->value) ? 0 : 1;
-}
-
 static int sw_sync_fill_driver_data(struct fence *fence,
void *data, int size)
 {
@@ -77,7 +68,6 @@ static void sw_sync_fence_value_str(struct fence *fence, char 
*str, int size)
 
 static struct sync_timeline_ops sw_sync_timeline_ops = {
.driver_name = "sw_sync",
-   .has_signaled = sw_sync_fence_has_signaled,
.fill_driver_data = sw_sync_fill_driver_data,
.timeline_value_str = sw_sync_timeline_value_str,
.fence_value_str = sw_sync_fence_value_str,
@@ -96,8 +86,6 @@ EXPORT_SYMBOL(sw_sync_timeline_create);
 
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
 {
-   obj->value += inc;
-
-   sync_timeline_signal(&obj->obj);
+   sync_timeline_signal(&obj->obj, inc);
 }
 EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 1e1c009..4eea5c3 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -90,7 +90,7 @@ void sync_timeline_destroy(struct sync_timeline *obj)
 }
 EXPORT_SYMBOL(sync_timeline_destroy);
 
-void sync_timeline_signal(struct sync_timeline *obj)
+void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
 {
unsigned long flags;
struct fence *fence, *next;
@@ -99,6 +99,8 @@ void sync_timeline_signal(struct sync_timeline *obj)
 
spin_lock_irqsave(&obj->child_list_lock, flags);
 
+   obj->value += inc;
+
list_for_each_entry_safe(fence, next, &obj->active_list_head,
 active_list) {
if (fence_is_signaled_locked(fence))
@@ -109,7 +111,8 @@ void sync_timeline_signal(struct sync_timeline *obj)
 }
 EXPORT_SYMBOL(sync_timeline_signal);
 
-struct fence *sync_pt_create(struct sync_timeline *obj, int size)
+struct fence *sync_pt_create(struct sync_timeline *obj, int size,
+unsigned int value)
 {
unsigned long flags;
struct fence *fence;
@@ -124,7 +127,7 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int 
size)
spin_lock_irqsave(&obj->child_list_lock, flags);
sync_timeline_get(obj);
fence_init(fence, &android_fence_ops, &obj->child_list_lock,
-  obj->context, ++obj->value);
+  obj->context, value);
list_add_tail(&fence->child_list, &obj->child_list_head);
INIT_LIST_HEAD(&fence->active_list);
spin_unlock_irqrestore(&obj->child_list_lock, flags);
@@ -164,12 +167,8 @@ static void android_fence_release(struct fence *fence)
 static bool android_fence_signaled(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
-   int ret;
 
-   ret = parent->ops->has_signaled(fence);
-   if (ret < 0)
-   fence->status = ret;
-   return ret;
+   return (fence->seqno > parent->value) ? false : true;
 }
 
 static bool android_fence_enable_signaling(struct fence *fence)
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index fb209fc..4d3dfbf 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,10 +27,6 @@ struct sync_timeline;
 /**
  * struct sync_timeline_ops - sync object implementation ops
  * @driver_name:   name of the implementation
- * @has_signaled:  returns:
- *   1 if pt has signaled
- *   0 if pt has not signaled
- *  <0 on error
  * @fill_driver_da

[PATCH 01/11] dma-buf/sync_file: de-stage sync_file

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

sync_file is useful to connect one or more fences to the file. The file is
used by userspace to track fences.

Signed-off-by: Gustavo Padovan 
---
 drivers/Kconfig  |   2 +
 drivers/dma-buf/Kconfig  |  11 +
 drivers/dma-buf/Makefile |   1 +
 drivers/dma-buf/sync_file.c  | 440 +++
 drivers/staging/android/Kconfig  |   1 +
 drivers/staging/android/sync.c   | 419 -
 drivers/staging/android/sync.h   | 105 +
 drivers/staging/android/sync_debug.c |   1 +
 drivers/staging/android/trace/sync.h |  44 
 drivers/staging/android/uapi/sync.h  |  97 
 include/linux/sync_file.h| 123 ++
 include/trace/events/sync_file.h |  57 +
 include/uapi/linux/sync.h|  97 
 13 files changed, 735 insertions(+), 663 deletions(-)
 create mode 100644 drivers/dma-buf/Kconfig
 create mode 100644 drivers/dma-buf/sync_file.c
 delete mode 100644 drivers/staging/android/uapi/sync.h
 create mode 100644 include/linux/sync_file.h
 create mode 100644 include/trace/events/sync_file.h
 create mode 100644 include/uapi/linux/sync.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index d2ac339..430f761 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -114,6 +114,8 @@ source "drivers/rtc/Kconfig"
 
 source "drivers/dma/Kconfig"
 
+source "drivers/dma-buf/Kconfig"
+
 source "drivers/dca/Kconfig"
 
 source "drivers/auxdisplay/Kconfig"
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
new file mode 100644
index 000..9824bc4
--- /dev/null
+++ b/drivers/dma-buf/Kconfig
@@ -0,0 +1,11 @@
+menu "DMABUF options"
+
+config SYNC_FILE
+   bool "sync_file support for fences"
+   default n
+   select ANON_INODES
+   select DMA_SHARED_BUFFER
+   ---help---
+ This option enables the fence framework synchronization to export
+ sync_files to userspace that can represent one or more fences.
+endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 57a675f..4a424ec 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1 +1,2 @@
 obj-y := dma-buf.o fence.o reservation.o seqno-fence.o
+obj-$(CONFIG_SYNC_FILE)+= sync_file.o
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
new file mode 100644
index 000..92474dd
--- /dev/null
+++ b/drivers/dma-buf/sync_file.c
@@ -0,0 +1,440 @@
+/*
+ * drivers/dma-buf/sync_file.c
+ *
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CREATE_TRACE_POINTS
+#include 
+
+static const struct file_operations sync_file_fops;
+
+static struct sync_file *sync_file_alloc(int size, const char *name)
+{
+   struct sync_file *sync_file;
+
+   sync_file = kzalloc(size, GFP_KERNEL);
+   if (!sync_file)
+   return NULL;
+
+   sync_file->file = anon_inode_getfile("sync_file", &sync_file_fops,
+sync_file, 0);
+   if (IS_ERR(sync_file->file))
+   goto err;
+
+   kref_init(&sync_file->kref);
+   strlcpy(sync_file->name, name, sizeof(sync_file->name));
+
+   init_waitqueue_head(&sync_file->wq);
+
+   return sync_file;
+
+err:
+   kfree(sync_file);
+   return NULL;
+}
+
+static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
+{
+   struct sync_file_cb *check;
+   struct sync_file *sync_file;
+
+   check = container_of(cb, struct sync_file_cb, cb);
+   sync_file = check->sync_file;
+
+   if (atomic_dec_and_test(&sync_file->status))
+   wake_up_all(&sync_file->wq);
+}
+
+/* TODO: implement a create which takes more that one fence */
+struct sync_file *sync_file_create(const char *name, struct fence *fence)
+{
+   struct sync_file *sync_file;
+
+   sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1]),
+   name);
+   if (!sync_file)
+   return NULL;
+
+   sync_file->num_fences = 1;
+   atomic_set(&sync_file->status, 1);
+
+   sync_file->cbs[0].fence = fence;
+   sync_file->cbs[0].sync_file = sync_file;
+   if (fence_add_callback(fence, &sync_file->cbs[0].cb,
+  fence_check_cb_func))
+   atomic_dec(&sync_file->status);
+
+   return sync_file;
+}
+EXPO

[PATCH 08/11] staging/android: rename android_fence to timeline_fence

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

We are moving out of staging/adroid so rename it to a name that is not
related to android anymore.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sync.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 07fe995..ea816dd 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -28,7 +28,7 @@
 #define CREATE_TRACE_POINTS
 #include "trace/sync.h"
 
-static const struct fence_ops android_fence_ops;
+static const struct fence_ops timeline_fence_ops;
 
 struct sync_timeline *sync_timeline_create(int size, const char *drv_name,
   const char *name)
@@ -126,7 +126,7 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int 
size,
 
spin_lock_irqsave(&obj->child_list_lock, flags);
sync_timeline_get(obj);
-   fence_init(fence, &android_fence_ops, &obj->child_list_lock,
+   fence_init(fence, &timeline_fence_ops, &obj->child_list_lock,
   obj->context, value);
list_add_tail(&fence->child_list, &obj->child_list_head);
INIT_LIST_HEAD(&fence->active_list);
@@ -135,21 +135,21 @@ struct fence *sync_pt_create(struct sync_timeline *obj, 
int size,
 }
 EXPORT_SYMBOL(sync_pt_create);
 
-static const char *android_fence_get_driver_name(struct fence *fence)
+static const char *timeline_fence_get_driver_name(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
 
return parent->drv_name;
 }
 
-static const char *android_fence_get_timeline_name(struct fence *fence)
+static const char *timeline_fence_get_timeline_name(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
 
return parent->name;
 }
 
-static void android_fence_release(struct fence *fence)
+static void timeline_fence_release(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
unsigned long flags;
@@ -164,25 +164,25 @@ static void android_fence_release(struct fence *fence)
fence_free(fence);
 }
 
-static bool android_fence_signaled(struct fence *fence)
+static bool timeline_fence_signaled(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
 
return (fence->seqno > parent->value) ? false : true;
 }
 
-static bool android_fence_enable_signaling(struct fence *fence)
+static bool timeline_fence_enable_signaling(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
 
-   if (android_fence_signaled(fence))
+   if (timeline_fence_signaled(fence))
return false;
 
list_add_tail(&fence->active_list, &parent->active_list_head);
return true;
 }
 
-static int android_fence_fill_driver_data(struct fence *fence,
+static int timeline_fence_fill_driver_data(struct fence *fence,
  void *data, int size)
 {
if (size < sizeof(fence->seqno))
@@ -193,13 +193,13 @@ static int android_fence_fill_driver_data(struct fence 
*fence,
return sizeof(fence->seqno);
 }
 
-static void android_fence_value_str(struct fence *fence,
+static void timeline_fence_value_str(struct fence *fence,
char *str, int size)
 {
snprintf(str, size, "%d", fence->seqno);
 }
 
-static void android_fence_timeline_value_str(struct fence *fence,
+static void timeline_fence_timeline_value_str(struct fence *fence,
 char *str, int size)
 {
struct sync_timeline *parent = fence_parent(fence);
@@ -207,15 +207,15 @@ static void android_fence_timeline_value_str(struct fence 
*fence,
snprintf(str, size, "%d", parent->value);
 }
 
-static const struct fence_ops android_fence_ops = {
-   .get_driver_name = android_fence_get_driver_name,
-   .get_timeline_name = android_fence_get_timeline_name,
-   .enable_signaling = android_fence_enable_signaling,
-   .signaled = android_fence_signaled,
+static const struct fence_ops timeline_fence_ops = {
+   .get_driver_name = timeline_fence_get_driver_name,
+   .get_timeline_name = timeline_fence_get_timeline_name,
+   .enable_signaling = timeline_fence_enable_signaling,
+   .signaled = timeline_fence_signaled,
.wait = fence_default_wait,
-   .release = android_fence_release,
-   .fill_driver_data = android_fence_fill_driver_data,
-   .fence_value_str = android_fence_value_str,
-   .timeline_value_str = android_fence_timeline_value_str,
+   .release = timeline_fence_release,
+   .fill_driver_data = timeline_fence_fill_driver_data,
+   .fence_value_str = timeline_fence_value_str,
+   .timeline_value_str = timeline_fence_timeline_value_str,
 };
 
-- 
2.5.0

___
devel mailing list
de...@linuxdriverproject.org
ht

[PATCH 07/11] staging/android: remove sw_sync.[ch] files

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

We can glue the sw_sync file operations directly on the sync framework
without the need to pass through sw_sync wrappers.

It only builds sw_sync debugfs file support if CONFIG_SW_SYNC is enabled.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/Makefile |  1 -
 drivers/staging/android/sw_sync.c| 45 --
 drivers/staging/android/sw_sync.h| 47 
 drivers/staging/android/sync_debug.c | 17 ++---
 4 files changed, 13 insertions(+), 97 deletions(-)
 delete mode 100644 drivers/staging/android/sw_sync.c
 delete mode 100644 drivers/staging/android/sw_sync.h

diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index c7b6c99..2c1d97f 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -7,4 +7,3 @@ obj-$(CONFIG_ANDROID_TIMED_OUTPUT)  += timed_output.o
 obj-$(CONFIG_ANDROID_TIMED_GPIO)   += timed_gpio.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)+= lowmemorykiller.o
 obj-$(CONFIG_SYNC) += sync.o sync_debug.o
-obj-$(CONFIG_SW_SYNC)  += sw_sync.o
diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
deleted file mode 100644
index 461dbd9..000
--- a/drivers/staging/android/sw_sync.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * drivers/base/sw_sync.c
- *
- * Copyright (C) 2012 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "sw_sync.h"
-
-struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value)
-{
-   return sync_pt_create(obj, sizeof(struct fence), value);
-}
-EXPORT_SYMBOL(sw_sync_pt_create);
-
-struct sync_timeline *sw_sync_timeline_create(const char *name)
-{
-   return sync_timeline_create(sizeof(struct sync_timeline),
-   "sw_sync", name);
-}
-EXPORT_SYMBOL(sw_sync_timeline_create);
-
-void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
-{
-   sync_timeline_signal(obj, inc);
-}
-EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sw_sync.h 
b/drivers/staging/android/sw_sync.h
deleted file mode 100644
index 9f26c62..000
--- a/drivers/staging/android/sw_sync.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * include/linux/sw_sync.h
- *
- * Copyright (C) 2012 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _LINUX_SW_SYNC_H
-#define _LINUX_SW_SYNC_H
-
-#include 
-#include 
-#include "sync.h"
-#include "uapi/sw_sync.h"
-
-#if IS_ENABLED(CONFIG_SW_SYNC)
-struct sync_timeline *sw_sync_timeline_create(const char *name);
-void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc);
-
-struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value);
-#else
-static inline struct sync_timeline *sw_sync_timeline_create(const char *name)
-{
-   return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
-{
-}
-
-static inline struct fence *sw_sync_pt_create(struct sync_timeline *obj,
- u32 value)
-{
-   return NULL;
-}
-#endif /* IS_ENABLED(CONFIG_SW_SYNC) */
-
-#endif /* _LINUX_SW_SYNC_H */
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index e984955..9312e6f 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -28,7 +28,11 @@
 #include 
 #include 
 #include 
-#include "sw_sync.h"
+#include 
+#include 
+
+#include "uapi/sw_sync.h"
+#include "sync.h"
 
 #ifdef CONFIG_DEBUG_FS
 
@@ -202,6 +206,7 @@ static const struct file_operations sync_info_debugfs_fops 
= {
.release= single_release,
 };
 
+#if IS_ENABLED(CONFIG_SW_SYNC)
 /*
  * *WARNING*
  *
@@ -216,7 +221,7 @@ static int sw_sync_debugfs_open(struct inode *inode, struct 
file *file)
 
get_task_comm(task_comm, current);
 
-   obj = sw_sync_timeline_create(task_comm);
+   obj = sync_timeline_create(sizeof(*obj), "sw_sync", task_comm);
if (!obj)
 

[PATCH 11/11] dma-buf/sync_file: bring sync_dump() back

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

During the de-stage of sync framework it was easy to keep sync_dump() out
to avoid an early de-stage of all debug code, but now that sync_debug.c
was de-staged bring sync_dump() back.

Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/sync_file.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index aa1215d..fd7e3b9 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -218,15 +218,19 @@ int sync_file_wait(struct sync_file *sync_file, long 
timeout)
if (ret < 0) {
return ret;
} else if (ret == 0) {
-   if (timeout)
+   if (timeout) {
pr_info("sync_file timeout on [%p] after %dms\n",
sync_file, jiffies_to_msecs(timeout));
+   sync_dump();
+   }
return -ETIME;
}
 
ret = atomic_read(&sync_file->status);
-   if (ret)
+   if (ret) {
pr_info("sync_file error %ld on [%p]\n", ret, sync_file);
+   sync_dump();
+   }
 
return ret;
 }
-- 
2.5.0

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


[PATCH 09/11] dma-buf/sync_timeline: de-stage sync_timeline

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

De-stage the remaining bit of sync framework: sync_timeline and sw_sync
plus some debugging routines.

Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/Kconfig|  10 +
 drivers/dma-buf/Makefile   |   3 +-
 drivers/dma-buf/sw_sync.h  |  32 +++
 drivers/dma-buf/sync_debug.c   | 374 +
 drivers/dma-buf/sync_debug.h   |  35 +++
 drivers/dma-buf/sync_timeline.c| 222 +++
 drivers/staging/android/Kconfig|  20 --
 drivers/staging/android/sync.c | 221 ---
 drivers/staging/android/sync.h | 130 
 drivers/staging/android/sync_debug.c   | 373 
 drivers/staging/android/trace/sync.h   |  32 ---
 drivers/staging/android/uapi/sw_sync.h |  32 ---
 include/linux/sync_timeline.h  | 114 ++
 include/trace/events/sync_timeline.h   |  31 +++
 14 files changed, 820 insertions(+), 809 deletions(-)
 create mode 100644 drivers/dma-buf/sw_sync.h
 create mode 100644 drivers/dma-buf/sync_debug.c
 create mode 100644 drivers/dma-buf/sync_debug.h
 create mode 100644 drivers/dma-buf/sync_timeline.c
 delete mode 100644 drivers/staging/android/sync.c
 delete mode 100644 drivers/staging/android/sync.h
 delete mode 100644 drivers/staging/android/sync_debug.c
 delete mode 100644 drivers/staging/android/trace/sync.h
 delete mode 100644 drivers/staging/android/uapi/sw_sync.h
 create mode 100644 include/linux/sync_timeline.h
 create mode 100644 include/trace/events/sync_timeline.h

diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index 9824bc4..73df024 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -8,4 +8,14 @@ config SYNC_FILE
---help---
  This option enables the fence framework synchronization to export
  sync_files to userspace that can represent one or more fences.
+
+config SW_SYNC
+   bool "Software synchronization objects"
+   default n
+   depends on SYNC_FILE
+   ---help---
+ A sync object driver that uses a 32bit counter to coordinate
+ synchronization. Useful when there is no hardware primitive backing
+ the synchronization.
+
 endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 4a424ec..78d8ec4 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1,2 +1,3 @@
 obj-y := dma-buf.o fence.o reservation.o seqno-fence.o
-obj-$(CONFIG_SYNC_FILE)+= sync_file.o
+obj-$(CONFIG_SYNC_FILE)+= sync_file.o sync_debug.o
+obj-$(CONFIG_SW_SYNC)  += sync_timeline.o
diff --git a/drivers/dma-buf/sw_sync.h b/drivers/dma-buf/sw_sync.h
new file mode 100644
index 000..9b5d486
--- /dev/null
+++ b/drivers/dma-buf/sw_sync.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _UAPI_LINUX_SW_SYNC_H
+#define _UAPI_LINUX_SW_SYNC_H
+
+#include 
+
+struct sw_sync_create_fence_data {
+   __u32   value;
+   charname[32];
+   __s32   fence; /* fd of new fence */
+};
+
+#define SW_SYNC_IOC_MAGIC  'W'
+
+#define SW_SYNC_IOC_CREATE_FENCE   _IOWR(SW_SYNC_IOC_MAGIC, 0,\
+   struct sw_sync_create_fence_data)
+#define SW_SYNC_IOC_INC_IOW(SW_SYNC_IOC_MAGIC, 1, 
__u32)
+
+#endif /* _UAPI_LINUX_SW_SYNC_H */
diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
new file mode 100644
index 000..7da9ff5
--- /dev/null
+++ b/drivers/dma-buf/sync_debug.c
@@ -0,0 +1,374 @@
+/*
+ * drivers/base/sync.c
+ *
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sync_debug.h"
+#include "sw_sync.h"
+
+#ifdef CONFIG_DEBUG_FS
+
+static struct dentry *dbgfs;
+
+static LIST_HEAD(sync_timeline_list_head);
+static DEFINE_SPINLOCK(sync_timeline_list_lock);
+static LIST_HE

[PATCH 06/11] staging/android: remove sw_sync_timeline and sw_sync_pt

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

As we moved value storage to sync_timeline and fence those two structs
became useless and can be removed now.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c| 24 +++-
 drivers/staging/android/sw_sync.h| 24 ++--
 drivers/staging/android/sync_debug.c | 12 ++--
 3 files changed, 19 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index c5e92c6..461dbd9 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -25,31 +25,21 @@
 
 #include "sw_sync.h"
 
-struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
+struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value)
 {
-   struct sw_sync_pt *pt;
-
-   pt = (struct sw_sync_pt *)
-   sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt), value);
-
-   pt->value = value;
-
-   return (struct fence *)pt;
+   return sync_pt_create(obj, sizeof(struct fence), value);
 }
 EXPORT_SYMBOL(sw_sync_pt_create);
 
-struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
+struct sync_timeline *sw_sync_timeline_create(const char *name)
 {
-   struct sw_sync_timeline *obj = (struct sw_sync_timeline *)
-   sync_timeline_create(sizeof(struct sw_sync_timeline),
-"sw_sync", name);
-
-   return obj;
+   return sync_timeline_create(sizeof(struct sync_timeline),
+   "sw_sync", name);
 }
 EXPORT_SYMBOL(sw_sync_timeline_create);
 
-void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
+void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
 {
-   sync_timeline_signal(&obj->obj, inc);
+   sync_timeline_signal(obj, inc);
 }
 EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sw_sync.h 
b/drivers/staging/android/sw_sync.h
index e18667b..9f26c62 100644
--- a/drivers/staging/android/sw_sync.h
+++ b/drivers/staging/android/sw_sync.h
@@ -22,34 +22,22 @@
 #include "sync.h"
 #include "uapi/sw_sync.h"
 
-struct sw_sync_timeline {
-   struct  sync_timeline   obj;
-
-   u32 value;
-};
-
-struct sw_sync_pt {
-   struct fencept;
-
-   u32 value;
-};
-
 #if IS_ENABLED(CONFIG_SW_SYNC)
-struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
-void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
+struct sync_timeline *sw_sync_timeline_create(const char *name);
+void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc);
 
-struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
+struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value);
 #else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char 
*name)
+static inline struct sync_timeline *sw_sync_timeline_create(const char *name)
 {
return NULL;
 }
 
-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
+static inline void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
 {
 }
 
-static inline struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj,
+static inline struct fence *sw_sync_pt_create(struct sync_timeline *obj,
  u32 value)
 {
return NULL;
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index 26ba9e86..e984955 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -211,7 +211,7 @@ static const struct file_operations sync_info_debugfs_fops 
= {
 /* opening sw_sync create a new sync obj */
 static int sw_sync_debugfs_open(struct inode *inode, struct file *file)
 {
-   struct sw_sync_timeline *obj;
+   struct sync_timeline *obj;
char task_comm[TASK_COMM_LEN];
 
get_task_comm(task_comm, current);
@@ -227,13 +227,13 @@ static int sw_sync_debugfs_open(struct inode *inode, 
struct file *file)
 
 static int sw_sync_debugfs_release(struct inode *inode, struct file *file)
 {
-   struct sw_sync_timeline *obj = file->private_data;
+   struct sync_timeline *obj = file->private_data;
 
-   sync_timeline_destroy(&obj->obj);
+   sync_timeline_destroy(obj);
return 0;
 }
 
-static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
+static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
   unsigned long arg)
 {
int fd = get_unused_fd_flags(O_CLOEXEC);
@@ -280,7 +280,7 @@ err:
return err;
 }
 
-static long sw_sync_ioctl_inc(struct sw_sync_timeline *obj, unsigned long arg)
+static long sw_sync_ioctl_inc(struct sync_timeline *obj, unsigned long arg)
 {
u32 value;
 
@@ -295,7 +295,7 @@ static long sw_sync_ioctl_inc(struct sw_sync_timeline *obj, 
unsigned long arg)
 static long sw_sync_ioctl(struct file *file

[PATCH 10/11] dma-buf/sync_file: bring debug back to sync file

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Enable reports of sync_files through /sync/info

Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/sync_file.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 92474dd..aa1215d 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -29,6 +29,8 @@
 #define CREATE_TRACE_POINTS
 #include 
 
+#include "sync_debug.h"
+
 static const struct file_operations sync_file_fops;
 
 static struct sync_file *sync_file_alloc(int size, const char *name)
@@ -87,6 +89,8 @@ struct sync_file *sync_file_create(const char *name, struct 
fence *fence)
   fence_check_cb_func))
atomic_dec(&sync_file->status);
 
+   sync_file_debug_add(sync_file);
+
return sync_file;
 }
 EXPORT_SYMBOL(sync_file_create);
@@ -188,6 +192,7 @@ struct sync_file *sync_file_merge(const char *name,
atomic_sub(num_fences - i, &sync_file->status);
sync_file->num_fences = i;
 
+   sync_file_debug_add(sync_file);
return sync_file;
 }
 EXPORT_SYMBOL(sync_file_merge);
@@ -246,6 +251,8 @@ static int sync_file_release(struct inode *inode, struct 
file *file)
 {
struct sync_file *sync_file = file->private_data;
 
+   sync_file_debug_remove(sync_file);
+
kref_put(&sync_file->kref, sync_file_free);
return 0;
 }
-- 
2.5.0

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


[PATCH 05/11] staging/android: remove struct sync_timeline_ops

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Move drv_name, the last field of sync_timeline_ops, to sync_timeline
and remove sync_timeline_ops.

struct sync_timeline_ops was just an extra abstraction on top of
fence_ops, and in the last few commits we removed all it ops in favor
of cleaner fence_ops.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c|  9 ++---
 drivers/staging/android/sync.c   |  8 
 drivers/staging/android/sync.h   | 28 +---
 drivers/staging/android/sync_debug.c |  3 +--
 4 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index 4200b12..c5e92c6 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,16 +38,11 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);
 
-static struct sync_timeline_ops sw_sync_timeline_ops = {
-   .driver_name = "sw_sync",
-};
-
 struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
 {
struct sw_sync_timeline *obj = (struct sw_sync_timeline *)
-   sync_timeline_create(&sw_sync_timeline_ops,
-sizeof(struct sw_sync_timeline),
-name);
+   sync_timeline_create(sizeof(struct sw_sync_timeline),
+"sw_sync", name);
 
return obj;
 }
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index f2d298c..07fe995 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -30,8 +30,8 @@
 
 static const struct fence_ops android_fence_ops;
 
-struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
-  int size, const char *name)
+struct sync_timeline *sync_timeline_create(int size, const char *drv_name,
+  const char *name)
 {
struct sync_timeline *obj;
 
@@ -43,9 +43,9 @@ struct sync_timeline *sync_timeline_create(const struct 
sync_timeline_ops *ops,
return NULL;
 
kref_init(&obj->kref);
-   obj->ops = ops;
obj->context = fence_context_alloc(1);
strlcpy(obj->name, name, sizeof(obj->name));
+   strlcpy(obj->drv_name, drv_name, sizeof(obj->drv_name));
 
INIT_LIST_HEAD(&obj->child_list_head);
INIT_LIST_HEAD(&obj->active_list_head);
@@ -139,7 +139,7 @@ static const char *android_fence_get_driver_name(struct 
fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
 
-   return parent->ops->driver_name;
+   return parent->drv_name;
 }
 
 static const char *android_fence_get_timeline_name(struct fence *fence)
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index b1a4b06..be94a80 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -22,20 +22,10 @@
 #include 
 #include 
 
-struct sync_timeline;
-
-/**
- * struct sync_timeline_ops - sync object implementation ops
- * @driver_name:   name of the implementation
- */
-struct sync_timeline_ops {
-   const char *driver_name;
-};
-
 /**
  * struct sync_timeline - sync object
  * @kref:  reference count on fence.
- * @ops:   ops that define the implementation of the sync_timeline
+ * @drv_name:  drv_name of the driver using the sync_timeline
  * @name:  name of the sync_timeline. Useful for debugging
  * @destroyed: set when sync_timeline is destroyed
  * @child_list_head:   list of children sync_pts for this sync_timeline
@@ -46,7 +36,7 @@ struct sync_timeline_ops {
  */
 struct sync_timeline {
struct kref kref;
-   const struct sync_timeline_ops  *ops;
+   chardrv_name[32];
charname[32];
 
/* protected by child_list_lock */
@@ -75,17 +65,17 @@ static inline struct sync_timeline *fence_parent(struct 
fence *fence)
 
 /**
  * sync_timeline_create() - creates a sync object
- * @ops:   specifies the implementation ops for the object
  * @size:  size to allocate for this obj
+ * @drv_name:  sync_timeline driver name
  * @name:  sync_timeline name
  *
- * Creates a new sync_timeline which will use the implementation specified by
- * @ops.  @size bytes will be allocated allowing for implementation specific
- * data to be kept after the generic sync_timeline struct. Returns the
- * sync_timeline object or NULL in case of error.
+ * Creates a new sync_timeline. @size bytes will be allocated allowing
+ * for implementation specific data to be kept after the generic
+ * sync_timeline struct. Returns the sync_timeline object or NULL in
+ * case of error.
  */
-struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
-  int size, const char *

Re: [PATCH] added fbtft ssd1305 controller support

2016-01-26 Thread Dan Carpenter
Here is what I get when I cat this patch to checkpatch.

$ cat email.txt | ~/kernel_src/scripts/checkpatch.pl -

WARNING: please write a paragraph that describes the config symbol fully
#24: FILE: drivers/staging/fbtft/Kconfig:120:
+config FB_TFT_SSD1305

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#46: 
new file mode 100644

CHECK: No space is necessary after a cast
#269: FILE: drivers/staging/fbtft/fb_ssd1305.c:219:
+   u16 *vmem16 = (u16 *) par->info->screen_buffer;

total: 0 errors, 2 warnings, 1 checks, 290 lines checked

regards,
dan carpenter

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


Re: [PATCH 00/23] mtd: rework ECC layout definition

2016-01-26 Thread Brian Norris
Hi Boris,

On Mon, Dec 07, 2015 at 11:25:55PM +0100, Boris Brezillon wrote:
> Hello,
> 
> This patchset aims at getting rid of the nand_ecclayout limitations.
> struct nand_ecclayout is defining fixed eccpos and oobfree arrays which
> can only be increased by modifying the MTD_MAX_ECCPOS_ENTRIES_LARGE and
> MTD_MAX_OOBFREE_ENTRIES_LARGE macros.
> This approach forces us to modify the macro values each time we add a
> new NAND chip with a bigger OOB area, and increasing these arrays also
> penalize all platforms, even those who only support small NAND devices
> (with small OOB area).
> 
> The idea to overcome this limitation, is to define the ECC/OOB layout
> by the mean of two functions: ->eccpos() and ->oobfree(), which will
> basically return the same information has those stored in the
> nand_ecclayout struct.
> 
> Another advantage of this solution is that ECC layouts are usually
> following a repetitive pattern (i.e. leave X bytes free and put Y bytes
> of ECC per ECC chunk), which allows one to implement the ->eccpos()
> and ->oobfree() functions with a simple logic that can be applied
> to any size of OOB.

Thanks for the work! This definitely needed done. I imagined that it
might be best if we just changed the data structure format and have
drivers allocate it dynamically during probe(), but actually, I kinda
like generating it on the fly. The only concern I'd have is if there is
significant penalty to doing this sort of computation on the fly during
(e.g.) AUTO-layout OOB reads/writes. But I guess if there is such a
penalty, nothing would stop us from caching the results in the MTD/NAND
core code.

> Patches 1 to 10 are just cleanups or trivial fixes that can be taken
> independently.

There were some comments for patch 1, and I want to look more closely at
patch 10. But patches 2 to 9 are pushed to l2-mtd.git. Thanks!

> Patch 19 is just an aggregate of several smaller commits (one per
> driver), and has been submitted this way to limit the size of the
> series. If everybody agrees on this approach, I'll resubmit the series
> will those changes separated in different commits (as done here [1]).
> 
> Also note that the last two commits are removing the nand_ecclayout
> definition, thus preventing any new driver to use this structure.
> Of course, this step can be delayed if some of the previous patches
> are not accepted.

I haven't looked in detail at the second half of the series, but I like
the concept. I'll look closer once you fix up things in v2.

Thanks,
Brian

> Best Regards,
> 
> Boris
> 
> [1]https://github.com/bbrezillon/linux-sunxi/commits/nand/ecclayout2
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: unisys: visornic: remove useless memset

2016-01-26 Thread Ben Romer
On Mon, 2016-01-25 at 20:22 +, Hugo Camboulive wrote:
> alloc_etherdev() calls alloc_netdev_mqs(), which
> already uses kzalloc/vzalloc.
> 
> This clears a sparse warning :
> drivers/staging/unisys/visornic/visornic_main.c:1366:15: warning:
> memset with byte count of 1460112
> 
> Signed-off-by: Hugo Camboulive 

Tested, works fine. :)

Signed-off-by: Benjamin Romer 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 09/11] dma-buf/sync_timeline: de-stage sync_timeline

2016-01-26 Thread Gustavo Padovan
2016-01-26 Gustavo Padovan :

> From: Gustavo Padovan 
> 
> De-stage the remaining bit of sync framework: sync_timeline and sw_sync
> plus some debugging routines.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/dma-buf/Kconfig|  10 +
>  drivers/dma-buf/Makefile   |   3 +-
>  drivers/dma-buf/sw_sync.h  |  32 +++
>  drivers/dma-buf/sync_debug.c   | 374 
> +
>  drivers/dma-buf/sync_debug.h   |  35 +++
>  drivers/dma-buf/sync_timeline.c| 222 +++
>  drivers/staging/android/Kconfig|  20 --
>  drivers/staging/android/sync.c | 221 ---
>  drivers/staging/android/sync.h | 130 
>  drivers/staging/android/sync_debug.c   | 373 
>  drivers/staging/android/trace/sync.h   |  32 ---
>  drivers/staging/android/uapi/sw_sync.h |  32 ---
>  include/linux/sync_timeline.h  | 114 ++
>  include/trace/events/sync_timeline.h   |  31 +++
>  14 files changed, 820 insertions(+), 809 deletions(-)
>  create mode 100644 drivers/dma-buf/sw_sync.h
>  create mode 100644 drivers/dma-buf/sync_debug.c
>  create mode 100644 drivers/dma-buf/sync_debug.h
>  create mode 100644 drivers/dma-buf/sync_timeline.c
>  delete mode 100644 drivers/staging/android/sync.c
>  delete mode 100644 drivers/staging/android/sync.h
>  delete mode 100644 drivers/staging/android/sync_debug.c
>  delete mode 100644 drivers/staging/android/trace/sync.h
>  delete mode 100644 drivers/staging/android/uapi/sw_sync.h
>  create mode 100644 include/linux/sync_timeline.h
>  create mode 100644 include/trace/events/sync_timeline.h

Seems I forgot git format-patch -M. I'll resend the series.

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


Re: [PATCH v2] add fbtft ssd1325 controller support

2016-01-26 Thread Greg KH
On Tue, Jan 26, 2016 at 07:31:16PM +0300, Alexey Mednyy wrote:
> Signed-off-by: Alexey Mednyy 

Why?

I can't take patches without any changelog entries, sorry, we need some
more information here about what this is, why it's being submitted, etc.

thanks,

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


Re: [PATCH v2] added fbtft ssd1305 controller support

2016-01-26 Thread Greg KH
On Tue, Jan 26, 2016 at 07:31:01PM +0300, Alexey Mednyy wrote:
> Signed-off-by: Alexey Mednyy 
> ---
>  drivers/staging/fbtft/Kconfig  |   6 ++
>  drivers/staging/fbtft/Makefile |   1 +
>  drivers/staging/fbtft/fb_ssd1305.c | 216 
> +
>  3 files changed, 223 insertions(+)

Same here, please resend with a proper changelog.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: android: Fix brace coding style warning in sync_debug.c

2016-01-26 Thread Bopamo Osaisai
This is a patch to the sync_debug.c file that rectifies a brace warning
that was found with the checkpatch.pl tool

Signed-off-by: Bopamo Osaisai 
---
 drivers/staging/android/sync_debug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index f45d13c..02a1649 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -158,9 +158,8 @@ static void sync_print_fence(struct seq_file *s, struct 
sync_fence *fence)
seq_printf(s, "[%p] %s: %s\n", fence, fence->name,
   sync_status_str(atomic_read(&fence->status)));
 
-   for (i = 0; i < fence->num_fences; ++i) {
+   for (i = 0; i < fence->num_fences; ++i)
sync_print_pt(s, fence->cbs[i].sync_pt, true);
-   }
 
spin_lock_irqsave(&fence->wq.lock, flags);
list_for_each_entry(pos, &fence->wq.task_list, task_list) {
-- 
2.7.0

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


[PATCH 02/13] staging: wilc1000: fixes no space is necessary after a cast

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch fixes the check reported by checkpatch.pl
for 'no space is necessary after a cast'.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index db91a21..9552469 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1287,7 +1287,7 @@ static int mac_ioctl(struct net_device *ndev, struct 
ifreq *req, int cmd)
switch (cmd) {
case SIOCSIWPRIV:
{
-   struct iwreq *wrq = (struct iwreq *) req;
+   struct iwreq *wrq = (struct iwreq *)req;
 
size = wrq->u.data.length;
 
-- 
1.9.1

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


[PATCH 01/13] staging: wilc1000: wilc_frmw_to_linux(): fixes null check

2016-01-26 Thread Glen Lee
From: Leo Kim 

Null checking wilc_netdev and skb->dev are already done in the begining of the
function and they are just print printing error log, so delete them.
Null checking wilc is needed before is used so add null ckeck before it is
used.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index ee779ee..db91a21 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1342,6 +1342,9 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 
size, u32 pkt_offset)
struct net_device *wilc_netdev;
struct wilc_vif *vif;
 
+   if (!wilc)
+   return;
+
wilc_netdev = get_if_handler(wilc, buff);
if (!wilc_netdev)
return;
@@ -1358,14 +1361,8 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 
size, u32 pkt_offset)
PRINT_ER("Low memory - packet droped\n");
return;
}
-
-   if (!wilc || !wilc_netdev)
-   PRINT_ER("wilc_netdev in wilc is NULL");
skb->dev = wilc_netdev;
 
-   if (!skb->dev)
-   PRINT_ER("skb->dev is NULL\n");
-
memcpy(skb_put(skb, frame_len), buff_to_send, frame_len);
 
skb->protocol = eth_type_trans(skb, wilc_netdev);
-- 
1.9.1

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


[PATCH 05/13] staging: wilc1000: rename Firmware_ver variable

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch renames Firmware_ver variable to firmware_ver to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 06c79dd..fd405b0 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -929,13 +929,14 @@ int wilc1000_wlan_init(struct net_device *dev, struct 
wilc_vif *vif)
 
if (wilc_wlan_cfg_get(vif, 1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
-   char Firmware_ver[20];
-
-   size = wilc_wlan_cfg_get_val(
-   WID_FIRMWARE_VERSION,
-   Firmware_ver, sizeof(Firmware_ver));
-   Firmware_ver[size] = '\0';
-   PRINT_D(INIT_DBG, "* Firmware Ver = %s  ***\n", 
Firmware_ver);
+   char firmware_ver[20];
+
+   size = wilc_wlan_cfg_get_val(WID_FIRMWARE_VERSION,
+firmware_ver,
+sizeof(firmware_ver));
+   firmware_ver[size] = '\0';
+   PRINT_D(INIT_DBG, " Firmware Ver = %s \n",
+   firmware_ver);
}
ret = linux_wlan_init_test_config(dev, vif);
 
-- 
1.9.1

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


[PATCH 06/13] staging: wilc1000: fixes missing a blank line after declarations

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch fixes the warnings reported by checkpatch.pl
for Missing a blank line after declarations.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index fd405b0..402f8ce 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -853,6 +853,7 @@ static void wlan_deinitialize_threads(struct net_device 
*dev)
 {
struct wilc_vif *vif;
struct wilc *wl;
+
vif = netdev_priv(dev);
wl = vif->wilc;
 
@@ -1473,6 +1474,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
 
{
struct wireless_dev *wdev;
+
wdev = wilc_create_wiphy(ndev, dev);
 
if (dev)
-- 
1.9.1

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


[PATCH 11/13] staging: wilc1000: removes void function return

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch removes the warning reported by checkpatch.pl
for void function return statements are not generally useful.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index c16cc40..5c87105 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1047,8 +1047,6 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
}
 
wilc_setup_multicast_filter(vif, true, (dev->mc.count));
-
-   return;
 }
 
 static void linux_wlan_tx_complete(void *priv, int status)
-- 
1.9.1

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


[PATCH 07/13] staging: wilc1000: rename pBssid of tx_complete_data structure

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch renames pBssid variable of tx_complete_data structure to bssid
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c   | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c| 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.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 402f8ce..4b544df 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1194,7 +1194,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device 
*ndev)
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
-   tx_data->pBssid = wilc->vif[vif->u8IfIdx]->bssid;
+   tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index d7238e7..703dbe0 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -809,7 +809,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
if (tqe->type == WILC_CFG_PKT) {
buffer_offset = 
ETH_CONFIG_PKT_HDR_OFFSET;
} else if (tqe->type == WILC_NET_PKT) {
-   char *bssid = ((struct tx_complete_data 
*)(tqe->priv))->pBssid;
+   char *bssid = ((struct tx_complete_data 
*)(tqe->priv))->bssid;
 
buffer_offset = ETH_ETHERNET_HDR_OFFSET;
memcpy(&txb[offset + 4], bssid, 6);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 455a98f..294552d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -82,7 +82,7 @@ typedef struct {
 struct tx_complete_data {
int size;
void *buff;
-   u8 *pBssid;
+   u8 *bssid;
struct sk_buff *skb;
 };
 
-- 
1.9.1

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


[PATCH 04/13] staging: wilc1000: rename hWILCWFIDrv of wilc_priv structure

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch renames hWILCWFIDrv pointer variable of wilc_priv structure
to hif_drv to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c |  8 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 22 --
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index a3b4939..06c79dd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -89,7 +89,7 @@ static int dev_state_ev_handler(struct notifier_block *this, 
unsigned long event
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
return NOTIFY_DONE;
}
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
if (!vif || !hif_drv) {
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
@@ -515,7 +515,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
 
PRINT_D(TX_DBG, "Start configuring Firmware\n");
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
PRINT_D(INIT_DBG, "Host = %p\n", hif_drv);
wilc_get_mac_address(vif, mac_add);
 
@@ -1089,7 +1089,7 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
 
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
vif = netdev_priv(dev);
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
 
if (!dev)
return;
@@ -1228,7 +1228,7 @@ int wilc_mac_close(struct net_device *ndev)
return 0;
}
 
-   hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   hif_drv = (struct host_if_drv *)priv->hif_drv;
 
PRINT_D(GENERIC_DBG, "Mac close\n");
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6e7f5d6..6626347 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -512,7 +512,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
dev = priv->dev;
vif = netdev_priv(dev);
wl = vif->wilc;
-   pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
 
if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
u16 u16ConnectStatus;
@@ -711,9 +711,11 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
wilc_connecting = 1;
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
-   pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
 
-   PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if 
[%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
+   PRINT_D(CFG80211_DBG,
+   "Connecting to SSID [%s] on netdev [%p] host if [%p]\n",
+   sme->ssid, dev, priv->hif_drv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS 
disabled\n");
pstrWFIDrv->p2p_connect = 1;
@@ -928,7 +930,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
-   pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
if (!pstrWFIDrv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
@@ -1276,7 +1278,7 @@ static int del_key(struct wiphy *wiphy, struct net_device 
*netdev,
wilc_remove_wep_key(vif, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
-   wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
+   wilc_remove_key(priv->hif_drv, mac_addr);
}
 
return 0;
@@ -1632,7 +1634,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
s32 s32Freq;
 
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
 
memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);
 
@@ -1844,7 +1846,7 @@ static int mgmt_tx(struct wiphy *wiphy,
 
vif = netdev_priv(wdev->netdev);
priv = wiphy_priv(wiphy);
-   pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
+   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
 
*cookie = (unsigned long)buf;
 

[PATCH 03/13] staging: wilc1000: fixes add spaces required around

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch fixes the checks reported by checkpatch.pl
for spaces required around that '=' or '||' or '('.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 9552469..a3b4939 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -993,7 +993,7 @@ int wilc_mac_open(struct net_device *ndev)
vif = netdev_priv(ndev);
wl = vif->wilc;
 
-   if (!wl|| !wl->dev) {
+   if (!wl || !wl->dev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
@@ -1074,7 +1074,7 @@ int wilc_mac_open(struct net_device *ndev)
 
 static struct net_device_stats *mac_stats(struct net_device *dev)
 {
-   struct wilc_vif *vif= netdev_priv(dev);
+   struct wilc_vif *vif = netdev_priv(dev);
 
return &vif->netstats;
 }
-- 
1.9.1

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


[PATCH 09/13] staging: wilc1000: removes unnecessary debug logs

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch removes unnecessary debug logs.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 154 ++
 1 file changed, 24 insertions(+), 130 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index f03daff..e8b4533 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -70,47 +70,32 @@ static int dev_state_ev_handler(struct notifier_block *this,
u8 null_ip[4] = {0};
char wlan_dev_name[5] = "wlan0";
 
-   if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) {
-   PRINT_D(GENERIC_DBG, "dev_iface = NULL\n");
+   if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
return NOTIFY_DONE;
-   }
 
if (memcmp(dev_iface->ifa_label, "wlan0", 5) &&
-   memcmp(dev_iface->ifa_label, "p2p0", 4)) {
-   PRINT_D(GENERIC_DBG, "Interface is neither WLAN0 nor P2P0\n");
+   memcmp(dev_iface->ifa_label, "p2p0", 4))
return NOTIFY_DONE;
-   }
 
dev  = (struct net_device *)dev_iface->ifa_dev->dev;
-   if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) {
-   PRINT_D(GENERIC_DBG, "No Wireless registerd\n");
+   if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
return NOTIFY_DONE;
-   }
+
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   if (!priv) {
-   PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+   if (!priv)
return NOTIFY_DONE;
-   }
+
hif_drv = (struct host_if_drv *)priv->hif_drv;
vif = netdev_priv(dev);
-   if (!vif || !hif_drv) {
-   PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
+   if (!vif || !hif_drv)
return NOTIFY_DONE;
-   }
-
-   PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler +++\n");
 
switch (event) {
case NETDEV_UP:
-   PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_UP 
%p\n", dev);
-
-   PRINT_INFO(GENERIC_DBG, "\n == IP Address Obtained 
===\n\n");
-
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 1;
wilc_optaining_ip = false;
del_timer(&wilc_during_ip_timer);
-   PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n");
}
 
if (wilc_enable_ps)
@@ -127,9 +112,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;
 
case NETDEV_DOWN:
-   PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN 
%p\n", dev);
-
-   PRINT_INFO(GENERIC_DBG, "\n == IP Address Released 
===\n\n");
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 0;
wilc_optaining_ip = false;
@@ -152,9 +134,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
break;
 
default:
-   PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler event=default\n");
-   PRINT_INFO(GENERIC_DBG, "[%s] unknown dev event: %lu\n", 
dev_iface->ifa_label, event);
-
break;
}
 
@@ -169,7 +148,6 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
vif = netdev_priv(dev);
wilc = vif->wilc;
-   PRINT_D(INT_DBG, "Interrupt received UH\n");
 
if (wilc->close) {
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
@@ -191,7 +169,6 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
return IRQ_HANDLED;
}
 
-   PRINT_D(INT_DBG, "Interrupt received BH\n");
wilc_handle_isr(wilc);
 
return IRQ_HANDLED;
@@ -255,12 +232,9 @@ int wilc_lock_timeout(struct wilc *nic, void *vp, u32 
timeout)
/* FIXME: replace with mutex_lock or wait_for_completion */
int error = -1;
 
-   PRINT_D(LOCK_DBG, "Locking %p\n", vp);
if (vp)
error = down_timeout((struct semaphore *)vp,
 msecs_to_jiffies(timeout));
-   else
-   PRINT_ER("Failed, mutex is NULL\n");
return error;
 }
 
@@ -358,28 +332,21 @@ static int linux_wlan_txq_task(void *vp)
 
up(&wl->txq_thread_started);
while (1) {
-   PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
down(&wl->txq_event);
-   PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");
 
if (wl->close) {
up(&wl->txq_thread_started);
 
while (!kthread_should_stop())
schedule();
-
-   PRINT_D(TX_DBG, "TX thread stopped\n");
  

[PATCH 08/13] staging: wilc1000: remove warnings line over 80 characters

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch removes the warnings reported by checkpatch.pl
for line over 80 characters.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 4b544df..f03daff 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -25,7 +25,8 @@
 
 #include 
 
-static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
+static int dev_state_ev_handler(struct notifier_block *this,
+   unsigned long event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
.notifier_call = dev_state_ev_handler
@@ -57,7 +58,8 @@ static const struct net_device_ops wilc_netdev_ops = {
 
 };
 
-static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr)
+static int dev_state_ev_handler(struct notifier_block *this,
+   unsigned long event, void *ptr)
 {
struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr;
struct wilc_priv *priv;
-- 
1.9.1

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


[PATCH 10/13] staging: wilc1000: replaces PRINT_XXX with netdev_xxx

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patches replaces PRINT_XXX with netdev_xxx.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 100 +-
 1 file changed, 49 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index e8b4533..c16cc40 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -101,12 +101,12 @@ static int dev_state_ev_handler(struct notifier_block 
*this,
if (wilc_enable_ps)
wilc_set_power_mgmt(vif, 1, 0);
 
-   PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);
+   netdev_dbg(dev, "[%s] Up IP\n", dev_iface->ifa_label);
 
ip_addr_buf = (char *)&dev_iface->ifa_address;
-   PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
-   ip_addr_buf[0], ip_addr_buf[1],
-   ip_addr_buf[2], ip_addr_buf[3]);
+   netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
+  ip_addr_buf[0], ip_addr_buf[1],
+  ip_addr_buf[2], ip_addr_buf[3]);
wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
 
break;
@@ -122,12 +122,12 @@ static int dev_state_ev_handler(struct notifier_block 
*this,
 
wilc_resolve_disconnect_aberration(vif);
 
-   PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label);
+   netdev_dbg(dev, "[%s] Down IP\n", dev_iface->ifa_label);
 
ip_addr_buf = null_ip;
-   PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
-   ip_addr_buf[0], ip_addr_buf[1],
-   ip_addr_buf[2], ip_addr_buf[3]);
+   netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
+  ip_addr_buf[0], ip_addr_buf[1],
+  ip_addr_buf[2], ip_addr_buf[3]);
 
wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
 
@@ -150,7 +150,7 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
wilc = vif->wilc;
 
if (wilc->close) {
-   PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
+   netdev_err(dev, "Can't handle UH interrupt\n");
return IRQ_HANDLED;
}
return IRQ_WAKE_THREAD;
@@ -160,12 +160,13 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
struct wilc_vif *vif;
struct wilc *wilc;
+   struct net_device *dev = (struct net_device *)userdata;
 
vif = netdev_priv(userdata);
wilc = vif->wilc;
 
if (wilc->close) {
-   PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
+   netdev_err(dev, "Can't handle BH interrupt\n");
return IRQ_HANDLED;
}
 
@@ -188,7 +189,7 @@ static int init_irq(struct net_device *dev)
wl->dev_irq_num = gpio_to_irq(wl->gpio);
} else {
ret = -1;
-   PRINT_ER("could not obtain gpio for WILC_INTR\n");
+   netdev_err(dev, "could not obtain gpio for WILC_INTR\n");
}
 
if (ret != -1 && request_threaded_irq(wl->dev_irq_num,
@@ -196,12 +197,13 @@ static int init_irq(struct net_device *dev)
  isr_bh_routine,
  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
  "WILC_IRQ", dev) < 0) {
-   PRINT_ER("Failed to request IRQ for GPIO: %d\n", wl->gpio);
+   netdev_err(dev, "Failed to request IRQ GPIO: %d\n", wl->gpio);
gpio_free(wl->gpio);
ret = -1;
} else {
-   PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: 
%d\n",
-   wl->dev_irq_num, wl->gpio);
+   netdev_dbg(dev,
+  "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
+  wl->dev_irq_num, wl->gpio);
}
 
return ret;
@@ -402,7 +404,7 @@ int wilc_wlan_get_firmware(struct net_device *dev)
goto _fail_;
 
if (request_firmware(&wilc_firmware, firmware, wilc->dev) != 0) {
-   PRINT_ER("%s - firmare not available\n", firmware);
+   netdev_err(dev, "%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
@@ -443,7 +445,7 @@ static int wilc1000_firmware_download(struct net_device 
*dev)
wilc = vif->wilc;
 
if (!wilc->firmware) {
-   PRINT_ER("Firmware buffer is NULL\n");
+   netdev_err(dev, "Firmware buffer is NULL\n");
return -ENOBUFS;
}
 
@@ -455,7 +457,7 @@ static int wilc1000_firmware_download(struct net_device 
*dev)
release_firmware(wilc->firmware);
wilc->firmware = NULL;
 
-   PRINT_D(INIT_DBG, "Down

[PATCH 12/13] staging: wilc1000: renames u8IfIdx of wilc_vif structure

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch renames u8IfIdx variable of wilc_vif structure to idx
to avoid camelcase.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/linux_wlan.c | 8 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a425b09..ad54db2 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -280,7 +280,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo);
  */
 int wilc_get_vif_idx(struct wilc_vif *vif)
 {
-   return vif->u8IfIdx + 1;
+   return vif->idx + 1;
 }
 
 /* We need to minus 1 from idx which is from wilc device to get real index
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5c87105..9ca33536 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -107,7 +107,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
   ip_addr_buf[0], ip_addr_buf[1],
   ip_addr_buf[2], ip_addr_buf[3]);
-   wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
+   wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx);
 
break;
 
@@ -129,7 +129,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
   ip_addr_buf[0], ip_addr_buf[1],
   ip_addr_buf[2], ip_addr_buf[3]);
 
-   wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx);
+   wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx);
 
break;
 
@@ -1104,7 +1104,7 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device 
*ndev)
 
vif->netstats.tx_packets++;
vif->netstats.tx_bytes += tx_data->size;
-   tx_data->bssid = wilc->vif[vif->u8IfIdx]->bssid;
+   tx_data->bssid = wilc->vif[vif->idx]->bssid;
queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
tx_data->buff, tx_data->size,
linux_wlan_tx_complete);
@@ -1360,7 +1360,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device 
*dev, int io_type,
else
strcpy(ndev->name, "p2p%d");
 
-   vif->u8IfIdx = wl->vif_num;
+   vif->idx = wl->vif_num;
vif->wilc = *wilc;
wl->vif[i] = vif;
wl->vif[wl->vif_num]->ndev = ndev;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6626347..ccfd26a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2197,7 +2197,7 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
 
-   wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
+   wilc_wlan_set_bssid(dev, wl->vif[vif->idx]->src_addr, AP_MODE);
wilc_set_power_mgmt(vif, 0, 0);
 
s32Error = wilc_add_beacon(vif, settings->beacon_interval,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 64fcb77..07a4ff1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -148,7 +148,7 @@ typedef struct {
 } struct_frame_reg;
 
 struct wilc_vif {
-   u8 u8IfIdx;
+   u8 idx;
u8 iftype;
int monitor_flag;
int mac_opened;
-- 
1.9.1

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


[PATCH 13/13] staging: wilc1000: fixes variable dereferenced before check

2016-01-26 Thread Glen Lee
From: Leo Kim 

This patch fixes the warning reported by smatch.
 - wilc_wlan_get_firmware() warn: variable dereferenced before check 'vif'
 - wilc_set_multicast_list() warn: variable dereferenced before check 'dev'

Just delete them and no need add null check since they are net_device from
ndo_set_rx_mode of net_device_ops and vif of netdev_priv.

Signed-off-by: Leo Kim 
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 9ca33536..22a2f98 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -397,9 +397,6 @@ int wilc_wlan_get_firmware(struct net_device *dev)
 
netdev_info(dev, "loading firmware %s\n", firmware);
 
-   if (!vif)
-   goto _fail_;
-
if (!(&vif->ndev->dev))
goto _fail_;
 
@@ -1017,9 +1014,6 @@ static void wilc_set_multicast_list(struct net_device 
*dev)
vif = netdev_priv(dev);
hif_drv = (struct host_if_drv *)priv->hif_drv;
 
-   if (!dev)
-   return;
-
if (dev->flags & IFF_PROMISC)
return;
 
-- 
1.9.1

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


RE: [PATCH V6 8/8] hvsock: introduce Hyper-V Socket feature

2016-01-26 Thread Dexuan Cui
> From: Olaf Hering [mailto:o...@aepfle.de]
> Sent: Tuesday, January 26, 2016 18:24
> To: Dexuan Cui 
> Cc: gre...@linuxfoundation.org; da...@davemloft.net;
> step...@networkplumber.org; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org;
> a...@canonical.com; jasow...@redhat.com; KY Srinivasan
> ; vkuzn...@redhat.com; pebo...@tiscali.nl;
> stefa...@redhat.com; dan.carpen...@oracle.com
> Subject: Re: [PATCH V6 8/8] hvsock: introduce Hyper-V Socket feature
> 
> On Tue, Jan 26, Dexuan Cui wrote:
> 
> > +#define AF_MAX 42  /* For now.. */
> 
> Maybe net/core/sock.c needs additional strings for the new socket?
> 
> Olaf
Olaf, Thanks for the reminder!

I'll add a new patch like this:

diff --git a/net/core/sock.c b/net/core/sock.c
index 6c1c8bc..3c0aedb 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -221,7 +221,8 @@ static const char *const af_family_key_strings[AF_MAX+1] = {
   "sk_lock-AF_TIPC"  , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV",
   "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET"   ,
   "sk_lock-AF_IEEE802154", "sk_lock-AF_CAIF" , "sk_lock-AF_ALG"  ,
-  "sk_lock-AF_NFC"   , "sk_lock-AF_VSOCK", "sk_lock-AF_MAX"
+  "sk_lock-AF_NFC"   , "sk_lock-AF_VSOCK", "sk_lock-AF_HYPERV"
+  "sk_lock-AF_MAX"
 };
 static const char *const af_family_slock_key_strings[AF_MAX+1] = {
   "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" ,
@@ -237,7 +238,8 @@ static const char *const 
af_family_slock_key_strings[AF_MAX+1] = {
   "slock-AF_TIPC"  , "slock-AF_BLUETOOTH", "slock-AF_IUCV" ,
   "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET"   ,
   "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG"  ,
-  "slock-AF_NFC"   , "slock-AF_VSOCK","slock-AF_MAX"
+  "slock-AF_NFC"   , "slock-AF_VSOCK","slock-AF_HYPERV"
+  "slock-AF_MAX"
 };
 static const char *const af_family_clock_key_strings[AF_MAX+1] = {
   "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" ,
@@ -253,7 +255,8 @@ static const char *const 
af_family_clock_key_strings[AF_MAX+1] = {
   "clock-AF_TIPC"  , "clock-AF_BLUETOOTH", "clock-AF_IUCV" ,
   "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET"   ,
   "clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG"  ,
-  "clock-AF_NFC"   , "clock-AF_VSOCK", "clock-AF_MAX"
+  "clock-AF_NFC"   , "clock-AF_VSOCK", "clock-AF_HYPERV"
+  "clock-AF_MAX"
 };

 /*

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