Re: [RFC] Generic VME UIO

2015-07-23 Thread Dan Carpenter
On Wed, Jul 22, 2015 at 09:09:06PM +0300, Dmitry Kalinkin wrote:
> + for (level = 1; level <= 7; level++) {
> + char *level_node_name = kasprintf(GFP_KERNEL, "%d", level);
> + struct kobject *level_node = kobject_create_and_add(
> + level_node_name, kobj);
> + if (!level_node)
> + return -ENOMEM;

>From the zero day testing results, what I've noticed is that allocations
in the initializer are more error prone.  You should be testing the
results from kasprintf() and there is a leak if the "level_node"
allocation fails.

char *level_node_name;
struct kobject *level_node;

level_node_name = kasprintf(GFP_KERNEL, "%d", level);
if (!level_node_name)
return -ENOMEM;
level_node = kobject_create_and_add(level_node_name, kobj);
if (!level_node) {
kfree(level_node_name);
return -ENOMEM;
}

The other advantage to writing it like this is that you don't run into
the 80 char limit.

regards,
dan carpenter

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


Re: [PATCH v9 3/7] staging: add bindings document for simple fpga bus

2015-07-23 Thread Steffen Trumtrar
Hi!

On Fri, Jul 17, 2015 at 04:22:07PM -0500, atull wrote:
> On Fri, 17 Jul 2015, Steffen Trumtrar wrote:
> 
> > Hi!
> > 
> > On Fri, Jul 17, 2015 at 10:51:13AM -0500, at...@opensource.altera.com wrote:
> > > From: Alan Tull 
> > > 
> > > New bindings document for simple fpga bus.
> > > 
> > > Signed-off-by: Alan Tull 
> > > ---
> > >  .../Documentation/bindings/simple-fpga-bus.txt |   61 
> > > 
> > >  1 file changed, 61 insertions(+)
> > >  create mode 100644 
> > > drivers/staging/fpga/Documentation/bindings/simple-fpga-bus.txt
> > > 
> > > diff --git 
> > > a/drivers/staging/fpga/Documentation/bindings/simple-fpga-bus.txt 
> > > b/drivers/staging/fpga/Documentation/bindings/simple-fpga-bus.txt
> > > new file mode 100644
> > > index 000..221e781
> > > --- /dev/null
> > > +++ b/drivers/staging/fpga/Documentation/bindings/simple-fpga-bus.txt
> > > @@ -0,0 +1,61 @@
> > > +Simple FPGA Bus
> > > +===
> > > +
> > > +A Simple FPGA Bus is a bus that handles configuring an FPGA and its 
> > > bridges
> > > +before populating the devices below its node.
> > > +
> > > +Required properties:
> > > +- compatible : should contain "simple-fpga-bus"
> > > +- #address-cells, #size-cells, ranges: must be present to handle address 
> > > space
> > > +  mapping for children.
> > > +
> > > +Optional properties:
> > > +- fpga-mgr : should contain a phandle to a fpga manager.
> > > +- fpga-firmware : should contain the name of a fpga image file located 
> > > on the
> > > +  firmware search path.
> > > +- partial-reconfig : boolean property should be defined if partial
> > > +  reconfiguration is to be done.
> > > +- resets : should contain a list of resets that should be released after 
> > > the
> > > +  fpga has been programmed i.e. fpga bridges.
> > > +- reset-names : should contain a list of the names of the resets.
> > > +
> > > +Example:
> > > +
> > > +/dts-v1/;
> > > +/plugin/;
> > > +/ {
> > > + fragment@0 {
> > > + target-path="/soc";
> > > + __overlay__ {
> > > + #address-cells = <1>;
> > > + #size-cells = <1>;
> > > +
> > > + bridge@0xff20 {
> > > + compatible = "simple-fpga-bus";
> > > + #address-cells = <0x2>;
> > > + #size-cells = <0x1>;
> > > + ranges = <0x1 0x10040 0xff210040 0x20>;
> > > +
> > > + clocks = <0x2 0x2>;
> > > + clock-names = "h2f_lw_axi_clock", 
> > > "f2h_sdram0_clock";
> > > +
> > > + fpga-mgr = <&hps_0_fpgamgr>;
> > > + fpga-firmware = "soc_system.rbf";
> > > +
> > > + resets = <&hps_fpgabridge0 0>, 
> > > <&hps_fpgabridge1 0>, <&hps_fpgabridge2 0>;
> > > + reset-names = "hps2fpga", "lwhps2fpga", 
> > > "fpga2hps";
> > > +
> > > + gpio@0x100010040 {
> > > + compatible = "altr,pio-14.0", 
> > > "altr,pio-1.0";
> > > + reg = <0x1 0x10040 0x20>;
> > > + clocks = <0x2>;
> > > + altr,gpio-bank-width = <0x4>;
> > > + resetvalue = <0x0>;
> > > + #gpio-cells = <0x2>;
> > > + gpio-controller;
> > > + };
> > > + };
> > > + };
> > > + };
> > > +};
> > > +
> > 
> > Just some quick thougths for the Socfpga case:
> > 
> > What you are describing here is a virtual bus, that is not existing on
> > at least the Socfpga, right? I don't like this.
> > You are mixing different independent busses/devices into one and I don't
> > see why.
> 

Just to be clear: all in all I like this approach and I would prefer it to
go in the mainline kernel sooner than later. The thing is AFAIK we still
don't have a way to mark DT bindings as staging or in flux even if we do
have a staging area for drivers. That's why I want to be convinced that this
binding is "correct" from a binding perspective and not some linux driver
implementation. It's much easier to change a driver than breaking old dts files
with binding changes.

> It is a multi-interface bridge.  It is likely that a device will use more than
> one at a time.  This is normal in the kernel and the device tree supports it.
> My example is too simplistic.  It is common for a device to use the lwh2f
> bridge for register access and the h2f bridge for data.  So you'd have
> 
>reg = <0xc000 0x2000>,
>  <0xff20 0x0020>;
> 
> and ranges that map from those areas.
> 

Yeah, sure. I used that, too. Where is the problem with

&hps2fpga {
status = "okay";
my-ip-core {
config = <&lwhps2fpga>;
...
};
};


能否与//三期妇女/特殊保护期间的员工//协商解除

2015-07-23 Thread 徐亦火


binReFQmyqq1o.bin
Description: Binary data
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability

2015-07-23 Thread Dan Carpenter
On Thu, Jul 23, 2015 at 03:05:16AM +, Dexuan Cui wrote:
> The kind of usage is not rare in the kernel code:

Yeah.  But it's used 5% of the time.  If it's under 15% then there is a
risk that we'll write a checkpatch rule to enforce the standard way...
There are some places where != 0 is idiomatic, like when you are talking
about the number zero.  strcmp() and friends should always be != 0 or
== 0.

In this specific case, writing it as "if (ret != 0)" caused the bug.  If
we had written it as "if (ret) return ret;" then there are no zeroes so
wouldn't have been any temptation to return the zero instead of the ret.

> Hi Dan, I read this as a humor.  :-)

:)

regards,
dan carpenter

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


Re: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability

2015-07-23 Thread Dan Carpenter
On Thu, Jul 23, 2015 at 01:10:57PM +0300, Dan Carpenter wrote:
> In this specific case, writing it as "if (ret != 0)" caused the bug.  If
> we had written it as "if (ret) return ret;" then there are no zeroes so
> wouldn't have been any temptation to return the zero instead of the ret.

I did a search to see if returning the zero instead of the ret was a
common mistake and it seems like it might be.  I did:

grep 'if (ret != 0)' drivers/   -r -A1 -n | grep "return 0;" | perl -ne 
's/.c-(\d+)-/.c:$1/; print'

drivers/gpu/drm/nouveau/nouveau_display.c:111   return 0;
drivers/regulator/wm8400-regulator.c:47 return 0;
drivers/platform/x86/dell-laptop.c:859  return 0;
drivers/media/dvb-frontends/dibx000_common.c:213
return 0;
drivers/media/dvb-frontends/dibx000_common.c:217
return 0;
drivers/media/dvb-frontends/dibx000_common.c:235
return 0;
drivers/media/dvb-frontends/dibx000_common.c:239
return 0;
drivers/hv/channel.c:898return 0;
drivers/hv/channel.c:944return 0;

A bunch of those look suspicious but I don't know the subsystems well
enough to be sure.  Can you check the last two?

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


RE: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability

2015-07-23 Thread Dexuan Cui
> From: Dan Carpenter
> Sent: Thursday, July 23, 2015 18:25
> On Thu, Jul 23, 2015 at 01:10:57PM +0300, Dan Carpenter wrote:
> > In this specific case, writing it as "if (ret != 0)" caused the bug.  If
> > we had written it as "if (ret) return ret;" then there are no zeroes so
> > wouldn't have been any temptation to return the zero instead of the ret.
> 
> I did a search to see if returning the zero instead of the ret was a
> common mistake and it seems like it might be.  I did:
> 
> grep 'if (ret != 0)' drivers/   -r -A1 -n | grep "return 0;" | perl -ne 
> 's/.c-(\d+)-/.c:$1/;
> print'
> 
> drivers/gpu/drm/nouveau/nouveau_display.c:111   return 0;
> drivers/regulator/wm8400-regulator.c:47 return 0;
> drivers/platform/x86/dell-laptop.c:859  return 0;
> drivers/media/dvb-frontends/dibx000_common.c:213  
>   return 0;
> drivers/media/dvb-frontends/dibx000_common.c:217  
>   return 0;
> drivers/media/dvb-frontends/dibx000_common.c:235  
>   return 0;
> drivers/media/dvb-frontends/dibx000_common.c:239  
>   return 0;
> drivers/hv/channel.c:898return 0;
> drivers/hv/channel.c:944return 0;
> 
> A bunch of those look suspicious but I don't know the subsystems well
> enough to be sure.  Can you check the last two?
> 
> dan carpenter

Thanks, Dan!

After I checked the code, I think there is no issue for the last two:
in the case of "if (ret != 0) return 0;",  the output parameter 
buffer_actual_len is
zero and it is explicitly checked by the callers.
This may seem not natural and I think we can improve it in future.

BTW, at the end of vmbus_recvpacket(), the "return 0;" should be "return ret;", 
but
since the output parameter buffer_actual_len is checked by the callers, I think 
it's
OK for now.

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


Re: [PATCH 03/10] Staging: fbtft: Use a struct to describe each LCD controller

2015-07-23 Thread Noralf Trønnes


Den 30.06.2015 08:43, skrev Fabio Falzoi:

Use a struct flexfb_lcd_controller to holds chip properties, instead of
relying on a long 'if - else if' chain.
This allows to:
- use a simple linear search to verify if a certain LCD controller
model is supported or not.
- add support for a new LCD chip controller simply defining a new
flexfb_lcd_controller struct.

Signed-off-by: Fabio Falzoi 
---
  drivers/staging/fbtft/fbtft.h  |  20 
  drivers/staging/fbtft/flexfb.c | 212 ++---
  2 files changed, 136 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 7d817eb..c96c06b 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -256,6 +256,26 @@ struct fbtft_par {
void *extra;
  };
  
+/**

+ * struct flexfb_lcd_controller - Describes the LCD controller properties
+ * @name: Model name of the chip
+ * @width: Width of display in pixels
+ * @height: Height of display in pixels
+ * @setaddrwin: Which set_addr_win() implementation to use
+ * @regwidth: LCD Controller Register width in bits
+ * @init_seq: LCD initialization sequence
+ * @init_seq_sz: Size of LCD initialization sequence
+ */
+struct flexfb_lcd_controller {
+   const char *name;
+   unsigned int width;
+   unsigned int height;
+   unsigned int setaddrwin;
+   unsigned int regwidth;
+   int *init_seq;
+   int init_seq_sz;
+};
+


Please put this in flexfb.c since it won't be used outside that file.


  #define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__})/sizeof(int))
  
  #define write_reg(par, ...)  \

diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index ed867e7..25b394d 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -126,6 +126,89 @@ static int ssd1351_init[] = { -1, 0xfd, 0x12, -1, 0xfd, 
0xb1, -1, 0xae, -1, 0xb3
  -1, 0xab, 0x01, -1, 0xb1, 0x32, -1, 0xb4, 0xa0, 
0xb5, 0x55, -1, 0xbb, 0x17, -1, 0xbe, 0x05,
  -1, 0xc1, 0xc8, 0x80, 0xc8, -1, 0xc7, 0x0f, -1, 
0xb6, 0x01, -1, 0xa6, -1, 0xaf, -3 };
  
+static const struct flexfb_lcd_controller flexfb_chip_table[] = {

+   {
+   .name = "st7735r",
+   .width = 120,
+   .height = 160,
+   .init_seq = st7735r_init,
+   .init_seq_sz = ARRAY_SIZE(st7735r_init),
+   },
+   {


Can this be put on one line? }, {

With the struct moved:
Acked-by: Noralf Trønnes 

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


[PATCH 1/3] staging: wilc1000: coreconfigurator.c: remove WILC_MALLOC

2015-07-23 Thread Chaehyun Lim
Use kmalloc and kmalloc_array instead of WILC_MALLOC.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index b069614..7e2b2ab41 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -674,7 +674,7 @@ s32 CoreConfiguratorInit(void)
sema_init(&SemHandleSendPkt, 1);
sema_init(&SemHandlePktResp, 0);
 
-   gps8ConfigPacket = (s8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
+   gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_ATOMIC);
if (gps8ConfigPacket == NULL) {
PRINT_ER("failed in gps8ConfigPacket allocation\n");
s32Error = WILC_NO_MEM;
@@ -811,7 +811,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;
 
-   pstrNetworkInfo = (tstrNetworkInfo 
*)WILC_MALLOC(sizeof(tstrNetworkInfo));
+   pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);
WILC_memset((void *)(pstrNetworkInfo), 0, 
sizeof(tstrNetworkInfo));
 
pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -862,7 +862,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
if (u16IEsLen > 0) {
-   pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen);
+   pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_ATOMIC);
WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -929,7 +929,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u8 *pu8IEs = 0;
u16 u16IEsLen = 0;
 
-   pstrConnectRespInfo = (tstrConnectRespInfo 
*)WILC_MALLOC(sizeof(tstrConnectRespInfo));
+   pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_ATOMIC);
WILC_memset((void *)(pstrConnectRespInfo), 0, 
sizeof(tstrConnectRespInfo));
 
/* u16AssocRespLen = pu8Buffer[0]; */
@@ -949,7 +949,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
-   pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen);
+   pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_ATOMIC);
WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
@@ -1018,7 +1018,8 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
}
}
 
-   pstrSurveyResults = (wid_site_survey_reslts_s 
*)WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s));
+   pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
+   sizeof(wid_site_survey_reslts_s), GFP_ATOMIC);
if (pstrSurveyResults == NULL) {
u32SurveyResultsCount = 0;
WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-- 
1.9.1

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


[PATCH 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

2015-07-23 Thread Chaehyun Lim
Add error check if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 7e2b2ab41..b51c15f 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Hi;
 
pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);
+   if (pstrNetworkInfo == NULL)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo), 0, 
sizeof(tstrNetworkInfo));
 
pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -863,6 +866,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
 
if (u16IEsLen > 0) {
pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_ATOMIC);
+   if (pstrNetworkInfo->pu8IEs == NULL)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -930,6 +936,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16 u16IEsLen = 0;
 
pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_ATOMIC);
+   if (pstrConnectRespInfo == NULL)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo), 0, 
sizeof(tstrConnectRespInfo));
 
/* u16AssocRespLen = pu8Buffer[0]; */
@@ -950,6 +959,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_ATOMIC);
+   if (pstrConnectRespInfo->pu8RespIEs == NULL)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
-- 
1.9.1

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


[PATCH 3/3] staging: wilc1000: coreconfigurator.c: fix kmalloc error check

2015-07-23 Thread Chaehyun Lim
Return -ENOMEM if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index b51c15f..eca21bf 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -675,11 +675,8 @@ s32 CoreConfiguratorInit(void)
sema_init(&SemHandlePktResp, 0);
 
gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_ATOMIC);
-   if (gps8ConfigPacket == NULL) {
-   PRINT_ER("failed in gps8ConfigPacket allocation\n");
-   s32Error = WILC_NO_MEM;
-   goto _fail_;
-   }
+   if (gps8ConfigPacket == NULL)
+   return -ENOMEM;
 
WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE);
 
@@ -1032,10 +1029,8 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
 
pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
sizeof(wid_site_survey_reslts_s), GFP_ATOMIC);
-   if (pstrSurveyResults == NULL) {
-   u32SurveyResultsCount = 0;
-   WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-   }
+   if (pstrSurveyResults == NULL)
+   return -ENOMEM;
 
WILC_memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * 
sizeof(wid_site_survey_reslts_s));
 
-- 
1.9.1

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


Re: [PATCH 06/10] Staging: fbtft: Use a helper function to set set_addr_win op

2015-07-23 Thread Noralf Trønnes


Den 15.07.2015 04:14, skrev Greg KH:

On Tue, Jun 30, 2015 at 08:43:13AM +0200, Fabio Falzoi wrote:

Use a helper function to choose which set_addr_win implementation to
use, based on the value of the setaddrwin module parameter.

Signed-off-by: Fabio Falzoi 
---
  drivers/staging/fbtft/flexfb.c | 47 +-
  1 file changed, 28 insertions(+), 19 deletions(-)

Again, why?

I need a maintainer of the code to ack any of these...



I know this code fairly well, but I have to look up the details.
Moving these details from the probe function into small functions
makes it more difficult for me get to those details in a glance.
I would now have to scroll back and forth to see how flexfb is
doing things, especially since flexfb differs from the other drivers
which uses common functions in fbtft-core.c.
So I prefer to keep it as it is.

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


Re: [PATCH 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

2015-07-23 Thread Dan Carpenter
On Thu, Jul 23, 2015 at 08:19:18PM +0900, Chaehyun Lim wrote:
> Add error check if memory allocation is failed.
> 
> Signed-off-by: Chaehyun Lim 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index 7e2b2ab41..b51c15f 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
> **ppstrNetworkInfo)
>   u32 u32Tsf_Hi;
>  
>   pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);
> + if (pstrNetworkInfo == NULL)
> + return -ENOMEM;

Run your patches through checkpatch.pl --strict.  These days we prefer:

if (!pstrNetworkInfo)
return -ENOMEM;

These patches are nice otherwise.

regards,
dan carpenter

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


[PATCH] staging: rtl8192e: rtllib: fix macro style issue

2015-07-23 Thread Ioan-Adrian Ratiu
Enclose defined macro in paranthesis to avoid checkpatch complaint
"ERROR: Macros with complex values should be enclosed in parentheses"

Signed-off-by: Ioan-Adrian Ratiu 
---
 drivers/staging/rtl8192e/rtllib_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c 
b/drivers/staging/rtl8192e/rtllib_rx.c
index 54dfff6..5f1650c 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1744,7 +1744,7 @@ static int rtllib_parse_qos_info_param_IE(struct 
rtllib_device *ieee,
return rc;
 }
 
-#define MFIE_STRING(x) case MFIE_TYPE_ ##x: return #x
+#define MFIE_STRING(x) (case MFIE_TYPE_ ##x: return #x)
 
 static const char *get_info_element_string(u16 id)
 {
-- 
2.1.4

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


Re: [PATCH v2] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller

2015-07-23 Thread Noralf Trønnes


Den 15.07.2015 11:36, skrev Paul Bolle:

On di, 2015-07-14 at 14:59 +0200, Henri Chain wrote:

--- /dev/null
+++ b/drivers/staging/fbtft/fb_uc1611.c
+#define DRVNAME"fb_uc1611"
+MODULE_ALIAS("spi:" DRVNAME);
+MODULE_ALIAS("platform:" DRVNAME);
+MODULE_ALIAS("spi:uc1611");
+MODULE_ALIAS("platform:uc1611");

Many of the drivers under drivers/staging/fbtft use a comparable set of
aliases. But I wonder if they are all needed (here, and in the other
drivers).

In this case I think I understand how the "fb_uc1611" .modalias (see
below) will eventually trigger a "MODALIAS=spi:fb_uc1611" uevent. And
that uevent will make userspace load the fb_uc1611.ko module, right?

But is there a similar way that "spi:uc1611" fits into the system?
Because I couldn't spot anything similar for "uc1611".


If I remember correctly, this is used for autoloading the module when 
using Device Tree.



Likewise, "platform:fb_uc1611" and "platform:uc1611" require struct
platform_device's with "fb_uc1611" and "uc1611" .name's. But I couldn't
spot where platform_device's with those .name's are created. How do
these two aliases fit into the system?


Most of these display controllers support both SPI and 8080 parallel 
interface.

So the FBTFT_REGISTER_DRIVER macro sets up both a SPI and a platform driver.
I can't remember the reason why I couldn't put the MODULE_ALIAS'es inside
FBTFT_REGISTER_DRIVER.
If the chip only has a SPI interface, then the platform aliases are not 
needed.



Noralf.

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


Re: [PATCH] staging: rtl8192e: rtllib: fix macro style issue

2015-07-23 Thread Dan Carpenter
On Thu, Jul 23, 2015 at 01:59:33PM +0300, Ioan-Adrian Ratiu wrote:
> Enclose defined macro in paranthesis to avoid checkpatch complaint
> "ERROR: Macros with complex values should be enclosed in parentheses"
> 
> Signed-off-by: Ioan-Adrian Ratiu 
> ---
>  drivers/staging/rtl8192e/rtllib_rx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_rx.c 
> b/drivers/staging/rtl8192e/rtllib_rx.c
> index 54dfff6..5f1650c 100644
> --- a/drivers/staging/rtl8192e/rtllib_rx.c
> +++ b/drivers/staging/rtl8192e/rtllib_rx.c
> @@ -1744,7 +1744,7 @@ static int rtllib_parse_qos_info_param_IE(struct 
> rtllib_device *ieee,
>   return rc;
>  }
>  
> -#define MFIE_STRING(x) case MFIE_TYPE_ ##x: return #x
> +#define MFIE_STRING(x) (case MFIE_TYPE_ ##x: return #x)
>  

This will break the build.  Be more careful.

regards,
dan carpenter

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


[PATCH v7 0/3] Drivers: hv: vmbus: use cpu_hotplug_enable/disable for CPU offlining prevention

2015-07-23 Thread Vitaly Kuznetsov
Changes since v6:
- Rearrange patches. [Thomas Gleixner]
- Fix a typo in PATCH 2 description [Thomas Gleixner].
- Add Reviewed-by: [Thomas Gleixner].

Changes since v5:
- Split PATCH 1 into two (PATCH 1/3 and 3/3), rewrite changelogs. [Thomas
  Gleixner]

Changes since v4:
- In disable_nonboot_cpus() do cpu_hotplug_disabled++ unconditionally as
  its users are doing enable_nonboot_cpus() on their failure paths.

Changes since v3:
- add WARN_ON when decreasing cpu_hotplug_disabled [Peter Zijlstra]

Changes since v2:
- Rebase on top of current Greg's char-misc-next tree [K. Y. Srinivasan]

Changes since v1:
- Make cpu_hotplug_disabled a counter [Radim Krčmář]

Export cpu_hotplug_enable/cpu_hotplug_disable functions from cpu.c and use
them instead of altering smp_ops.cpu_disable in Hyper-V vmbus module.

Vitaly Kuznetsov (3):
  cpu-hotplug: convert cpu_hotplug_disabled to a counter
  cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable
  Drivers: hv: vmbus: use cpu_hotplug_enable/disable

 Documentation/power/suspend-and-cpuhotplug.txt |  6 ++--
 drivers/hv/vmbus_drv.c | 38 +++---
 kernel/cpu.c   | 24 ++--
 3 files changed, 22 insertions(+), 46 deletions(-)

-- 
2.4.3

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


[PATCH v7 1/3] cpu-hotplug: convert cpu_hotplug_disabled to a counter

2015-07-23 Thread Vitaly Kuznetsov
As a prerequisite to exporting cpu_hotplug_enable/cpu_hotplug_disable
functions to modules we need to convert cpu_hotplug_disabled to a counter
to properly support disable -> disable -> enable call sequences. E.g.
after Hyper-V vmbus module (which is supposed to be the first user of
exported cpu_hotplug_enable/cpu_hotplug_disable) did cpu_hotplug_disable()
hibernate path calls disable_nonboot_cpus() and if we hit an error in
_cpu_down() enable_nonboot_cpus() will be called on the failure path (thus
making cpu_hotplug_disabled = 0 and leaving cpu hotplug in 'enabled'
state). Same problem is possible if more than 1 module use
cpu_hotplug_disable/cpu_hotplug_enable on their load/unload paths. When
one of these modules is been unloaded it is logical to leave cpu hotplug
in 'disabled' state.

To support the change we need to increse cpu_hotplug_disabled counter
in disable_nonboot_cpus() unconditionally as all users of
disable_nonboot_cpus() are supposed to do enable_nonboot_cpus() in case
an error was returned.

Signed-off-by: Vitaly Kuznetsov 
Reviewed-by: Thomas Gleixner 
---
Changes since v6:
- make this patch first in the series [Thomas Gleixner], minor description
  change.
---
 Documentation/power/suspend-and-cpuhotplug.txt |  6 +++---
 kernel/cpu.c   | 21 +
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Documentation/power/suspend-and-cpuhotplug.txt 
b/Documentation/power/suspend-and-cpuhotplug.txt
index 2850df3..2fc9095 100644
--- a/Documentation/power/suspend-and-cpuhotplug.txt
+++ b/Documentation/power/suspend-and-cpuhotplug.txt
@@ -72,7 +72,7 @@ More details follow:
 |
 v
Disable regular cpu hotplug
-by setting cpu_hotplug_disabled=1
+by increasing cpu_hotplug_disabled
 |
 v
 Release cpu_add_remove_lock
@@ -89,7 +89,7 @@ Resuming back is likewise, with the counterparts being (in 
the order of
 execution during resume):
 * enable_nonboot_cpus() which involves:
|  Acquire cpu_add_remove_lock
-   |  Reset cpu_hotplug_disabled to 0, thereby enabling regular cpu hotplug
+   |  Decrease cpu_hotplug_disabled, thereby enabling regular cpu hotplug
|  Call _cpu_up() [for all those cpus in the frozen_cpus mask, in a loop]
|  Release cpu_add_remove_lock
v
@@ -120,7 +120,7 @@ after the entire cycle is complete (i.e., suspend + resume).
Acquire cpu_add_remove_lock
 |
 v
-  If cpu_hotplug_disabled is 1
+  If cpu_hotplug_disabled > 0
 return gracefully
 |
 |
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 5644ec5..0fca2ba 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -191,14 +191,14 @@ void cpu_hotplug_done(void)
 void cpu_hotplug_disable(void)
 {
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 1;
+   cpu_hotplug_disabled++;
cpu_maps_update_done();
 }
 
 void cpu_hotplug_enable(void)
 {
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 0;
+   WARN_ON(--cpu_hotplug_disabled < 0);
cpu_maps_update_done();
 }
 
@@ -608,13 +608,18 @@ int disable_nonboot_cpus(void)
}
}
 
-   if (!error) {
+   if (!error)
BUG_ON(num_online_cpus() > 1);
-   /* Make sure the CPUs won't be enabled by someone else */
-   cpu_hotplug_disabled = 1;
-   } else {
+   else
pr_err("Non-boot CPUs are not disabled\n");
-   }
+
+   /*
+* Make sure the CPUs won't be enabled by someone else. We need to do
+* this even in case of failure as all disable_nonboot_cpus() users are
+* supposed to do enable_nonboot_cpus() on the failure path.
+*/
+   cpu_hotplug_disabled++;
+
cpu_maps_update_done();
return error;
 }
@@ -633,7 +638,7 @@ void __ref enable_nonboot_cpus(void)
 
/* Allow everyone to use the CPU hotplug again */
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 0;
+   WARN_ON(--cpu_hotplug_disabled < 0);
if (cpumask_empty(frozen_cpus))
goto out;
 
-- 
2.4.3

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


[PATCH v7 2/3] cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable

2015-07-23 Thread Vitaly Kuznetsov
Hyper-V module needs to disable cpu hotplug (offlining) as there is no
support from hypervisor side to reassign already opened event channels
to a different CPU. Currently it is been done by altering
smp_ops.cpu_disable but it is hackish.

Signed-off-by: Vitaly Kuznetsov 
Reviewed-by: Thomas Gleixner 
---
Changes since v6:
- fix a typo in description [Thomas Gleixner]
---
 kernel/cpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 0fca2ba..718ea76 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -194,6 +194,7 @@ void cpu_hotplug_disable(void)
cpu_hotplug_disabled++;
cpu_maps_update_done();
 }
+EXPORT_SYMBOL_GPL(cpu_hotplug_disable);
 
 void cpu_hotplug_enable(void)
 {
@@ -201,7 +202,7 @@ void cpu_hotplug_enable(void)
WARN_ON(--cpu_hotplug_disabled < 0);
cpu_maps_update_done();
 }
-
+EXPORT_SYMBOL_GPL(cpu_hotplug_enable);
 #endif /* CONFIG_HOTPLUG_CPU */
 
 /* Need to know about CPUs going up/down? */
-- 
2.4.3

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


[PATCH v7 3/3] Drivers: hv: vmbus: use cpu_hotplug_enable/disable

2015-07-23 Thread Vitaly Kuznetsov
Commit e513229b4c38 ("Drivers: hv: vmbus: prevent cpu offlining on newer
hypervisors") was altering smp_ops.cpu_disable to prevent CPU offlining.
We can bo better by using cpu_hotplug_enable/disable functions instead of
such hard-coding.

Reported-by: Radim Krčmář 
Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/vmbus_drv.c | 38 --
 1 file changed, 4 insertions(+), 34 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index cf20400..6de65fb 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -763,38 +763,6 @@ static void vmbus_isr(void)
}
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-static int hyperv_cpu_disable(void)
-{
-   return -ENOSYS;
-}
-
-static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
-{
-   static void *previous_cpu_disable;
-
-   /*
-* Offlining a CPU when running on newer hypervisors (WS2012R2, Win8,
-* ...) is not supported at this moment as channel interrupts are
-* distributed across all of them.
-*/
-
-   if ((vmbus_proto_version == VERSION_WS2008) ||
-   (vmbus_proto_version == VERSION_WIN7))
-   return;
-
-   if (vmbus_loaded) {
-   previous_cpu_disable = smp_ops.cpu_disable;
-   smp_ops.cpu_disable = hyperv_cpu_disable;
-   pr_notice("CPU offlining is not supported by hypervisor\n");
-   } else if (previous_cpu_disable)
-   smp_ops.cpu_disable = previous_cpu_disable;
-}
-#else
-static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
-{
-}
-#endif
 
 /*
  * vmbus_bus_init -Main vmbus driver initialization routine.
@@ -836,7 +804,8 @@ static int vmbus_bus_init(int irq)
if (ret)
goto err_alloc;
 
-   hv_cpu_hotplug_quirk(true);
+   if (vmbus_proto_version > VERSION_WIN7)
+   cpu_hotplug_disable();
 
/*
 * Only register if the crash MSRs are available
@@ -1121,7 +1090,8 @@ static void __exit vmbus_exit(void)
smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
}
acpi_bus_unregister_driver(&vmbus_acpi_driver);
-   hv_cpu_hotplug_quirk(false);
+   if (vmbus_proto_version > VERSION_WIN7)
+   cpu_hotplug_enable();
 }
 
 
-- 
2.4.3

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


[PATCH V2 3/3] staging: wilc1000: coreconfigurator.c: fix kmalloc error check

2015-07-23 Thread Chaehyun Lim
Return -ENOMEM if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
V2: use ! operator instead of NULL comparison.

 drivers/staging/wilc1000/coreconfigurator.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 9c3ecaa..ff1eb5b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -675,11 +675,8 @@ s32 CoreConfiguratorInit(void)
sema_init(&SemHandlePktResp, 0);
 
gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_ATOMIC);
-   if (gps8ConfigPacket == NULL) {
-   PRINT_ER("failed in gps8ConfigPacket allocation\n");
-   s32Error = WILC_NO_MEM;
-   goto _fail_;
-   }
+   if (!gps8ConfigPacket)
+   return -ENOMEM;
 
WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE);
 
@@ -1032,10 +1029,8 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
 
pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
sizeof(wid_site_survey_reslts_s), GFP_ATOMIC);
-   if (pstrSurveyResults == NULL) {
-   u32SurveyResultsCount = 0;
-   WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-   }
+   if (!pstrSurveyResults)
+   return -ENOMEM;
 
WILC_memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * 
sizeof(wid_site_survey_reslts_s));
 
-- 
1.9.1

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


[PATCH V2 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

2015-07-23 Thread Chaehyun Lim
Add error check if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
V2: use ! operator instead of NULL comparison

 drivers/staging/wilc1000/coreconfigurator.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 7e2b2ab41..9c3ecaa 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Hi;
 
pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);
+   if (!pstrNetworkInfo)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo), 0, 
sizeof(tstrNetworkInfo));
 
pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -863,6 +866,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
 
if (u16IEsLen > 0) {
pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_ATOMIC);
+   if (!pstrNetworkInfo->pu8IEs)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -930,6 +936,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16 u16IEsLen = 0;
 
pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_ATOMIC);
+   if (!pstrConnectRespInfo)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo), 0, 
sizeof(tstrConnectRespInfo));
 
/* u16AssocRespLen = pu8Buffer[0]; */
@@ -950,6 +959,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_ATOMIC);
+   if (!pstrConnectRespInfo->pu8RespIEs)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
-- 
1.9.1

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


Re: [PATCH v2] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller

2015-07-23 Thread Noralf Trønnes


Den 14.07.2015 14:59, skrev Henri Chain:

This is a driver chip for 240x160 4-bit greyscale LCDs.
It is capable of 4-wire (8 bit) or 3-wire (9 bit) SPI that have both been
tested. (It also has a 6800 or 8080-style parallel interface, but I have
not included support for it.)

Signed-off-by: Henri Chain 
---



diff --git a/drivers/staging/fbtft/fb_uc1611.c 
b/drivers/staging/fbtft/fb_uc1611.c



+static int init_display(struct fbtft_par *par)
+{
+   int ret;
+
+   fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
+
+   /* Set CS active high */
+   par->spi->mode |= SPI_CS_HIGH;


Why is this set here and not in fbtft_device along side SPI_MODE_3?


+static int set_var(struct fbtft_par *par)
+{
+   fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
+
+   /* par->info->fix.visual = FB_VISUAL_PSEUDOCOLOR; */


This comment can be removed I guess.

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


[PATCH v2] staging: rtl8192e: rtllib: fix macro style issue

2015-07-23 Thread Ioan-Adrian Ratiu
Remove macro and use explicit case statements. Code is a little
longer but clearer. Checkpatch.pl does not complain anymore.

Signed-off-by: Ioan-Adrian Ratiu 
---
 drivers/staging/rtl8192e/rtllib_rx.c | 80 +++-
 1 file changed, 52 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c 
b/drivers/staging/rtl8192e/rtllib_rx.c
index 54dfff6..09f0820 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1744,37 +1744,61 @@ static int rtllib_parse_qos_info_param_IE(struct 
rtllib_device *ieee,
return rc;
 }
 
-#define MFIE_STRING(x) case MFIE_TYPE_ ##x: return #x
-
 static const char *get_info_element_string(u16 id)
 {
switch (id) {
-   MFIE_STRING(SSID);
-   MFIE_STRING(RATES);
-   MFIE_STRING(FH_SET);
-   MFIE_STRING(DS_SET);
-   MFIE_STRING(CF_SET);
-   MFIE_STRING(TIM);
-   MFIE_STRING(IBSS_SET);
-   MFIE_STRING(COUNTRY);
-   MFIE_STRING(HOP_PARAMS);
-   MFIE_STRING(HOP_TABLE);
-   MFIE_STRING(REQUEST);
-   MFIE_STRING(CHALLENGE);
-   MFIE_STRING(POWER_CONSTRAINT);
-   MFIE_STRING(POWER_CAPABILITY);
-   MFIE_STRING(TPC_REQUEST);
-   MFIE_STRING(TPC_REPORT);
-   MFIE_STRING(SUPP_CHANNELS);
-   MFIE_STRING(CSA);
-   MFIE_STRING(MEASURE_REQUEST);
-   MFIE_STRING(MEASURE_REPORT);
-   MFIE_STRING(QUIET);
-   MFIE_STRING(IBSS_DFS);
-   MFIE_STRING(RSN);
-   MFIE_STRING(RATES_EX);
-   MFIE_STRING(GENERIC);
-   MFIE_STRING(QOS_PARAMETER);
+   case MFIE_TYPE_SSID:
+   return "SSID";
+   case MFIE_TYPE_RATES:
+   return "RATES";
+   case MFIE_TYPE_FH_SET:
+   return "FH_SET";
+   case MFIE_TYPE_DS_SET:
+   return "DS_SET";
+   case MFIE_TYPE_CF_SET:
+   return "CF_SET";
+   case MFIE_TYPE_TIM:
+   return "TIM";
+   case MFIE_TYPE_IBSS_SET:
+   return "IBSS_SET";
+   case MFIE_TYPE_COUNTRY:
+   return "COUNTRY";
+   case MFIE_TYPE_HOP_PARAMS:
+   return "HOP_PARAMS";
+   case MFIE_TYPE_HOP_TABLE:
+   return "HOP_TABLE";
+   case MFIE_TYPE_REQUEST:
+   return "REQUEST";
+   case MFIE_TYPE_CHALLENGE:
+   return "CHALLENGE";
+   case MFIE_TYPE_POWER_CONSTRAINT:
+   return "POWER_CONSTRAINT";
+   case MFIE_TYPE_POWER_CAPABILITY:
+   return "POWER_CAPABILITY";
+   case MFIE_TYPE_TPC_REQUEST:
+   return "TPC_REQUEST";
+   case MFIE_TYPE_TPC_REPORT:
+   return "TPC_REPORT";
+   case MFIE_TYPE_SUPP_CHANNELS:
+   return "SUPP_CHANNELS";
+   case MFIE_TYPE_CSA:
+   return "CSA";
+   case MFIE_TYPE_MEASURE_REQUEST:
+   return "MEASURE_REQUEST";
+   case MFIE_TYPE_MEASURE_REPORT:
+   return "MEASURE_REPORT";
+   case MFIE_TYPE_QUIET:
+   return "QUIET";
+   case MFIE_TYPE_IBSS_DFS:
+   return "IBSS_DFS";
+   case MFIE_TYPE_RSN:
+   return "RSN";
+   case MFIE_TYPE_RATES_EX:
+   return "RATES_EX";
+   case MFIE_TYPE_GENERIC:
+   return "GENERIC";
+   case MFIE_TYPE_QOS_PARAMETER:
+   return "QOS_PARAMETER";
default:
return "UNKNOWN";
}
-- 
2.1.4

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


[PATCH 1/5] Add blank line under variable declaration.

2015-07-23 Thread Incarnation P. Lee
Signed-off-by: Incarnation P. Lee 

---
 drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index a7f3032..8b2c1e7 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -169,6 +169,7 @@ int cl_page_gang_lookup(const struct lu_env *env, struct 
cl_object *obj,
while ((nr = radix_tree_gang_lookup(&hdr->coh_tree, (void **)pvec,
idx, CLT_PVEC_SIZE)) > 0) {
int end_of_region = 0;
+
idx = pvec[nr - 1]->cp_index + 1;
for (i = 0, j = 0; i < nr; ++i) {
page = pvec[i];
@@ -286,6 +287,7 @@ static struct cl_page *cl_page_alloc(const struct lu_env 
*env,
GFP_NOFS);
if (page != NULL) {
int result = 0;
+
atomic_set(&page->cp_ref, 1);
if (type == CPT_CACHEABLE) /* for radix tree */
atomic_inc(&page->cp_ref);
-- 
1.9.0

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


Fix one source file coding sytle issue.

2015-07-23 Thread Incarnation P. Lee
drivers/staging/lustre/lustre/obdclass/cl_page.c

Signed-off-by: Incarnation P. Lee 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/5] Add one space after that ',' in parameters list.

2015-07-23 Thread Incarnation P. Lee
Signed-off-by: Incarnation P. Lee 

---
 drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index 8b2c1e7..739814e 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -1427,7 +1427,7 @@ void cl_page_clip(const struct lu_env *env, struct 
cl_page *pg,
CL_PAGE_HEADER(D_TRACE, env, pg, "%d %d\n", from, to);
CL_PAGE_INVOID(env, pg, CL_PAGE_OP(cpo_clip),
   (const struct lu_env *,
-   const struct cl_page_slice *,int, int),
+   const struct cl_page_slice *, int, int),
   from, to);
 }
 EXPORT_SYMBOL(cl_page_clip);
-- 
1.9.0

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


[PATCH 3/5] Remove unnecessary braces {} are for single statement blocks

2015-07-23 Thread Incarnation P. Lee
Signed-off-by: Incarnation P. Lee 

---
 drivers/staging/lustre/lustre/obdclass/cl_page.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index 739814e..c386c43 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -374,9 +374,8 @@ static struct cl_page *cl_page_find0(const struct lu_env 
*env,
   idx) == page));
}
 
-   if (page != NULL) {
+   if (page != NULL)
return page;
-   }
 
/* allocate and initialize cl_page */
page = cl_page_alloc(env, o, idx, vmpage, type);
-- 
1.9.0

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


[PATCH 4/5] Replace spaces at the start of a line with tab.

2015-07-23 Thread Incarnation P. Lee
Signed-off-by: Incarnation P. Lee 

---
 drivers/staging/lustre/lustre/obdclass/cl_page.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index c386c43..4cc17d3 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -52,12 +52,12 @@ static void cl_page_delete0(const struct lu_env *env, 
struct cl_page *pg,
int radix);
 
 # define PASSERT(env, page, expr) \
-  do { \
+   do {\
  if (unlikely(!(expr))) {\
  CL_PAGE_DEBUG(D_ERROR, (env), (page), #expr "\n");\
  LASSERT(0);  \
  }  \
-  } while (0)
+   } while (0)
 
 # define PINVRNT(env, page, exp) \
((void)sizeof(env), (void)sizeof(page), (void)sizeof !!(exp))
-- 
1.9.0

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


[PATCH 5/5] Adjust code indent for conditional statements with tab.

2015-07-23 Thread Incarnation P. Lee
Signed-off-by: Incarnation P. Lee 

---
 drivers/staging/lustre/lustre/obdclass/cl_page.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index 4cc17d3..428c6b2 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -51,12 +51,12 @@
 static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg,
int radix);
 
-# define PASSERT(env, page, expr) \
-   do {\
- if (unlikely(!(expr))) {\
- CL_PAGE_DEBUG(D_ERROR, (env), (page), #expr "\n");\
- LASSERT(0);  \
- }  \
+# define PASSERT(env, page, expr) \
+   do {   \
+   if (unlikely(!(expr))) {   \
+   CL_PAGE_DEBUG(D_ERROR, (env), (page), #expr "\n"); \
+   LASSERT(0);\
+   }  \
} while (0)
 
 # define PINVRNT(env, page, exp) \
-- 
1.9.0

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


Re: Fix one source file coding sytle issue.

2015-07-23 Thread Frans Klaver
Hi,

On Thu, Jul 23, 2015 at 8:20 AM, Incarnation P. Lee
 wrote:
> drivers/staging/lustre/lustre/obdclass/cl_page.c

It is custom that you write slightly more introductory text here. Just
a file name is pointless.

The subject should probably contain [PATCH 0/5]. This would be
automatically fixed for you when using 'git format-patch
--cover-letter ...'.

The other patches should at least mention the area of the kernel the
change is done in:

  [PATCH N/5] staging: lustre: fix a missing space after comma

So that it becomes immediately clear where the change is done, and
what it is supposed to achieve.


> Signed-off-by: Incarnation P. Lee 

That's not necessary in the cover letter.

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


[PATCH V7 2/4] cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable

2015-07-23 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov 

Hyper-V module needs to disable cpu hotplug (offlining) as there is no
support from hypervisor side to reassign already opened event channels
to a different CPU. Currently it is been done by altering
smp_ops.cpu_disable but it is hackish.

Signed-off-by: Vitaly Kuznetsov 
Reviewed-by: Thomas Gleixner 
Signed-off-by: K. Y. Srinivasan 
---
 kernel/cpu.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 1225fc2..18f00ae 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -194,6 +194,7 @@ void cpu_hotplug_disable(void)
cpu_hotplug_disabled++;
cpu_maps_update_done();
 }
+EXPORT_SYMBOL_GPL(cpu_hotplug_disable);
 
 void cpu_hotplug_enable(void)
 {
@@ -201,7 +202,7 @@ void cpu_hotplug_enable(void)
WARN_ON(--cpu_hotplug_disabled < 0);
cpu_maps_update_done();
 }
-
+EXPORT_SYMBOL_GPL(cpu_hotplug_enable);
 #endif /* CONFIG_HOTPLUG_CPU */
 
 /* Need to know about CPUs going up/down? */
-- 
1.7.4.1

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


[PATCH V7 0/4] Drivers: hv: vmbus: use cpu_hotplug_enable/disable for CPU offlining prevention

2015-07-23 Thread K. Y. Srinivasan
Changes since v6:
- Rearrange patches. [Thomas Gleixner]
- Fix a typo in PATCH 2 description [Thomas Gleixner].
- Add Reviewed-by: [Thomas Gleixner].

Changes since v5:
- Split PATCH 1 into two (PATCH 1/3 and 3/3), rewrite changelogs. [Thomas
  Gleixner]

Changes since v4:
- In disable_nonboot_cpus() do cpu_hotplug_disabled++ unconditionally as
  its users are doing enable_nonboot_cpus() on their failure paths.

Changes since v3:
- add WARN_ON when decreasing cpu_hotplug_disabled [Peter Zijlstra]

Changes since v2:
- Rebase on top of current Greg's char-misc-next tree [K. Y. Srinivasan]

Changes since v1:
- Make cpu_hotplug_disabled a counter [Radim Kr.má

Export cpu_hotplug_enable/cpu_hotplug_disable functions from cpu.c and use
them instead of altering smp_ops.cpu_disable in Hyper-V vmbus module.

Dexuan Cui (1):
  Tools: hv: kvp: fix a build warning -Wformat-security

Vitaly Kuznetsov (3):
  cpu-hotplug: convert cpu_hotplug_disabled to a counter
  cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable
  Drivers: hv: vmbus: use cpu_hotplug_enable/disable

 Documentation/power/suspend-and-cpuhotplug.txt |6 ++--
 drivers/hv/vmbus_drv.c |   38 ++-
 kernel/cpu.c   |   24 +-
 tools/hv/hv_kvp_daemon.c   |2 +-
 4 files changed, 23 insertions(+), 47 deletions(-)

-- 
1.7.4.1

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


[PATCH V7 1/4] cpu-hotplug: convert cpu_hotplug_disabled to a counter

2015-07-23 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov 

As a prerequisite to exporting cpu_hotplug_enable/cpu_hotplug_disable
functions to modules we need to convert cpu_hotplug_disabled to a counter
to properly support disable -> disable -> enable call sequences. E.g.
after Hyper-V vmbus module (which is supposed to be the first user of
exported cpu_hotplug_enable/cpu_hotplug_disable) did cpu_hotplug_disable()
hibernate path calls disable_nonboot_cpus() and if we hit an error in
_cpu_down() enable_nonboot_cpus() will be called on the failure path (thus
making cpu_hotplug_disabled = 0 and leaving cpu hotplug in 'enabled'
state). Same problem is possible if more than 1 module use
cpu_hotplug_disable/cpu_hotplug_enable on their load/unload paths. When
one of these modules is been unloaded it is logical to leave cpu hotplug
in 'disabled' state.

To support the change we need to increse cpu_hotplug_disabled counter
in disable_nonboot_cpus() unconditionally as all users of
disable_nonboot_cpus() are supposed to do enable_nonboot_cpus() in case
an error was returned.

Signed-off-by: Vitaly Kuznetsov 
Reviewed-by: Thomas Gleixner 
Signed-off-by: K. Y. Srinivasan 
---
 Documentation/power/suspend-and-cpuhotplug.txt |6 +++---
 kernel/cpu.c   |   21 +
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Documentation/power/suspend-and-cpuhotplug.txt 
b/Documentation/power/suspend-and-cpuhotplug.txt
index 2850df3..2fc9095 100644
--- a/Documentation/power/suspend-and-cpuhotplug.txt
+++ b/Documentation/power/suspend-and-cpuhotplug.txt
@@ -72,7 +72,7 @@ More details follow:
 |
 v
Disable regular cpu hotplug
-by setting cpu_hotplug_disabled=1
+by increasing cpu_hotplug_disabled
 |
 v
 Release cpu_add_remove_lock
@@ -89,7 +89,7 @@ Resuming back is likewise, with the counterparts being (in 
the order of
 execution during resume):
 * enable_nonboot_cpus() which involves:
|  Acquire cpu_add_remove_lock
-   |  Reset cpu_hotplug_disabled to 0, thereby enabling regular cpu hotplug
+   |  Decrease cpu_hotplug_disabled, thereby enabling regular cpu hotplug
|  Call _cpu_up() [for all those cpus in the frozen_cpus mask, in a loop]
|  Release cpu_add_remove_lock
v
@@ -120,7 +120,7 @@ after the entire cycle is complete (i.e., suspend + resume).
Acquire cpu_add_remove_lock
 |
 v
-  If cpu_hotplug_disabled is 1
+  If cpu_hotplug_disabled > 0
 return gracefully
 |
 |
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 6a37454..1225fc2 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -191,14 +191,14 @@ void cpu_hotplug_done(void)
 void cpu_hotplug_disable(void)
 {
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 1;
+   cpu_hotplug_disabled++;
cpu_maps_update_done();
 }
 
 void cpu_hotplug_enable(void)
 {
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 0;
+   WARN_ON(--cpu_hotplug_disabled < 0);
cpu_maps_update_done();
 }
 
@@ -617,13 +617,18 @@ int disable_nonboot_cpus(void)
}
}
 
-   if (!error) {
+   if (!error)
BUG_ON(num_online_cpus() > 1);
-   /* Make sure the CPUs won't be enabled by someone else */
-   cpu_hotplug_disabled = 1;
-   } else {
+   else
pr_err("Non-boot CPUs are not disabled\n");
-   }
+
+   /*
+* Make sure the CPUs won't be enabled by someone else. We need to do
+* this even in case of failure as all disable_nonboot_cpus() users are
+* supposed to do enable_nonboot_cpus() on the failure path.
+*/
+   cpu_hotplug_disabled++;
+
cpu_maps_update_done();
return error;
 }
@@ -642,7 +647,7 @@ void __ref enable_nonboot_cpus(void)
 
/* Allow everyone to use the CPU hotplug again */
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 0;
+   WARN_ON(--cpu_hotplug_disabled < 0);
if (cpumask_empty(frozen_cpus))
goto out;
 
-- 
1.7.4.1

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


[PATCH 4/4] Tools: hv: kvp: fix a build warning -Wformat-security

2015-07-23 Thread K. Y. Srinivasan
From: Dexuan Cui 

It is to fix:
hv_kvp_daemon.c:705:2: warning: format not a string literal and no format 
arguments [-Wformat-security]

Signed-off-by: Dexuan Cui 
Signed-off-by: K. Y. Srinivasan 
---
 tools/hv/hv_kvp_daemon.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 0d9f48e..f9d5089 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -702,7 +702,7 @@ static char *kvp_mac_to_if_name(char *mac)
if (dir == NULL)
return NULL;
 
-   snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
+   snprintf(dev_id, sizeof(dev_id), "%s", kvp_net_dir);
q = dev_id + strlen(kvp_net_dir);
 
while ((entry = readdir(dir)) != NULL) {
-- 
1.7.4.1

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


[PATCH V7 3/4] Drivers: hv: vmbus: use cpu_hotplug_enable/disable

2015-07-23 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov 

Commit e513229b4c38 ("Drivers: hv: vmbus: prevent cpu offlining on newer
hypervisors") was altering smp_ops.cpu_disable to prevent CPU offlining.
We can bo better by using cpu_hotplug_enable/disable functions instead of
such hard-coding.

Reported-by: Radim Kr.má< 
Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/vmbus_drv.c |   38 --
 1 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index cf20400..6de65fb 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -763,38 +763,6 @@ static void vmbus_isr(void)
}
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-static int hyperv_cpu_disable(void)
-{
-   return -ENOSYS;
-}
-
-static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
-{
-   static void *previous_cpu_disable;
-
-   /*
-* Offlining a CPU when running on newer hypervisors (WS2012R2, Win8,
-* ...) is not supported at this moment as channel interrupts are
-* distributed across all of them.
-*/
-
-   if ((vmbus_proto_version == VERSION_WS2008) ||
-   (vmbus_proto_version == VERSION_WIN7))
-   return;
-
-   if (vmbus_loaded) {
-   previous_cpu_disable = smp_ops.cpu_disable;
-   smp_ops.cpu_disable = hyperv_cpu_disable;
-   pr_notice("CPU offlining is not supported by hypervisor\n");
-   } else if (previous_cpu_disable)
-   smp_ops.cpu_disable = previous_cpu_disable;
-}
-#else
-static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
-{
-}
-#endif
 
 /*
  * vmbus_bus_init -Main vmbus driver initialization routine.
@@ -836,7 +804,8 @@ static int vmbus_bus_init(int irq)
if (ret)
goto err_alloc;
 
-   hv_cpu_hotplug_quirk(true);
+   if (vmbus_proto_version > VERSION_WIN7)
+   cpu_hotplug_disable();
 
/*
 * Only register if the crash MSRs are available
@@ -1121,7 +1090,8 @@ static void __exit vmbus_exit(void)
smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
}
acpi_bus_unregister_driver(&vmbus_acpi_driver);
-   hv_cpu_hotplug_quirk(false);
+   if (vmbus_proto_version > VERSION_WIN7)
+   cpu_hotplug_enable();
 }
 
 
-- 
1.7.4.1

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


[PATCH 2/6] staging: comedi: usbduxsigma: don't clobber ao_timer in command test

2015-07-23 Thread Ian Abbott
`devpriv->ao_timer` is used while an asynchronous command is running on
the AO subdevice.  It also gets modified by the subdevice's `cmdtest`
handler for checking new asynchronous commands,
`usbduxsigma_ao_cmdtest()`, which is not correct as it's allowed to
check new commands while an old command is still running.  Fix it by
moving the code which sets up `devpriv->ao_timer` into the subdevice's
`cmd` handler, `usbduxsigma_ao_cmd()`.

Note that the removed code in `usbduxsigma_ao_cmdtest()` checked that
`devpriv->ao_timer` did not end up less that 1, but that could not
happen due because `cmd->scan_begin_arg` or `cmd->convert_arg` had
already been range-checked.

Also note that we tested the `high_speed` variable in the old code, but
that is currently always 0 and means that we always use "scan" timing
(`cmd->scan_begin_src == TRIG_TIMER` and `cmd->convert_src == TRIG_NOW`)
and never "convert" (individual sample) timing (`cmd->scan_begin_src ==
TRIG_FOLLOW` and `cmd->convert_src == TRIG_TIMER`).  The moved code
tests `cmd->convert_src` instead to decide whether "scan" or "convert"
timing is being used, although currently only "scan" timing is
supported.

Fixes: fb1ef622e7a3 ("staging: comedi: usbduxsigma: tidy up analog output 
command support")
Signed-off-by: Ian Abbott 
Cc:  # 3.19 onwards
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 33 
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 22517de..dc0b25a 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -912,25 +912,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device 
*dev,
if (err)
return 3;
 
-   /* Step 4: fix up any arguments */
-
-   /* we count in timer steps */
-   if (high_speed) {
-   /* timing of the conversion itself: every 125 us */
-   devpriv->ao_timer = cmd->convert_arg / 125000;
-   } else {
-   /*
-* timing of the scan: every 1ms
-* we get all channels at once
-*/
-   devpriv->ao_timer = cmd->scan_begin_arg / 100;
-   }
-   if (devpriv->ao_timer < 1)
-   err |= -EINVAL;
-
-   if (err)
-   return 4;
-
return 0;
 }
 
@@ -943,6 +924,20 @@ static int usbduxsigma_ao_cmd(struct comedi_device *dev,
 
down(&devpriv->sem);
 
+   if (cmd->convert_src == TRIG_TIMER) {
+   /*
+* timing of the conversion itself: every 125 us
+* at high speed (not used yet)
+*/
+   devpriv->ao_timer = cmd->convert_arg / 125000;
+   } else {
+   /*
+* timing of the scan: every 1ms
+* we get all channels at once
+*/
+   devpriv->ao_timer = cmd->scan_begin_arg / 100;
+   }
+
devpriv->ao_counter = devpriv->ao_timer;
 
if (cmd->start_src == TRIG_NOW) {
-- 
2.1.4

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


[PATCH 1/6] staging: comedi: usbduxsigma: don't clobber ai_timer in command test

2015-07-23 Thread Ian Abbott
`devpriv->ai_timer` is used while an asynchronous command is running on
the AI subdevice.  It also gets modified by the subdevice's `cmdtest`
handler for checking new asynchronous commands
(`usbduxsigma_ai_cmdtest()`), which is not correct as it's allowed to
check new commands while an old command is still running.  Fix it by
moving the code which sets up `devpriv->ai_timer` and
`devpriv->ai_interval` into the subdevice's `cmd` handler,
`usbduxsigma_ai_cmd()`.

Note that the removed code in `usbduxsigma_ai_cmdtest()` checked that
`devpriv->ai_timer` did not end up less than than 1, but that could not
happen because `cmd->scan_begin_arg` had already been checked to be at
least the minimum required value (at least when `cmd->scan_begin_src ==
TRIG_TIMER`, which had also been checked to be the case).

Fixes: b986be8527c7 ("staging: comedi: usbduxsigma: tidy up analog input 
command support)
Signed-off-by: Ian Abbott 
Cc:  # 3.19 onwards
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 37 
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index eaa9add..22517de 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -550,27 +550,6 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device 
*dev,
if (err)
return 3;
 
-   /* Step 4: fix up any arguments */
-
-   if (high_speed) {
-   /*
-* every 2 channels get a time window of 125us. Thus, if we
-* sample all 16 channels we need 1ms. If we sample only one
-* channel we need only 125us
-*/
-   devpriv->ai_interval = interval;
-   devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval);
-   } else {
-   /* interval always 1ms */
-   devpriv->ai_interval = 1;
-   devpriv->ai_timer = cmd->scan_begin_arg / 100;
-   }
-   if (devpriv->ai_timer < 1)
-   err |= -EINVAL;
-
-   if (err)
-   return 4;
-
return 0;
 }
 
@@ -668,6 +647,22 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev,
 
down(&devpriv->sem);
 
+   if (devpriv->high_speed) {
+   /*
+* every 2 channels get a time window of 125us. Thus, if we
+* sample all 16 channels we need 1ms. If we sample only one
+* channel we need only 125us
+*/
+   unsigned int interval = usbduxsigma_chans_to_interval(len);
+
+   devpriv->ai_interval = interval;
+   devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval);
+   } else {
+   /* interval always 1ms */
+   devpriv->ai_interval = 1;
+   devpriv->ai_timer = cmd->scan_begin_arg / 100;
+   }
+
for (i = 0; i < len; i++) {
unsigned int chan  = CR_CHAN(cmd->chanlist[i]);
 
-- 
2.1.4

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


[PATCH 4/6] staging: comedi: usbduxsigma: round down AI scan_begin_arg at step 4.

2015-07-23 Thread Ian Abbott
The return value of the `cmdtest` handler for a subdevice checks the
prospective new command in various steps and returns the step number at
which any problem was detected, or 0 if no problem was detected.  It is
allowed to modify the command in various ways at each step.  Corrections
for out-of-range values are generally made at step 3, and minor
adjustments such as rounding are generally made at step 4.

The `cmdtest` handler for the AI subdevice (`usbduxsigma_ai_cmdtest()`)
currently modifies `cmd->scan_begin_arg` to bring it into range and
round it down at step 3.  Move the rounding down part to step 4 to
follow the usual Comedi convention.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 65a0df4..4655048 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -518,17 +518,12 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device 
*dev,
 */
err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
(125000 * interval));
-
-   tmp = (cmd->scan_begin_arg / 125000) * 125000;
} else {
/* full speed */
/* 1kHz scans every USB frame */
err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
100);
-
-   tmp = (cmd->scan_begin_arg / 100) * 100;
}
-   err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp);
 
err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
   cmd->chanlist_len);
@@ -541,6 +536,14 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device 
*dev,
if (err)
return 3;
 
+   /* Step 4: fix up any arguments */
+
+   tmp = rounddown(cmd->scan_begin_arg, high_speed ? 125000 : 100);
+   err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp);
+
+   if (err)
+   return 4;
+
return 0;
 }
 
-- 
2.1.4

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


[PATCH 3/6] staging: comedi: usbduxsigma: remove AI scan_begin_src == TRIG_FOLLOW

2015-07-23 Thread Ian Abbott
The AI subdevice `cmdtest` handler `usbduxsigma_ai_cmdtest()` ensures
that `cmd->scan_begin_src == TRIG_TIMER` by the end of step 2 of the
command checking code, so assume that this is the case for step 3
onwards and remove the redundant code.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 47 +++-
 1 file changed, 19 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index dc0b25a..65a0df4 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -481,6 +481,7 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev,
struct usbduxsigma_private *devpriv = dev->private;
int high_speed = devpriv->high_speed;
int interval = usbduxsigma_chans_to_interval(cmd->chanlist_len);
+   unsigned int tmp;
int err = 0;
 
/* Step 1 : check if triggers are trivially valid */
@@ -508,36 +509,26 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device 
*dev,
 
err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0);
 
-   if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */
-   err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
+   if (high_speed) {
+   /*
+* In high speed mode microframes are possible.
+* However, during one microframe we can roughly
+* sample two channels. Thus, the more channels
+* are in the channel list the more time we need.
+*/
+   err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
+   (125000 * interval));
 
-   if (cmd->scan_begin_src == TRIG_TIMER) {
-   unsigned int tmp;
-
-   if (high_speed) {
-   /*
-* In high speed mode microframes are possible.
-* However, during one microframe we can roughly
-* sample two channels. Thus, the more channels
-* are in the channel list the more time we need.
-*/
-   err |= comedi_check_trigger_arg_min(&cmd->
-   scan_begin_arg,
-   (100 / 8 *
-interval));
-
-   tmp = (cmd->scan_begin_arg / 125000) * 125000;
-   } else {
-   /* full speed */
-   /* 1kHz scans every USB frame */
-   err |= comedi_check_trigger_arg_min(&cmd->
-   scan_begin_arg,
-   100);
-
-   tmp = (cmd->scan_begin_arg / 100) * 100;
-   }
-   err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp);
+   tmp = (cmd->scan_begin_arg / 125000) * 125000;
+   } else {
+   /* full speed */
+   /* 1kHz scans every USB frame */
+   err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
+   100);
+
+   tmp = (cmd->scan_begin_arg / 100) * 100;
}
+   err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp);
 
err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
   cmd->chanlist_len);
-- 
2.1.4

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


[PATCH 0/6] staging: comedi: usbduxsigma: fix some problems in command handling

2015-07-23 Thread Ian Abbott
Fix some minor problems in the testing of asynchronous commands for the AI
and AO subdevices and remove some redundant code.

The main problem is that the testing of a new command can affect the
operation of an already running command, which it isn't supposed to do.  (In
practice, applications don't tend to test new commands while a command is
running on the same subdevice, so the bug can be classed as minor.)  This is
corrected by the patches 1 and 2, for the AI and AO subdevices,
respectively.

1) staging: comedi: usbduxsigma: don't clobber ai_timer in command test
2) staging: comedi: usbduxsigma: don't clobber ao_timer in command test
3) staging: comedi: usbduxsigma: remove AI scan_begin_src == TRIG_FOLLOW
4) staging: comedi: usbduxsigma: round down AI scan_begin_arg at step 4.
5) staging: comedi: usbduxsigma: remove unused "convert" timing for AO
6) staging: comedi: usbduxsigma: round down AO scan_begin_arg at step 4.

 drivers/staging/comedi/drivers/usbduxsigma.c | 139 +++
 1 file changed, 54 insertions(+), 85 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/6] staging: comedi: usbduxsigma: remove unused "convert" timing for AO

2015-07-23 Thread Ian Abbott
The `cmdtest` and `cmd` handlers for the AO subdevice
(`usbduxsigma_ao_cmdtest()` and `usbduxsigma_ao_cmd()`) support "scan"
timing of commands with all channels updated every "scan" period.  There
is some disabled code to use "convert" timing in high speed mode.  That
would allow channels to be updated sequentially every "convert" period.
Since that code is incomplete and currently disabled, remove it to
simplify the existing code.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 58 
 1 file changed, 17 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 4655048..d97253e 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -838,28 +838,20 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device 
*dev,
 {
struct usbduxsigma_private *devpriv = dev->private;
int err = 0;
-   int high_speed;
-   unsigned int flags;
-
-   /* high speed conversions are not used yet */
-   high_speed = 0; /* (devpriv->high_speed) */
 
/* Step 1 : check if triggers are trivially valid */
 
err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT);
 
-   if (high_speed) {
-   /*
-* start immediately a new scan
-* the sampling rate is set by the coversion rate
-*/
-   flags = TRIG_FOLLOW;
-   } else {
-   /* start a new scan (output at once) with a timer */
-   flags = TRIG_TIMER;
-   }
-   err |= comedi_check_trigger_src(&cmd->scan_begin_src, flags);
-
+   /*
+* For now, always use "scan" timing with all channels updated at once
+* (cmd->scan_begin_src == TRIG_TIMER, cmd->convert_src == TRIG_NOW).
+*
+* In a future version, "convert" timing with channels updated
+* indivually may be supported in high speed mode
+* (cmd->scan_begin_src == TRIG_FOLLOW, cmd->convert_src == TRIG_TIMER).
+*/
+   err |= comedi_check_trigger_src(&cmd->scan_begin_src, TRIG_TIMER);
err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_NOW);
err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);
@@ -883,17 +875,7 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device 
*dev,
 
err |= comedi_check_trigger_arg_is(&cmd->start_arg, 0);
 
-   if (cmd->scan_begin_src == TRIG_FOLLOW) /* internal trigger */
-   err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
-
-   if (cmd->scan_begin_src == TRIG_TIMER) {
-   err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
-   100);
-   }
-
-   /* not used now, is for later use */
-   if (cmd->convert_src == TRIG_TIMER)
-   err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 125000);
+   err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, 100);
 
err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg,
   cmd->chanlist_len);
@@ -918,19 +900,13 @@ static int usbduxsigma_ao_cmd(struct comedi_device *dev,
 
down(&devpriv->sem);
 
-   if (cmd->convert_src == TRIG_TIMER) {
-   /*
-* timing of the conversion itself: every 125 us
-* at high speed (not used yet)
-*/
-   devpriv->ao_timer = cmd->convert_arg / 125000;
-   } else {
-   /*
-* timing of the scan: every 1ms
-* we get all channels at once
-*/
-   devpriv->ao_timer = cmd->scan_begin_arg / 100;
-   }
+   /*
+* For now, only "scan" timing is supported.  A future version may
+* support "convert" timing in high speed mode.
+*
+* Timing of the scan: every 1ms all channels updated at once.
+*/
+   devpriv->ao_timer = cmd->scan_begin_arg / 100;
 
devpriv->ao_counter = devpriv->ao_timer;
 
-- 
2.1.4

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


[PATCH 6/6] staging: comedi: usbduxsigma: round down AO scan_begin_arg at step 4.

2015-07-23 Thread Ian Abbott
The return value of the `cmdtest` handler for a subdevice checks the
prospective new command in various steps and returns the step number at
which any problem was detected, or 0 if no problem was detected.  It is
allowed to modify the command in various ways at each step.  Corrections
for out-of-range values are generally made at step 3, and minor
adjustments such as rounding are generally made at step 4.

The `cmdtest` handler for the AO subdevice (`usbduxsigma_ao_cmdtest()`)
currently range checks the timings at step 3.  Since the running command
will round down the timings, add code to round them down at step 4.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index d97253e..e22c374 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -837,6 +837,7 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,
  struct comedi_cmd *cmd)
 {
struct usbduxsigma_private *devpriv = dev->private;
+   unsigned int tmp;
int err = 0;
 
/* Step 1 : check if triggers are trivially valid */
@@ -888,6 +889,14 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device 
*dev,
if (err)
return 3;
 
+   /* Step 4: fix up any arguments */
+
+   tmp = rounddown(cmd->scan_begin_arg, 100);
+   err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, tmp);
+
+   if (err)
+   return 4;
+
return 0;
 }
 
-- 
2.1.4

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


Re: [PATCH v9 5/7] staging: fpga manager core

2015-07-23 Thread atull
On Wed, 22 Jul 2015, Moritz Fischer wrote:

Hi Miritz,

> Hi Alan,
> 
> a couple of small things I found while reworking the Zynq version to
> match the v9 patchset:
> 
> On Fri, Jul 17, 2015 at 8:51 AM,   wrote:
> > From: Alan Tull 
> >
...
> > +   ret = mgr->mops->write_complete(mgr);
> 
> Could we pass in flags here? This way the driver wouldn't have to keep
> track of the flags. For my case it would simplify the partial reconfig
> case.

Yes, that change will be very simple and makes sense to me.

> > +/*
> > + * FPGA Manager flags
> > + * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
> > + */
> > +#define FPGA_MGR_PARTIAL_RECONFIG (1)
> Could this be BIT(0) instead?

Yes, ha.  That's what it should have been.

> > +
> > +/**
> > + * struct fpga_manager_ops - ops for low level fpga manager drivers
> > + * @state: returns an enum value of the FPGA's state
> > + * @write_init: prepare the FPGA to receive confuration data
> > + * @write: write count bytes of configuration data to the FPGA
> > + * @write_complete: set FPGA to operating state after writing is done
> > + * @fpga_remove: optional: Set FPGA into a specific state during driver 
> > remove
> > + *
> > + * fpga_manager_ops are the low level functions implemented by a specific
> > + * fpga manager driver.  The optional ones are tested for NULL before being
> > + * called, so leaving them out is fine.
> > + */
> > +struct fpga_manager_ops {
> > +   enum fpga_mgr_states (*state)(struct fpga_manager *mgr);
> > +   int (*write_init)(struct fpga_manager *mgr, u32 flags,
> > + const char *buf, size_t count);
> > +   int (*write)(struct fpga_manager *mgr, const char *buf, size_t 
> > count);
> > +   int (*write_complete)(struct fpga_manager *mgr);
> See comment above, having the flags here would be very convenient for
> my usecase.

Yes

> > +   void (*fpga_remove)(struct fpga_manager *mgr);
> > +};
> > +
...
> 
> Overall looks pretty good. I still need to look at the bridge part,
> currently I have the resets and level shifters in the zynq-fpga
> driver,
> but maybe breaking them out makes sense.
> 
> Cheers,
> 
> Moritz
> 

Thanks for the review.  I'll probably send out a v10 next week including your
recommendations.

Alan

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


Re: [PATCH v9 0/7] FPGA Manager Framework and Simple FPGA Bus

2015-07-23 Thread atull
On Thu, 23 Jul 2015, Greg KH wrote:

> On Fri, Jul 17, 2015 at 10:51:10AM -0500, at...@opensource.altera.com wrote:
> > From: Alan Tull 
> > 
> > This patchset adds two chunks plus documentation:
> >  * fpga manager core: exports ABI functions that write an image to a FPGA
> >  * DT Overlay support: simple-fpga-bus to handle FPGA from a DT overlay
> > 
> > The core's ABI is minimal to start with: only 6 functions.  This gives a
> > common interface for programming various FPGA such that any higher level
> > interfaces such as the DT Overlays or anything else that is added can be
> > shared and not be manufacturor-specific.
> > 
> > The DT Overlays support exists for the usage where the FPGA will contain
> > some "hardware" that will need drivers.  Where that use model is not
> > appealing, the core ABI can be used to add a different use model such as
> > using an FPGA as acceleration as has been discussed.
> > 
> > This patchset gets rid of the sysfs controls that allowed direct
> > control of a FPGA from userspace.
> > 
> > This patchset is under drivers/staging as the interface could change.
> > 
> > The bindings for the socpfga fpga manager already are upstreamed as
> > 1b4e119 Alan Tull : doc: add bindings document for altera fpga manager
> > 
> > The DT Support is dependent on Pantelis's dtc overlay patches from
> > https://github.com/pantoniou/dtc.git
> > and his DT overlays configfs interface patches and fixes from
> > https://github.com/pantoniou/linux-beagle-track-mainline
> > 
> > efb0c04 Pantelis Antoniou : gcl: Fix resource linking
> > 85e785e Pantelis Antoniou : ARM: DT: Enable symbols when CONFIG_OF_OVERLAY 
> > is used
> > af0321f Pantelis Antoniou : OF: DT-Overlay configfs interface (v5)
> > 4c1c675 Pantelis Antoniou : configfs: Implement binary attributes (v4)
> > 
> > 
> > Alan Tull (7):
> >   staging: usage documentation for FPGA manager core
> >   staging: usage documentation for simple fpga bus
> >   staging: add bindings document for simple fpga bus
> >   staging: fpga manager: add sysfs interface document
> >   staging: fpga manager core
> >   staging: add simple-fpga-bus
> >   staging: fpga manager: add driver for socfpga fpga manager
> > 
> >  drivers/staging/Kconfig|2 +
> >  drivers/staging/Makefile   |1 +
> >  .../Documentation/ABI/sysfs-class-fpga-manager |   26 +
> >  .../Documentation/bindings/simple-fpga-bus.txt |   61 ++
> >  drivers/staging/fpga/Documentation/fpga-mgr.txt|  117 
> >  .../staging/fpga/Documentation/simple-fpga-bus.txt |   48 ++
> >  drivers/staging/fpga/Kconfig   |   31 +
> >  drivers/staging/fpga/Makefile  |   10 +
> >  drivers/staging/fpga/fpga-mgr.c|  373 
> >  drivers/staging/fpga/simple-fpga-bus.c |  323 ++
> >  drivers/staging/fpga/socfpga.c |  616 
> > 
> 
> All drivers/staging/*/ directories need a TODO file that lists what
> needs to be done to it in order to get the code out of staging.  Please
> redo the series and add that.
> 
> >  include/linux/fpga/fpga-mgr.h  |  127 
> 
> This should be within drivers/staging/ all staging code should be
> self-contained.
> 
> Why isn't this going into the "real" part of the kernel?  Why staging?
> 

Hi Greg,

For v10 next week, I will likely break this into two patchsets, one for the
real kernel (drivers/fpga) and one for staging.

fpga-mgr.c can go into drivers/fpga since both Xilinx and Altera have
already been using this code.  It's not likely to change much.

The part that should go into staging is whatever interface is
controversial, that may change.  That's simple-fpga-bus.c and any
other interfaces that get added that use the functions exported by
fpga-mgr.c.  Maybe this 2nd patch set should be a RFC since it is still
dependent on some of Pantelis' stuff that's not in yet.

Alan Tull

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


Re: [PATCH 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

2015-07-23 Thread Joe Perches
On Thu, 2015-07-23 at 20:19 +0900, Chaehyun Lim wrote:
> Add error check if memory allocation is failed.

trivia:

> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
[]
> @@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
> **ppstrNetworkInfo)
>   u32 u32Tsf_Hi;
>  
>   pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);
> + if (pstrNetworkInfo == NULL)
> + return -ENOMEM;
> +
>   WILC_memset((void *)(pstrNetworkInfo), 0, 
> sizeof(tstrNetworkInfo));
>  
>   pstrNetworkInfo->s8rssi = pu8WidVal[0];
> @@ -863,6 +866,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
> **ppstrNetworkInfo)
>  
>   if (u16IEsLen > 0) {
>   pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
> GFP_ATOMIC);
> + if (pstrNetworkInfo->pu8IEs == NULL)
> + return -ENOMEM;
> +
>   WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
> u16IEsLen);
>  
>   WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
> @@ -930,6 +936,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
>   u16 u16IEsLen = 0;
>  
>   pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_ATOMIC);
> + if (pstrConnectRespInfo == NULL)
> + return -ENOMEM;
> +
>   WILC_memset((void *)(pstrConnectRespInfo), 0, 
> sizeof(tstrConnectRespInfo));
>  
>   /* u16AssocRespLen = pu8Buffer[0]; */

These could use kzalloc

> @@ -950,6 +959,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
>   u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
> AID_LEN);
>  
>   pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
> GFP_ATOMIC);
> + if (pstrConnectRespInfo->pu8RespIEs == NULL)
> + return -ENOMEM;
> +
>   WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
> u16IEsLen);
>  
>   WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);

And this one could use kmemdup


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


Re: [PATCH] staging: rtl8188eu: kill unused hal_data_8188e::fw_ractrl flag

2015-07-23 Thread Jakub Sitnicki
On Thu, Jun 18, 2015 at 08:31 AM CEST, Jakub Sitnicki  
wrote:
> Flag is never set. Remove it and the code that is dead because of it.
>
> Signed-off-by: Jakub Sitnicki 
> ---

Looks like this patch got lost in the noise.  It still applies & builds.

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


Re: [PATCH] staging: rtl8188eu: don't duplicate ieee80211 WLAN_EID_* constants

2015-07-23 Thread Jakub Sitnicki
On Wed, Jun 24, 2015 at 07:23 AM CEST, Jakub Sitnicki  
wrote:
> linux/ieee80211.h already defines constants for information element IDs.
> Include it where needed, resolve discrepancies in naming, and remove the
> duplicated definitions.
>
> While at it, wrap a line that was too long and remove extra parentheses
> in an expression that mixes only equality and logical operators.
>
> Signed-off-by: Jakub Sitnicki 
> ---

Looks like this patch got lost in the noise.  It still applies & builds.

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


Re: [PATCH v2 00/19] Update ALSA, and au0828 drivers to use Managed Media Controller API

2015-07-23 Thread Shuah Khan
On 07/22/2015 04:42 PM, Shuah Khan wrote:
> This patch series updates ALSA driver, and au0828 core driver to
> use Managed Media controller API to share tuner. Please note that
> Managed Media Controller API and DVB and V4L2 drivers updates to
> use Media Controller API have been added in a prior patch series.
> 
> Media Controller API is enhanced with two new interfaces to
> register and unregister entity_notify hooks to allow drivers
> to take appropriate actions when as new entities get added to
> the shared media device.
> 
> Tested exclusion between digital, analog, and audio to ensure
> when tuner has an active link to DVB FE, analog, and audio will
> detect and honor the tuner busy conditions and vice versa.
> 
> Changes since v1:
> Link to v1: http://www.spinics.net/lists/linux-media/msg91697.html

I uploaded this patch series to my linux.git media_controller branch
on kernel.org:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git
media_controller branch

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8188eu: kill unused hal_data_8188e::fw_ractrl flag

2015-07-23 Thread Greg Kroah-Hartman
On Thu, Jul 23, 2015 at 08:10:07PM +0200, Jakub Sitnicki wrote:
> On Thu, Jun 18, 2015 at 08:31 AM CEST, Jakub Sitnicki  
> wrote:
> > Flag is never set. Remove it and the code that is dead because of it.
> >
> > Signed-off-by: Jakub Sitnicki 
> > ---
> 
> Looks like this patch got lost in the noise.  It still applies & builds.

Please resend it, I don't have it in my queue at all.

thanks,

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


Re: [PATCH] staging: rtl8188eu: don't duplicate ieee80211 WLAN_EID_* constants

2015-07-23 Thread Greg Kroah-Hartman
On Thu, Jul 23, 2015 at 08:11:03PM +0200, Jakub Sitnicki wrote:
> On Wed, Jun 24, 2015 at 07:23 AM CEST, Jakub Sitnicki  
> wrote:
> > linux/ieee80211.h already defines constants for information element IDs.
> > Include it where needed, resolve discrepancies in naming, and remove the
> > duplicated definitions.
> >
> > While at it, wrap a line that was too long and remove extra parentheses
> > in an expression that mixes only equality and logical operators.
> >
> > Signed-off-by: Jakub Sitnicki 
> > ---
> 
> Looks like this patch got lost in the noise.  It still applies & builds.

Again, please resend, I don't have it in my queue anywhere.

thanks,

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


[PATCH] drivers: staging: rtl8188eu Refactored rtw_free_assoc_resources

2015-07-23 Thread Buţiu Alexandru Octavian
Refactored rtw_free_assoc_resources to avoid sparse warnings about
different contexts for basic lock

Signed-off-by: Buţiu Alexandru Octavian 
---
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 10 +-
 drivers/staging/rtl8188eu/core/rtw_mlme.c  | 24 
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c   |  2 +-
 drivers/staging/rtl8188eu/include/rtw_mlme.h   |  3 ++-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c |  2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c|  2 +-
 drivers/staging/rtl8188eu/os_dep/usb_intf.c|  2 +-
 7 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index 8c05cb0..22f5b45 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -183,7 +183,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
rtw_indicate_disconnect(padapter);
 
-   rtw_free_assoc_resources(padapter, 1);
+   rtw_free_assoc_resources(padapter);
 
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) 
== true)) {
_clr_fwstate_(pmlmepriv, 
WIFI_ADHOC_MASTER_STATE);
@@ -271,7 +271,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct 
ndis_802_11_ssid *ssid)
if (check_fwstate(pmlmepriv, 
_FW_LINKED) == true)

rtw_indicate_disconnect(padapter);
 
-   rtw_free_assoc_resources(padapter, 1);
+   rtw_free_assoc_resources(padapter);
 
if (check_fwstate(pmlmepriv, 
WIFI_ADHOC_MASTER_STATE) == true) {
_clr_fwstate_(pmlmepriv, 
WIFI_ADHOC_MASTER_STATE);
@@ -293,7 +293,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct 
ndis_802_11_ssid *ssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
rtw_indicate_disconnect(padapter);
 
-   rtw_free_assoc_resources(padapter, 1);
+   rtw_free_assoc_resources(padapter);
 
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) 
== true) {
_clr_fwstate_(pmlmepriv, 
WIFI_ADHOC_MASTER_STATE);
@@ -366,7 +366,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter 
*padapter,
 
if ((check_fwstate(pmlmepriv, _FW_LINKED)) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)))
-   rtw_free_assoc_resources(padapter, 1);
+   rtw_free_assoc_resources(padapter);
 
if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state 
== Ndis802_11IBSS)) {
if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
@@ -415,7 +415,7 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter)
 
rtw_disassoc_cmd(padapter, 0, true);
rtw_indicate_disconnect(padapter);
-   rtw_free_assoc_resources(padapter, 1);
+   rtw_free_assoc_resources(padapter);
rtw_pwr_wakeup(padapter);
}
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 2b599e3..71a7a85 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -704,7 +704,7 @@ void rtw_surveydone_event_callback(struct adapter   
*adapter, u8 *pbuf)
if (--pmlmepriv->to_roaming == 0 ||
_SUCCESS != 
rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) {
pmlmepriv->to_roaming = 0;
-   
rtw_free_assoc_resources(adapter, 1);
+   
rtw_free_assoc_resources(adapter);

rtw_indicate_disconnect(adapter);
} else {
pmlmepriv->to_join = true;
@@ -758,7 +758,19 @@ static void free_scanqueue(struct  mlme_priv *pmlmepriv)
 /*
 *rtw_free_assoc_resources: the caller has to lock pmlmepriv->lock
 */
-void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
+void rtw_free_assoc_resources(struct adapter *adapter)
+{
+   struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
+
+   spin_lock_bh(&pmlmepriv->scanned_queue.lock);
+   rtw_free_assoc_resources_locked(adapter);
+   spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
+}
+
+/*
+*rtw_free_assoc_resources_locked: the caller has to lock pml

Re: [PATCH 1/3] staging: wilc1000: coreconfigurator.c: remove WILC_MALLOC

2015-07-23 Thread Greg KH
On Thu, Jul 23, 2015 at 08:19:17PM +0900, Chaehyun Lim wrote:
> Use kmalloc and kmalloc_array instead of WILC_MALLOC.
> 
> Signed-off-by: Chaehyun Lim 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index b069614..7e2b2ab41 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -674,7 +674,7 @@ s32 CoreConfiguratorInit(void)
>   sema_init(&SemHandleSendPkt, 1);
>   sema_init(&SemHandlePktResp, 0);
>  
> - gps8ConfigPacket = (s8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
> + gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_ATOMIC);

I know this is what WILC_MALLOC() did, but should this really be
GFP_ATOMIC?

>   if (gps8ConfigPacket == NULL) {
>   PRINT_ER("failed in gps8ConfigPacket allocation\n");
>   s32Error = WILC_NO_MEM;
> @@ -811,7 +811,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
> **ppstrNetworkInfo)
>   u32 u32Tsf_Lo;
>   u32 u32Tsf_Hi;
>  
> - pstrNetworkInfo = (tstrNetworkInfo 
> *)WILC_MALLOC(sizeof(tstrNetworkInfo));
> + pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);

Same here.  And everywhere else you changed this code, please review and
resend.

thanks,

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


Re: [PATCH 1/5] Add blank line under variable declaration.

2015-07-23 Thread Greg KH
For all of these, you need a better subject line that shows what part of
the kernel you are modifying.

For example, this one would be:
Subject: [PATCH 1/5] staging: lustre: cl_page.c: add blank line after 
variable definition


On Thu, Jul 23, 2015 at 02:21:10PM +0800, Incarnation P. Lee wrote:
> Signed-off-by: Incarnation P. Lee 
> 

We need a changelog entry, it can't be blank.

And I need a hint of "real" name here, is "Incarnation P. Lee" how you
sign legal documents?

thanks,

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


Re: [PATCH v9 6/7] staging: add simple-fpga-bus

2015-07-23 Thread Moritz Fischer
Hi Alan,

I saw that your socfpga driver doesn't support the partial reconfig
use case (not a big deal).
What I currently do for Zynq is if I'm doing a non-partial reconfig is
that I disable input
level shifters and assert *all* resets while reprogramming in my FPGA
manager .write_init() and .write_complete().
For a partial reconfig use case that obviously doesn't work, since I
don't want to
bring down the entire interconnect.
In a partial reconfiguration situation, would I have separate simple-fpga buses
for each of the parts that I swap out, each with it's own reset and
bitfile attached?

On Fri, Jul 17, 2015 at 8:51 AM,   wrote:
> From: Alan Tull 
>
> Add simple fpga bus.  This is a bus that configures an fpga and its
> bridges before populating the devices below it.  This is intended
> for use with device tree overlays.
>
> Note that FPGA bridges are seen as reset controllers so no special
> framework for FPGA bridges will need to be added.
>
> This supports fpga use where hardware blocks on a fpga will need
> drivers (as opposed to fpga used as an acceleration without drivers.)
>
> Signed-off-by: Alan Tull 
> ---
>  drivers/staging/fpga/Kconfig   |   11 ++
>  drivers/staging/fpga/Makefile  |1 +
>  drivers/staging/fpga/simple-fpga-bus.c |  323 
> 
>  3 files changed, 335 insertions(+)
>  create mode 100644 drivers/staging/fpga/simple-fpga-bus.c
>
> diff --git a/drivers/staging/fpga/Kconfig b/drivers/staging/fpga/Kconfig
> index 8254ca0..8d003e3 100644
> --- a/drivers/staging/fpga/Kconfig
> +++ b/drivers/staging/fpga/Kconfig
> @@ -11,4 +11,15 @@ config FPGA
>   kernel.  The FPGA framework adds a FPGA manager class and FPGA
>   manager drivers.
>
> +if FPGA
> +
> +config SIMPLE_FPGA_BUS
> +   bool "Simple FPGA Bus"
> +   depends on OF
> +   help
> + Simple FPGA Bus allows loading FPGA images under control of
> +Device Tree.
> +
> +endif # FPGA
> +
>  endmenu
> diff --git a/drivers/staging/fpga/Makefile b/drivers/staging/fpga/Makefile
> index 3313c52..6115213 100644
> --- a/drivers/staging/fpga/Makefile
> +++ b/drivers/staging/fpga/Makefile
> @@ -4,5 +4,6 @@
>
>  # Core FPGA Manager Framework
>  obj-$(CONFIG_FPGA) += fpga-mgr.o
> +obj-$(CONFIG_SIMPLE_FPGA_BUS)  += simple-fpga-bus.o
>
>  # FPGA Manager Drivers
> diff --git a/drivers/staging/fpga/simple-fpga-bus.c 
> b/drivers/staging/fpga/simple-fpga-bus.c
> new file mode 100644
> index 000..bf178d8
> --- /dev/null
> +++ b/drivers/staging/fpga/simple-fpga-bus.c
> @@ -0,0 +1,323 @@
> +/*
> + * Simple FPGA Bus
> + *
> + *  Copyright (C) 2013-2015 Altera Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope 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.
> + *
> + * You should have received a copy of the GNU General Public License along 
> with
> + * this program.  If not, see .
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * struct simple_fpga_bus - simple fpga bus private data
> + * @dev:   device from pdev
> + * @mgr:   the fpga manager associated with this bus
> + * @bridges:   an array of reset controls for controlling FPGA bridges
> + * associated with this bus
> + * @num_bridges: size of the bridges array
> + */
> +struct simple_fpga_bus {
> +   struct device *dev;
> +   struct fpga_manager *mgr;
> +   struct reset_control **bridges;
> +   int num_bridges;
> +};
> +
> +/**
> + * simple_fpga_bus_get_mgr - get associated fpga manager
> + * @priv: simple fpga bus private data
> + * pointer to fpga manager in priv->mgr on success
> + *
> + * Given a simple fpga bus, get a reference to its the fpga manager specified
> + * by its "fpga-mgr" device tree property.
> + *
> + * Return: 0 if success or if the fpga manager is not specified.
> + * Negative error code otherwise.
> + */
> +static int simple_fpga_bus_get_mgr(struct simple_fpga_bus *priv)
> +{
> +   struct device *dev = priv->dev;
> +   struct device_node *np = dev->of_node;
> +   struct fpga_manager *mgr;
> +   struct device_node *mgr_node;
> +
> +   /*
> +* Return 0 (not an error) if fpga manager is not specified.
> +* This supports the case where fpga was already configured.
> +*/
> +   mgr_node = of_parse_phandle(np, "fpga-mgr", 0);
> +   if (!mgr_node) {
> +   dev_dbg(dev, "could not find fpga-mgr DT property\n");
> +   return 0;
> +   }
> +
> +   mgr = of_fpga_mgr_get(mgr_node);

Re: [PATCH v9 6/7] staging: add simple-fpga-bus

2015-07-23 Thread Jason Gunthorpe
On Thu, Jul 23, 2015 at 02:55:52PM -0700, Moritz Fischer wrote:
> Hi Alan,
> 
> I saw that your socfpga driver doesn't support the partial reconfig
> use case (not a big deal).
> What I currently do for Zynq is if I'm doing a non-partial reconfig is
> that I disable input
> level shifters and assert *all* resets while reprogramming in my FPGA
> manager .write_init() and .write_complete().

I do this as well, but it is a bit more complex.. FPGA specific code
has to run around and ensure all DMA is shut off, then we need to make
sure no CPU issued AXI transactions can happen, then we can tear down
the FPGA side.

If the FPGA is torn down while an AXI op is inprogress things go
sideways, we have to work to prevent that :)

This happens almost for free, I use DT and the device model to
disconnect the drivers. The drivers are careful to synchronously fence
off in-progress DMA. Then drop the DT nodes associated with the
FPGA, finally the actual FPGA cells can be reset.

> In a partial reconfiguration situation, would I have separate
> simple-fpga buses for each of the parts that I swap out, each with
> it's own reset and bitfile attached?

I'd think of partial reconfiguration as another nested FPGA. The
resets and so forth could be attached to soft controllers in the
unswappable part of the FPGA.

DT nodes have to surround it in some way...

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


[PATCH V2 1/3] staging: wilc1000: coreconfigurator.c: remove WILC_MALLOC

2015-07-23 Thread Chaehyun Lim
Use kmalloc and kmalloc_array instead of WILC_MALLOC.

Signed-off-by: Chaehyun Lim 
---
V2: Use GFP_KERNEL flag instead of GFP_ATOMIC

 drivers/staging/wilc1000/coreconfigurator.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index b069614..fb37367 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -674,7 +674,7 @@ s32 CoreConfiguratorInit(void)
sema_init(&SemHandleSendPkt, 1);
sema_init(&SemHandlePktResp, 0);
 
-   gps8ConfigPacket = (s8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
+   gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_KERNEL);
if (gps8ConfigPacket == NULL) {
PRINT_ER("failed in gps8ConfigPacket allocation\n");
s32Error = WILC_NO_MEM;
@@ -811,7 +811,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;
 
-   pstrNetworkInfo = (tstrNetworkInfo 
*)WILC_MALLOC(sizeof(tstrNetworkInfo));
+   pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
WILC_memset((void *)(pstrNetworkInfo), 0, 
sizeof(tstrNetworkInfo));
 
pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -862,7 +862,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
if (u16IEsLen > 0) {
-   pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen);
+   pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -929,7 +929,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u8 *pu8IEs = 0;
u16 u16IEsLen = 0;
 
-   pstrConnectRespInfo = (tstrConnectRespInfo 
*)WILC_MALLOC(sizeof(tstrConnectRespInfo));
+   pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
WILC_memset((void *)(pstrConnectRespInfo), 0, 
sizeof(tstrConnectRespInfo));
 
/* u16AssocRespLen = pu8Buffer[0]; */
@@ -949,7 +949,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
-   pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen);
+   pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
@@ -1018,7 +1018,8 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
}
}
 
-   pstrSurveyResults = (wid_site_survey_reslts_s 
*)WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s));
+   pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
+   sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
if (pstrSurveyResults == NULL) {
u32SurveyResultsCount = 0;
WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-- 
1.9.1

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


[PATCH V3 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

2015-07-23 Thread Chaehyun Lim
Add error check if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
V2: use ! operator instead of NULL comparison
V3: this patch is rebased by previous modification

 drivers/staging/wilc1000/coreconfigurator.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index fb37367..0ff9705 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Hi;
 
pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+   if (!pstrNetworkInfo)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo), 0, 
sizeof(tstrNetworkInfo));
 
pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -863,6 +866,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
 
if (u16IEsLen > 0) {
pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
+   if (!pstrNetworkInfo->pu8IEs)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -930,6 +936,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16 u16IEsLen = 0;
 
pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+   if (!pstrConnectRespInfo)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo), 0, 
sizeof(tstrConnectRespInfo));
 
/* u16AssocRespLen = pu8Buffer[0]; */
@@ -950,6 +959,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
+   if (!pstrConnectRespInfo->pu8RespIEs)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
-- 
1.9.1

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


[PATCH V3 3/3] staging: wilc1000: coreconfigurator.c: fix kmalloc error check

2015-07-23 Thread Chaehyun Lim
Return -ENOMEM if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
V2: Use ! operator instead of NULL comparison
V3: this patch is rebased by previous modification

 drivers/staging/wilc1000/coreconfigurator.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 0ff9705..b2abd8b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -675,11 +675,8 @@ s32 CoreConfiguratorInit(void)
sema_init(&SemHandlePktResp, 0);
 
gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_KERNEL);
-   if (gps8ConfigPacket == NULL) {
-   PRINT_ER("failed in gps8ConfigPacket allocation\n");
-   s32Error = WILC_NO_MEM;
-   goto _fail_;
-   }
+   if (!gps8ConfigPacket)
+   return -ENOMEM;
 
WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE);
 
@@ -1032,10 +1029,8 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
 
pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
-   if (pstrSurveyResults == NULL) {
-   u32SurveyResultsCount = 0;
-   WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-   }
+   if (!pstrSurveyResults)
+   return -ENOMEM;
 
WILC_memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * 
sizeof(wid_site_survey_reslts_s));
 
-- 
1.9.1

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


Re: [PATCH V2 1/3] staging: wilc1000: coreconfigurator.c: remove WILC_MALLOC

2015-07-23 Thread Dan Carpenter
On Fri, Jul 24, 2015 at 08:55:53AM +0900, Chaehyun Lim wrote:
> Use kmalloc and kmalloc_array instead of WILC_MALLOC.
> 
> Signed-off-by: Chaehyun Lim 
> ---
> V2: Use GFP_KERNEL flag instead of GFP_ATOMIC

This is probably the correct thing but how did you check that we aren't
holding a spin_lock or in IRQ context?

regards,
dan carpenter

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


Re: [PATCH v9 6/7] staging: add simple-fpga-bus

2015-07-23 Thread atull
On Thu, 23 Jul 2015, Jason Gunthorpe wrote:

> On Thu, Jul 23, 2015 at 02:55:52PM -0700, Moritz Fischer wrote:
> > Hi Alan,
> > 
> > I saw that your socfpga driver doesn't support the partial reconfig
> > use case (not a big deal).
> > What I currently do for Zynq is if I'm doing a non-partial reconfig is
> > that I disable input
> > level shifters and assert *all* resets while reprogramming in my FPGA
> > manager .write_init() and .write_complete().
> 
> I do this as well, but it is a bit more complex.. FPGA specific code
> has to run around and ensure all DMA is shut off, then we need to make
> sure no CPU issued AXI transactions can happen, then we can tear down
> the FPGA side.
> 
> If the FPGA is torn down while an AXI op is inprogress things go
> sideways, we have to work to prevent that :)
> 
> This happens almost for free, I use DT and the device model to
> disconnect the drivers. The drivers are careful to synchronously fence
> off in-progress DMA. Then drop the DT nodes associated with the
> FPGA, finally the actual FPGA cells can be reset.

Yes, the kernel gives us this almost for free.  That's what I like
about using DT overlays to control FPGA programming.

> 
> > In a partial reconfiguration situation, would I have separate
> > simple-fpga buses for each of the parts that I swap out, each with
> > it's own reset and bitfile attached?
> 
> I'd think of partial reconfiguration as another nested FPGA. The
> resets and so forth could be attached to soft controllers in the
> unswappable part of the FPGA.
> 
> DT nodes have to surround it in some way...
> 
> Jason
> 

Yes, in this way each PR chunk will need its own reset so it
won't wiggle busses and affect the rest of the system during PR.

I noticed that currently simple-fpga-bus.c holds an exclusive
ref of the fpga manager.  This would keep a 2nd pr from being
able to access the same fpga manager, so I'll have to change
it so that simple-fpga-bus.c will  put the ref before exiting
probe.

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


[PATCH 0/5]

2015-07-23 Thread Joshua Clayton
The main goal of this series is to get rid of a needless and ugly typedef
in the rtl8712 wlan driver.

In the course of fixing that, I found a bug thati will can might (at least in 
theory)
lead to a overrun during a memcpy, as well as a duplicate struct.
Finally after cleaning up the typedef, I could not bring myself to leave
a variable called SupportedRates in the kernel with my name on it.

I have tested this on amd64. cwthe module loads and doesn't explode



Joshua Clayton (5):
  staging: rtl8712: fix buggy size calculation
  staging: rtl8712: simplify size calculation
  staging: rtl8712: remove duplicate struct
  staging: rtl8712: remove typedefs
  staging: rtl8712: style fix:

 drivers/staging/rtl8712/ieee80211.c   | 22 ++---
 drivers/staging/rtl8712/rtl871x_cmd.c | 28 +---
 drivers/staging/rtl8712/rtl871x_cmd.h |  4 +--
 drivers/staging/rtl8712/rtl871x_event.h   |  2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 33 +--
 drivers/staging/rtl8712/rtl871x_mlme.c| 47 ++-
 drivers/staging/rtl8712/rtl871x_mlme.h|  2 +-
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c|  6 ++--
 drivers/staging/rtl8712/wlan_bssdef.h | 32 +++---
 9 files changed, 63 insertions(+), 113 deletions(-)

-- 
2.4.6

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


[PATCH 2/5] staging: rtl8712: simplify size calculation

2015-07-23 Thread Joshua Clayton
replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton 
---
 drivers/staging/rtl8712/rtl871x_cmd.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-   uint t_len = 0;
struct ndis_wlan_bssid_ex *psecnetwork;
struct cmd_obj  *pcmd;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct 
wlan_network *pnetwork)
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
if (pcmd == NULL)
return _FAIL;
-   t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-   sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-   sizeof(s32) +
-   sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-   sizeof(struct NDIS_802_11_CONFIGURATION) +
-   sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-   sizeof(NDIS_802_11_RATES_EX) +
-   sizeof(u32) + MAX_IE_SZ;
 
/* for hidden ap to set fw_state here */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct 
wlan_network *pnetwork)
kfree(pcmd);
return _FAIL;
}
-   memcpy(psecnetwork, &pnetwork->network, t_len);
+   memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
psecuritypriv->authenticator_ie[0] = (unsigned char)
 psecnetwork->IELength;
if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

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


[PATCH 1/5] staging: rtl8712: fix buggy size calculation

2015-07-23 Thread Joshua Clayton
r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton 
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-   uint t_len;
-
-   t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 2 +
-   sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-   sizeof(s32) +
-   sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-   sizeof(struct NDIS_802_11_CONFIGURATION) +
-   sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-   sizeof(NDIS_802_11_RATES_EX) +
-   sizeof(u32) + bss->IELength;
-   return t_len;
+   return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

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


[PATCH 5/5] staging: rtl8712: style fix:

2015-07-23 Thread Joshua Clayton
change instances SupportedRates to compliant and sane "rates"
This change in no way harms readability, and brings several lines
under the 80 character limit.

Signed-off-by: Joshua Clayton 
---
 drivers/staging/rtl8712/ieee80211.c   | 22 +++---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 21 +
 drivers/staging/rtl8712/wlan_bssdef.h |  4 ++--
 3 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 5786808..ca9dcaf 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -134,22 +134,22 @@ u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint 
limit)
return NULL;
 }
 
-static void set_supported_rate(u8 *SupportedRates, uint mode)
+static void set_supported_rate(u8 *rates, uint mode)
 {
-   memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX);
+   memset(rates, 0, NDIS_802_11_LENGTH_RATES_EX);
switch (mode) {
case WIRELESS_11B:
-   memcpy(SupportedRates, WIFI_CCKRATES,
+   memcpy(rates, WIFI_CCKRATES,
IEEE80211_CCK_RATE_LEN);
break;
case WIRELESS_11G:
case WIRELESS_11A:
-   memcpy(SupportedRates, WIFI_OFDMRATES,
+   memcpy(rates, WIFI_OFDMRATES,
IEEE80211_NUM_OFDM_RATESLEN);
break;
case WIRELESS_11BG:
-   memcpy(SupportedRates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN);
-   memcpy(SupportedRates + IEEE80211_CCK_RATE_LEN, WIFI_OFDMRATES,
+   memcpy(rates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN);
+   memcpy(rates + IEEE80211_CCK_RATE_LEN, WIFI_OFDMRATES,
IEEE80211_NUM_OFDM_RATESLEN);
break;
}
@@ -195,17 +195,17 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
ie = r8712_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength,
pdev_network->Ssid.Ssid, &sz);
/*supported rates*/
-   set_supported_rate(pdev_network->SupportedRates,
+   set_supported_rate(pdev_network->rates,
   pregistrypriv->wireless_mode);
-   rateLen = r8712_get_rateset_len(pdev_network->SupportedRates);
+   rateLen = r8712_get_rateset_len(pdev_network->rates);
if (rateLen > 8) {
ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, 8,
-   pdev_network->SupportedRates, &sz);
+   pdev_network->rates, &sz);
ie = r8712_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8),
-   (pdev_network->SupportedRates + 8), &sz);
+   (pdev_network->rates + 8), &sz);
} else
ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_,
-   rateLen, pdev_network->SupportedRates, &sz);
+   rateLen, pdev_network->rates, &sz);
/*DS parameter set*/
ie = r8712_set_ie(ie, _DSSET_IE_, 1,
(u8 *)&(pdev_network->Configuration.DSConfig), &sz);
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 087fbf1..219239c 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -203,14 +203,12 @@ static inline char *translate_scan(struct _adapter 
*padapter,
}
/* Add the protocol name */
iwe.cmd = SIOCGIWNAME;
-   if ((r8712_is_cckratesonly_included((u8 *)&pnetwork->network.
-SupportedRates)) == true) {
+   if (r8712_is_cckratesonly_included(pnetwork->network.rates)) {
if (ht_cap == true)
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn");
else
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b");
-   } else if ((r8712_is_cckrates_included((u8 *)&pnetwork->network.
-   SupportedRates)) == true) {
+   } else if (r8712_is_cckrates_included(pnetwork->network.rates)) {
if (ht_cap == true)
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn");
else
@@ -270,9 +268,9 @@ static inline char *translate_scan(struct _adapter 
*padapter,
iwe.u.bitrate.disabled = 0;
iwe.u.bitrate.value = 0;
i = 0;
-   while (pnetwork->network.SupportedRates[i] != 0) {
+   while (pnetwork->network.rates[i] != 0) {
/* Bit rate given in 500 kb/s units */
-   iwe.u.bitrate.value = (pnetwork->network.SupportedRates[i++] &
+   iwe.u.bitrate.value = (pnetwork->network.rates[i++] &
  0x7F) * 50;
current_val = iwe_stream_add_value(info, start, current_val,
  stop, &iwe, IW_EV_PARAM_LEN);
@@ -644,15 +642,15 @@ static int r871

[PATCH 4/5] staging: rtl8712: remove typedefs

2015-07-23 Thread Joshua Clayton
Coding style fix.
Get rid of typedefs NDIS_802_11_RATES and NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton 
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
 drivers/staging/rtl8712/wlan_bssdef.h | 7 +--
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 4f5f69c..087fbf1 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -635,7 +635,7 @@ static int r8711_wx_get_name(struct net_device *dev,
u8 ht_cap = false;
struct  mlme_priv   *pmlmepriv = &(padapter->mlmepriv);
struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
-   NDIS_802_11_RATES_EX *prates = NULL;
+   u8 *prates;
 
if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE) ==
true) {
@@ -644,7 +644,7 @@ static int r8711_wx_get_name(struct net_device *dev,
 &ht_ielen, pcur_bss->IELength - 12);
if (p && ht_ielen > 0)
ht_cap = true;
-   prates = &pcur_bss->SupportedRates;
+   prates = pcur_bss->SupportedRates;
if (r8712_is_cckratesonly_included((u8 *)prates) == true) {
if (ht_cap == true)
snprintf(wrqu->name, IFNAMSIZ,
diff --git a/drivers/staging/rtl8712/wlan_bssdef.h 
b/drivers/staging/rtl8712/wlan_bssdef.h
index 7d769e8..7a410b5 100644
--- a/drivers/staging/rtl8712/wlan_bssdef.h
+++ b/drivers/staging/rtl8712/wlan_bssdef.h
@@ -32,11 +32,6 @@
 #define NDIS_802_11_LENGTH_RATES8
 #define NDIS_802_11_LENGTH_RATES_EX 16
 
-/* Set of 8 data rates*/
-typedef unsigned char   NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES];
-/* Set of 16 data rates */
-typedef unsigned char   NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX];
-
 struct ndis_802_11_ssid {
u32 SsidLength;
u8  Ssid[32];
@@ -104,7 +99,7 @@ struct wlan_bssid_ex {
enum NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
struct NDIS_802_11_CONFIGURATION  Configuration;
enum NDIS_802_11_NETWORK_INFRASTRUCTURE  InfrastructureMode;
-   NDIS_802_11_RATES_EX  SupportedRates;
+   u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
u32 IELength;
/*(timestamp, beacon interval, and capability information) */
u8 IEs[MAX_IE_SZ];
-- 
2.4.6

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


[PATCH 3/5] staging: rtl8712: remove duplicate struct

2015-07-23 Thread Joshua Clayton
struct ndis_wlan_bssid_ex is a dopelganger of
struct wlan_bssid_ex, and is used about a third as often

Switch all instances to wlan_bssid_ex

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton 
---
 drivers/staging/rtl8712/rtl871x_cmd.c | 17 ++---
 drivers/staging/rtl8712/rtl871x_cmd.h |  4 +--
 drivers/staging/rtl8712/rtl871x_event.h   |  2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 10 
 drivers/staging/rtl8712/rtl871x_mlme.c| 35 
+--
 drivers/staging/rtl8712/rtl871x_mlme.h|  2 +-
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c|  6 ++---
 drivers/staging/rtl8712/wlan_bssdef.h | 23 ++
 8 files changed, 38 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index f07050d..ef71829 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -456,9 +456,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
INIT_LIST_HEAD(&pcmd->list);
pcmd->cmdcode = _CreateBss_CMD_;
pcmd->parmbuf = (unsigned char *)pdev_network;
-   pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz((
-   struct ndis_wlan_bssid_ex *)
-   pdev_network);
+   pcmd->cmdsz = r8712_get_wlan_bssid_ex_sz(pdev_network);
pcmd->rsp = NULL;
pcmd->rspsz = 0;
/* notes: translate IELength & Length after assign to cmdsz; */
@@ -471,7 +469,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network 
*pnetwork)
 {
-   struct ndis_wlan_bssid_ex *psecnetwork;
+   struct wlan_bssid_ex *psecnetwork;
struct cmd_obj  *pcmd;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
struct mlme_priv*pmlmepriv = &padapter->mlmepriv;
@@ -502,7 +500,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct 
wlan_network *pnetwork)
break;
}
}
-   psecnetwork = (struct ndis_wlan_bssid_ex *)&psecuritypriv->sec_bss;
+   psecnetwork = &psecuritypriv->sec_bss;
if (psecnetwork == NULL) {
kfree(pcmd);
return _FAIL;
@@ -566,7 +564,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct 
wlan_network *pnetwork)
memcpy(&psecuritypriv->supplicant_ie[1], &psecnetwork->IEs[0],
255);
/* get cmdsz before endian conversion */
-   pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz(psecnetwork);
+   pcmd->cmdsz = r8712_get_wlan_bssid_ex_sz(psecnetwork);
 #ifdef __BIG_ENDIAN
/* wlan_network endian conversion */
psecnetwork->Length = cpu_to_le32(psecnetwork->Length);
@@ -894,8 +892,7 @@ void r8712_createbss_cmd_callback(struct _adapter 
*padapter,
struct sta_info *psta = NULL;
struct wlan_network *pwlan = NULL;
struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
-   struct ndis_wlan_bssid_ex *pnetwork = (struct ndis_wlan_bssid_ex *)
- pcmd->parmbuf;
+   struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf;
struct wlan_network *tgt_network = &(pmlmepriv->cur_network);
 
if (pcmd->res != H2C_SUCCESS)
@@ -949,11 +946,11 @@ void r8712_createbss_cmd_callback(struct _adapter 
*padapter,
} else
list_add_tail(&(pwlan->list),
 &pmlmepriv->scanned_queue.queue);
-   pnetwork->Length = r8712_get_ndis_wlan_bssid_ex_sz(pnetwork);
+   pnetwork->Length = r8712_get_wlan_bssid_ex_sz(pnetwork);
memcpy(&(pwlan->network), pnetwork, pnetwork->Length);
pwlan->fixed = true;
memcpy(&tgt_network->network, pnetwork,
-   (r8712_get_ndis_wlan_bssid_ex_sz(pnetwork)));
+   (r8712_get_wlan_bssid_ex_sz(pnetwork)));
if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
pmlmepriv->fw_state ^= _FW_UNDER_LINKING;
/* we will set _FW_LINKED when there is one more sat to
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h 
b/drivers/staging/rtl8712/rtl871x_cmd.h
index cb8225b..8a91b80 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.h
+++ b/drivers/staging/rtl8712/rtl871x_cmd.h
@@ -128,7 +128,7 @@ struct usb_suspend_parm {
  * Command Event Mode
  */
 struct joinbss_parm {
-   struct ndis_wlan_bssid_ex network;
+   struct wlan_bssid_ex network;
 };
 
 /*
@@ -146,7 +146,7 @@ struct disconnect_parm {
  * Command Mode
  */
 struct createbss_parm {
-   struct ndis_wlan_bssid_ex network;
+   struct wlan_bssid_ex network;
 };
 
 /*
diff --git a/drivers/staging/rtl8712/rtl871x_event.h 
b/drivers/staging/rtl8712/rtl871x_event.h
index e03ee90..697c8d7 100644

Re: [PATCH V3 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability

2015-07-23 Thread Sudip Mukherjee
On Thu, Jul 23, 2015 at 01:24:50PM +0300, Dan Carpenter wrote:
> On Thu, Jul 23, 2015 at 01:10:57PM +0300, Dan Carpenter wrote:
> > In this specific case, writing it as "if (ret != 0)" caused the bug.  If
> > we had written it as "if (ret) return ret;" then there are no zeroes so
> > wouldn't have been any temptation to return the zero instead of the ret.
> 
> I did a search to see if returning the zero instead of the ret was a
> common mistake and it seems like it might be.  I did:
> 
> grep 'if (ret != 0)' drivers/   -r -A1 -n | grep "return 0;" | perl -ne 
> 's/.c-(\d+)-/.c:$1/; print'
> 
> drivers/gpu/drm/nouveau/nouveau_display.c:111   return 0;
This is also ok, the function is supposed to return ret or-ed with the
relevant flags based on the scan position. It is considered error if 0
is returned (without any flag).

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