Re: [PATCH v4] staging: android: Clean up else statement from binder_send_failed_reply

2014-07-15 Thread Dan Carpenter
On Mon, Jul 14, 2014 at 04:38:43PM -0300, Lucas Tanure wrote:
 Hi,
 
 This patch got accepted ?


It looks ok.  You will get an automated email when the patch is merged
into Greg's tree.  It can take 2 weeks or longer depending on merge
window timing or Greg's travel schedule.

Anyway, your patch is not lost.  Email again in 2 weeks if you haven't
heard anything.

regards,
dan carpenter

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


Re: [PATCH 7/8] staging: dgap: introduce dgap_cleanup_nodes()

2014-07-15 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 12:04:02PM +0900, Daeseok Youn wrote:
 When a configration file is parsed with dgap_parsefile(),
 makes nodes for saving configrations for board.
 
 Making a node will allocate node memory and strings for saving
 configrations with kstrdup().
 
 So these are freed when dgap is unloaded or failed to initialize.
 
 Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
 ---
 It MUST be needed to prevent memory leaks but
 I'm not sure that I fix properly.
 
 Please review.

This thread doesn't have Mark on the CC list and he's the only person
who can actually test it properly.  Resend it and CC Mark
Hounschell ma...@compro.net.

regards,
dan carpenter

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


Re: [PATCH 6/8] staging: dgap: remove unneeded dgap_err()

2014-07-15 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 12:02:23PM +0900, Daeseok Youn wrote:
 The dgap_err() is printing a message with pr_err(),
 so all those are replaced.
 

Take a look at how pr_fmt works.

#define pr_fmt(fmt) dgap:  fmt

Then you can remove the dgap:  from the beginning of each line.

Also all the out of memory messages can be removed because the kernel
prints its own message for that.

regards,
dan carpenter

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


Re: [PATCH 8/8] staging: dgap: fix memory leak in dgap_parsefile()

2014-07-15 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 12:05:14PM +0900, Daeseok Youn wrote:
 The p-u.board.status is allocated and set a string as
 No once within allocating a node of BNODE type.
 But it also set again with kstrdup() in case of STATUS
 or ID. If it is not allocated yet, use kstrdup().
 If not, use just memcpy().

I don't think a 2 char buffer is always large enough to hold the new
strings.

Just free it and allocate again.

regards,
dan carpenter

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


Re: [PATCH 91/93] Staging: comedi: 8253.h fixed by removing 'return' from generic func

2014-07-15 Thread Dan Carpenter
Oh, wow.  No.  All these patches are wrong but there are too many to
discuss them individually.

regards,
dan carpenter

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


integer overflow in ll_fid2path()

2014-07-15 Thread Dan Carpenter
Hi Oleg,

The patch d7e09d0397e8: staging: add Lustre file system client
support from May 2, 2013, leads to the following static checker
warning:

drivers/staging/lustre/lustre/llite/file.c:1730 ll_fid2path()
error: memcpy() 'gfout' too small

drivers/staging/lustre/lustre/llite/file.c
  1719  if (copy_from_user(gfin, arg, sizeof(*gfin))) {
  1720  OBD_FREE_PTR(gfin);
  1721  return -EFAULT;
  1722  }
  1723  
  1724  outsize = sizeof(*gfout) + gfin-gf_pathlen;

outsize is an int.
gfin-gf_pathlen is a u32 which comes from the user.
The addition can overflow so outsize is less than sizeof(*gfout).

  1725  OBD_ALLOC(gfout, outsize);
  1726  if (gfout == NULL) {
  1727  OBD_FREE_PTR(gfin);
  1728  return -ENOMEM;
  1729  }
  1730  memcpy(gfout, gfin, sizeof(*gfout));

It would lead to memory corruption here.  Probably we should add
something like:

if (gfin-gf_pathlen  PATH_MAX)
return -EINVAL;

Is that the right limit here?

  1731  OBD_FREE_PTR(gfin);
  1732  
  1733  /* Call mdc_iocontrol */
  1734  rc = obd_iocontrol(OBD_IOC_FID2PATH, exp, outsize, gfout, NULL);

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


Re: [PATCH 6/8] staging: dgap: remove unneeded dgap_err()

2014-07-15 Thread DaeSeok Youn
Hi, Dan.

2014-07-15 15:47 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
 On Tue, Jul 15, 2014 at 12:02:23PM +0900, Daeseok Youn wrote:
 The dgap_err() is printing a message with pr_err(),
 so all those are replaced.


 Take a look at how pr_fmt works.

 #define pr_fmt(fmt) dgap:  fmt

 Then you can remove the dgap:  from the beginning of each line.
OK. I will define pr_fmt and remove dgap: string in pr_xxx()


 Also all the out of memory messages can be removed because the kernel
 prints its own message for that.
OK. I will.

Thanks.

regards,
Daeseok Youn.

 regards,
 dan carpenter

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


Re: [PATCH 7/8] staging: dgap: introduce dgap_cleanup_nodes()

2014-07-15 Thread DaeSeok Youn
2014-07-15 15:41 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
 On Tue, Jul 15, 2014 at 12:04:02PM +0900, Daeseok Youn wrote:
 When a configration file is parsed with dgap_parsefile(),
 makes nodes for saving configrations for board.

 Making a node will allocate node memory and strings for saving
 configrations with kstrdup().

 So these are freed when dgap is unloaded or failed to initialize.

 Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
 ---
 It MUST be needed to prevent memory leaks but
 I'm not sure that I fix properly.

 Please review.

 This thread doesn't have Mark on the CC list and he's the only person
 who can actually test it properly.  Resend it and CC Mark
 Hounschell ma...@compro.net.

Really? I'd added Mark to CC list.
hmm.. In your reply doesn't have Mark. I was checking sent-box, he is
in the CC list.

OK. I will try to send this again after fixing 6/7 and 8/8.
Thanks.

regards,
Daeseok Youn

 regards,
 dan carpenter

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


[PATCH 01/22] Staging: bcm: PHSModule.c: Whitespace Indentation cleanup

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 589 ++--
 1 file changed, 384 insertions(+), 205 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 4b6de76..79d84d7 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -1,46 +1,80 @@
 #include headers.h
 
-static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid, B_UINT16 uiClsId, 
struct bcm_phs_table *psServiceFlowTable, struct bcm_phs_rule *psPhsRule, 
B_UINT8 u8AssociatedPHSI);
-
-static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid, B_UINT16  
uiClsId, struct bcm_phs_entry *pstServiceFlowEntry, struct bcm_phs_rule 
*psPhsRule, B_UINT8 u8AssociatedPHSI);
-
-static UINT CreateClassifierPHSRule(B_UINT16  uiClsId, struct 
bcm_phs_classifier_table *psaClassifiertable, struct bcm_phs_rule *psPhsRule, 
enum bcm_phs_classifier_context eClsContext, B_UINT8 u8AssociatedPHSI);
-
-static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId, struct 
bcm_phs_classifier_entry *pstClassifierEntry, struct bcm_phs_classifier_table 
*psaClassifiertable, struct bcm_phs_rule *psPhsRule, B_UINT8 u8AssociatedPHSI);
+static UINT CreateSFToClassifierRuleMapping(B_UINT16 uiVcid,
+   B_UINT16 uiClsId,
+   struct bcm_phs_table 
*psServiceFlowTable,
+   struct bcm_phs_rule *psPhsRule,
+   B_UINT8 u8AssociatedPHSI);
+
+static UINT CreateClassiferToPHSRuleMapping(B_UINT16 uiVcid,
+   B_UINT16  uiClsId,
+   struct bcm_phs_entry 
*pstServiceFlowEntry,
+   struct bcm_phs_rule *psPhsRule,
+   B_UINT8 u8AssociatedPHSI);
+
+static UINT CreateClassifierPHSRule(B_UINT16  uiClsId,
+   struct bcm_phs_classifier_table 
*psaClassifiertable,
+   struct bcm_phs_rule *psPhsRule,
+   enum bcm_phs_classifier_context eClsContext,
+   B_UINT8 u8AssociatedPHSI);
+
+static UINT UpdateClassifierPHSRule(B_UINT16 uiClsId,
+   struct bcm_phs_classifier_entry 
*pstClassifierEntry,
+   struct bcm_phs_classifier_table 
*psaClassifiertable,
+   struct bcm_phs_rule *psPhsRule,
+   B_UINT8 u8AssociatedPHSI);
 
 static bool ValidatePHSRuleComplete(struct bcm_phs_rule *psPhsRule);
 
-static bool DerefPhsRule(B_UINT16 uiClsId, struct bcm_phs_classifier_table 
*psaClassifiertable, struct bcm_phs_rule *pstPhsRule);
+static bool DerefPhsRule(B_UINT16 uiClsId,
+struct bcm_phs_classifier_table *psaClassifiertable,
+struct bcm_phs_rule *pstPhsRule);
 
-static UINT GetClassifierEntry(struct bcm_phs_classifier_table 
*pstClassifierTable, B_UINT32 uiClsid, enum bcm_phs_classifier_context 
eClsContext, struct bcm_phs_classifier_entry **ppstClassifierEntry);
+static UINT GetClassifierEntry(struct bcm_phs_classifier_table 
*pstClassifierTable,
+  B_UINT32 uiClsid,
+  enum bcm_phs_classifier_context eClsContext,
+  struct bcm_phs_classifier_entry 
**ppstClassifierEntry);
 
-static UINT GetPhsRuleEntry(struct bcm_phs_classifier_table 
*pstClassifierTable, B_UINT32 uiPHSI, enum bcm_phs_classifier_context 
eClsContext, struct bcm_phs_rule **ppstPhsRule);
+static UINT GetPhsRuleEntry(struct bcm_phs_classifier_table 
*pstClassifierTable,
+   B_UINT32 uiPHSI,
+   enum bcm_phs_classifier_context eClsContext,
+   struct bcm_phs_rule **ppstPhsRule);
 
 static void free_phs_serviceflow_rules(struct bcm_phs_table 
*psServiceFlowRulesTable);
 
-static int phs_compress(struct bcm_phs_rule *phs_members, unsigned char 
*in_buf,
-   unsigned char *out_buf, unsigned int *header_size, UINT 
*new_header_size);
+static int phs_compress(struct bcm_phs_rule *phs_members,
+   unsigned char *in_buf,
+   unsigned char *out_buf,
+   unsigned int *header_size,
+   UINT *new_header_size);
 
-static int verify_suppress_phsf(unsigned char *in_buffer, unsigned char 
*out_buffer,
-   unsigned char *phsf, unsigned char *phsm, 
unsigned int phss, unsigned int phsv, UINT *new_header_size);
+static int verify_suppress_phsf(unsigned char *in_buffer,
+   unsigned char *out_buffer,
+   unsigned char *phsf,
+   unsigned char *phsm,
+  

[PATCH 02/22] Staging: bcm: PHSModule.c: Outsourced debug printing in own function

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 95 -
 1 file changed, 56 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 79d84d7..a6f0bf4 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -1334,9 +1334,61 @@ static bool DerefPhsRule(IN B_UINT16  uiClsId,
return false;
 }
 
+static void phsrules_per_sf_dbg_print(struct bcm_mini_adapter *ad,
+ struct bcm_phs_entry *st_serv_flow_entry)
+{
+   int j, l;
+   struct bcm_phs_classifier_entry st_cls_entry;
+
+   for (j = 0; j  MAX_PHSRULE_PER_SF; j++) {
+
+   for (l = 0; l  2; l++) {
+
+   if (l == 0) {
+   st_cls_entry = 
st_serv_flow_entry-pstClassifierTable-stActivePhsRulesList[j];
+   if (st_cls_entry.bUsed)
+   BCM_DEBUG_PRINT(ad,
+   DBG_TYPE_OTHERS,
+   DUMP_INFO,
+   (DBG_LVL_ALL | 
DBG_NO_FUNC_PRINT),
+   \n Active PHS Rule 
:\n);
+   } else {
+   st_cls_entry = 
st_serv_flow_entry-pstClassifierTable-stOldPhsRulesList[j];
+   if (st_cls_entry.bUsed)
+   BCM_DEBUG_PRINT(ad,
+   DBG_TYPE_OTHERS,
+   DUMP_INFO,
+   (DBG_LVL_ALL | 
DBG_NO_FUNC_PRINT),
+   \n Old PHS Rule :\n);
+   }
+
+   if (st_cls_entry.bUsed) {
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
DBG_LVL_ALL, \n VCID  : %#X, st_serv_flow_entry-uiVcid);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n ClassifierID  : %#X, 
st_cls_entry.uiClassifierRuleId);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSRuleID  : %#X, st_cls_entry.u8PHSI);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \nPHS 
Rule\n);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSI  : %#X, 
st_cls_entry.pstPhsRule-u8PHSI);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSFLength : %#X , 
st_cls_entry.pstPhsRule-u8PHSFLength);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSF : );
+
+   for (k = 0 ; k  
st_cls_entry.pstPhsRule-u8PHSFLength; k++)
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, 
DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), %#X  , 
st_cls_entry.pstPhsRule-u8PHSF[k]);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSMLength  : %#X, 
st_cls_entry.pstPhsRule-u8PHSMLength);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSM :);
+
+   for (k = 0; k  
st_cls_entry.pstPhsRule-u8PHSMLength; k++)
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, 
DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), %#X  , 
st_cls_entry.pstPhsRule-u8PHSM[k]);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSS : %#X , 
st_cls_entry.pstPhsRule-u8PHSS);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSV  : %#X, 
st_cls_entry.pstPhsRule-u8PHSV);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
DBG_LVL_ALL, \n\n);
+   }
+   }
+   }
+}
+
 void DumpPhsRules(struct bcm_phs_extension *pDeviceExtension)
 {
-   int i, j, k, l;
+   int i;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL,
@@ -1346,46 +1398,11 @@ void DumpPhsRules(struct bcm_phs_extension 
*pDeviceExtension)
 
struct bcm_phs_entry stServFlowEntry =

pDeviceExtension-pstServiceFlowPhsRulesTable-stSFList[i];
-   if (stServFlowEntry.bUsed) 

[PATCH 00/22] drivers/staging/bcm/PHSModule.c cleanup patches

2014-07-15 Thread Matthias Beyer
Hi,

this is my patchset for the

drivers/staging/bcm/PHSModule.c

file. It contains cleanup patches for

* Replacing object-member-member constructs by variables
* Shortenings of long lines
* Whitespace cleanup
* Chaining of nested if statements (if (foo) if (bar) = if (foo  bar))

Note: As I do not have the appropriate hardware, I'm not able to test these
patches. I compiled them at least.

Kind regards,
Matthias Beyer


Matthias Beyer (22):
  Staging: bcm: PHSModule.c: Whitespace  Indentation cleanup
  Staging: bcm: PHSModule.c: Outsourced debug printing in own function
  Staging: bcm: PHSModule.c: Outsourced debug printing for phs
classifier entry
  Staging: bcm: PHSModule.c: Replaced member accessing with variable in
PhsDeletePHSRule()
  Staging: bcm: PHSModule.c: Replaced nested if statements with logical
AND concatenation of the conditions
  Staging: bcm: PHSModule.c: Reduced indentation level by using jump
label
  Staging: bcm: PHSModule.c: Shortened lines
  Staging: bcm: PHSModule.c: Reduced indentation by using jump label in
PhsDeleteSFRules()
  Staging: bcm: PHSModule.c: Replaced member accessing with variables
  Staging: bcm: PHSModule.c: Whitespace cleanup in PhsCompress()
  Staging: bcm: PHSModule.c: Added missing braces around else block
  Staging: bcm: PHSModule.c: Replaced member accessing with variable in
free_phs_service()
  Staging: bcm: PHSModule.c: Replaced indentation level with goto jump
on bad condition
  Staging: bcm: PHSModule.c: Rewrote ValidatePHSRuleComplete()
  Staging: bcm: PHSModule.c: Added const keyword to
ValidatePHSRUleComplete() argument
  Staging: bcm: PHSModule.c: Replaced member accessing with variable in
GetServiceFlowEntry()
  Staging: bcm: PHSModule.c: Simplified nested if statements by linking
them with logical AND in GetServiceFlowEntry()
  Staging: bcm: PHSModule.c: Simplified nested if statements by linking
them with logical AND in GetServiceFlowEntry()
  Staging: bcm: PHSModule.c: Simplified nested if statements by linking
them with logical AND in GetPhsRuleEntry()
  Staging: bcm: PHSModule.c: Replaced member accessing with variable in
CreateSFToClassifierRuleMapping()
  Staging: bcm: PHSModule.c: Replaced if-else return code with simple
return assertion
  Staging: bcm: PHSModule.c: Shortened lines

 drivers/staging/bcm/PHSModule.c | 1098 ---
 1 file changed, 676 insertions(+), 422 deletions(-)

-- 
2.0.1

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


[PATCH 08/22] Staging: bcm: PHSModule.c: Reduced indentation by using jump label in PhsDeleteSFRules()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 66 +
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 7ced228..4e6bcef 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -639,49 +639,51 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 
uiVcid)
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
\n);
 
-   if (pDeviceExtension) {
-   /* Retrieve the SFID Entry Index for requested Service Flow */
-   nSFIndex = 
GetServiceFlowEntry(pDeviceExtension-pstServiceFlowPhsRulesTable,
-  uiVcid, pstServiceFlowEntry);
-   if (nSFIndex == PHS_INVALID_TABLE_INDEX) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH,
-   DBG_LVL_ALL, SFID Match Failed\n);
-   return ERR_SF_MATCH_FAIL;
-   }
+   if (!pDeviceExtension)
+   goto out;
 
-   pstClassifierRulesTable = 
pstServiceFlowEntry-pstClassifierTable;
-   if (pstClassifierRulesTable) {
-   for (nClsidIndex = 0; nClsidIndex  MAX_PHSRULE_PER_SF; 
nClsidIndex++) {
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule) {
+   /* Retrieve the SFID Entry Index for requested Service Flow */
+   nSFIndex = 
GetServiceFlowEntry(pDeviceExtension-pstServiceFlowPhsRulesTable,
+  uiVcid, pstServiceFlowEntry);
+   if (nSFIndex == PHS_INVALID_TABLE_INDEX) {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH,
+   DBG_LVL_ALL, SFID Match Failed\n);
+   return ERR_SF_MATCH_FAIL;
+   }
 
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt--;
+   pstClassifierRulesTable = pstServiceFlowEntry-pstClassifierTable;
+   if (pstClassifierRulesTable) {
+   for (nClsidIndex = 0; nClsidIndex  MAX_PHSRULE_PER_SF; 
nClsidIndex++) {
+   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule) {
 
-   if (0 == 
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
kfree(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule);
+   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
+   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt--;
 
-   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule = NULL;
-   }
-   
memset(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex],
-  0, sizeof(struct 
bcm_phs_classifier_entry));
-   if 
(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule) {
+   if (0 == 
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
+   
kfree(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule);
+
+   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule = NULL;
+   }
+   
memset(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex],
+  0, sizeof(struct bcm_phs_classifier_entry));
+   if 
(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule) {
 
-   if 
(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt--;
+   if 
(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
+   
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt--;
 
-   if (0 == 
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
kfree(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule);
+   if (0 == 
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
+ 

[PATCH 04/22] Staging: bcm: PHSModule.c: Replaced member accessing with variable in PhsDeletePHSRule()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index f726f2e..55421ef 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -499,6 +499,7 @@ ULONG PhsDeletePHSRule(IN void *pvContext,
struct bcm_phs_classifier_table *pstClassifierRulesTable = NULL;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension 
*)pvContext;
+   struct bcm_phs_classifier_entry *curr_entry;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
==\n);
@@ -517,16 +518,17 @@ ULONG PhsDeletePHSRule(IN void *pvContext,
pstClassifierRulesTable = 
pstServiceFlowEntry-pstClassifierTable;
if (pstClassifierRulesTable) {
for (nClsidIndex = 0; nClsidIndex  MAX_PHSRULE_PER_SF; 
nClsidIndex++) {
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].bUsed  
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule) {
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8PHSI 
== u8PHSI) {
+   curr_entry = 
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex];
+   if (curr_entry-bUsed  
curr_entry-pstPhsRule) {
+   if (curr_entry-pstPhsRule-u8PHSI == 
u8PHSI) {
 
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt--;
+   if 
(curr_entry-pstPhsRule-u8RefCnt)
+   
curr_entry-pstPhsRule-u8RefCnt--;
 
-   if (0 == 
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
kfree(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule);
+   if (0 == 
curr_entry-pstPhsRule-u8RefCnt)
+   
kfree(curr_entry-pstPhsRule);
 
-   
memset(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex],
+   memset(curr_entry,
   0,
   sizeof(struct 
bcm_phs_classifier_entry));
}
-- 
2.0.1

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


[PATCH 06/22] Staging: bcm: PHSModule.c: Reduced indentation level by using jump label

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 65 +
 1 file changed, 34 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 89cc90c..a11474c 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -564,44 +564,47 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN 
B_UINT16 uiVcid, IN B_UINT1
struct bcm_phs_extension *pDeviceExtension =
(struct bcm_phs_extension *)pvContext;
 
-   if (pDeviceExtension) {
-   /* Retrieve the SFID Entry Index for requested Service Flow */
-   nSFIndex = 
GetServiceFlowEntry(pDeviceExtension-pstServiceFlowPhsRulesTable,
-  uiVcid, pstServiceFlowEntry);
-   if (nSFIndex == PHS_INVALID_TABLE_INDEX) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH,
-   DBG_LVL_ALL, SFID Match Failed\n);
-   return ERR_SF_MATCH_FAIL;
-   }
+   if (!pDeviceExtension)
+   goto out;
+
+   /* Retrieve the SFID Entry Index for requested Service Flow */
+   nSFIndex = 
GetServiceFlowEntry(pDeviceExtension-pstServiceFlowPhsRulesTable,
+  uiVcid, pstServiceFlowEntry);
+   if (nSFIndex == PHS_INVALID_TABLE_INDEX) {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH,
+   DBG_LVL_ALL, SFID Match Failed\n);
+   return ERR_SF_MATCH_FAIL;
+   }
 
-   nClsidIndex = 
GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
-uiClsId,
-eActiveClassifierRuleContext,
-pstClassifierEntry);
+   nClsidIndex = 
GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
+uiClsId,
+eActiveClassifierRuleContext,
+pstClassifierEntry);
 
-   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX)  
(!pstClassifierEntry-bUnclassifiedPHSRule)) {
-   if (pstClassifierEntry-pstPhsRule) {
-   if (pstClassifierEntry-pstPhsRule-u8RefCnt)
-   
pstClassifierEntry-pstPhsRule-u8RefCnt--;
+   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX)  
(!pstClassifierEntry-bUnclassifiedPHSRule)) {
+   if (pstClassifierEntry-pstPhsRule) {
+   if (pstClassifierEntry-pstPhsRule-u8RefCnt)
+   pstClassifierEntry-pstPhsRule-u8RefCnt--;
 
-   if (0 == 
pstClassifierEntry-pstPhsRule-u8RefCnt)
-   kfree(pstClassifierEntry-pstPhsRule);
-   }
-   memset(pstClassifierEntry, 0,
-  sizeof(struct bcm_phs_classifier_entry));
+   if (0 == pstClassifierEntry-pstPhsRule-u8RefCnt)
+   kfree(pstClassifierEntry-pstPhsRule);
}
+   memset(pstClassifierEntry, 0,
+  sizeof(struct bcm_phs_classifier_entry));
+   }
 
-   nClsidIndex = 
GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
-uiClsId,
-eOldClassifierRuleContext,
-pstClassifierEntry);
+   nClsidIndex = 
GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
+uiClsId,
+eOldClassifierRuleContext,
+pstClassifierEntry);
 
-   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX)  
(!pstClassifierEntry-bUnclassifiedPHSRule)) {
-   kfree(pstClassifierEntry-pstPhsRule);
-   memset(pstClassifierEntry, 0,
-  sizeof(struct bcm_phs_classifier_entry));
-   }
+   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX)  
(!pstClassifierEntry-bUnclassifiedPHSRule)) {
+   kfree(pstClassifierEntry-pstPhsRule);
+   memset(pstClassifierEntry, 0,
+  sizeof(struct bcm_phs_classifier_entry));
}
+
+out:
return 0;
 }
 
-- 
2.0.1

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


[PATCH 09/22] Staging: bcm: PHSModule.c: Replaced member accessing with variables

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 40 
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 4e6bcef..6431912 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -635,6 +635,8 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 
uiVcid)
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
struct bcm_phs_extension *pDeviceExtension =
(struct bcm_phs_extension *)pvContext;
+   struct bcm_phs_classifier_entry *curr_clsf_entry;
+   struct bcm_phs_classifier_entry *curr_rules_list;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
\n);
@@ -654,30 +656,36 @@ ULONG PhsDeleteSFRules(IN void *pvContext, IN B_UINT16 
uiVcid)
pstClassifierRulesTable = pstServiceFlowEntry-pstClassifierTable;
if (pstClassifierRulesTable) {
for (nClsidIndex = 0; nClsidIndex  MAX_PHSRULE_PER_SF; 
nClsidIndex++) {
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule) {
+   curr_clsf_entry =
+   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex];
 
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt--;
+   curr_rules_list =
+   
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex];
 
-   if (0 == 
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
kfree(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule);
+   if (curr_clsf_entry-pstPhsRule) {
 
-   
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex].pstPhsRule = NULL;
+   if (curr_clsf_entry-pstPhsRule-u8RefCnt)
+   curr_clsf_entry-pstPhsRule-u8RefCnt--;
+
+   if (0 == curr_clsf_entry-pstPhsRule-u8RefCnt)
+   kfree(curr_clsf_entry-pstPhsRule);
+
+   curr_clsf_entry-pstPhsRule = NULL;
}
-   
memset(pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex],
-  0, sizeof(struct bcm_phs_classifier_entry));
-   if 
(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule) {
+   memset(curr_clsf_entry, 0,
+  sizeof(struct bcm_phs_classifier_entry));
+   if (curr_rules_list-pstPhsRule) {
 
-   if 
(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt--;
+   if (curr_rules_list-pstPhsRule-u8RefCnt)
+   curr_rules_list-pstPhsRule-u8RefCnt--;
 
-   if (0 == 
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule-u8RefCnt)
-   
kfree(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule);
+   if (0 == curr_rules_list-pstPhsRule-u8RefCnt)
+   kfree(curr_rules_list-pstPhsRule);
 
-   
pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex].pstPhsRule = NULL;
+   curr_rules_list-pstPhsRule = NULL;
}
-   
memset(pstClassifierRulesTable-stOldPhsRulesList[nClsidIndex],
-  0, sizeof(struct bcm_phs_classifier_entry));
+   memset(curr_rules_list, 0,
+  sizeof(struct bcm_phs_classifier_entry));
}
}
pstServiceFlowEntry-bUsed = false;
-- 
2.0.1

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


[PATCH 05/22] Staging: bcm: PHSModule.c: Replaced nested if statements with logical AND concatenation of the conditions

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 55421ef..89cc90c 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -519,19 +519,19 @@ ULONG PhsDeletePHSRule(IN void *pvContext,
if (pstClassifierRulesTable) {
for (nClsidIndex = 0; nClsidIndex  MAX_PHSRULE_PER_SF; 
nClsidIndex++) {
curr_entry = 
pstClassifierRulesTable-stActivePhsRulesList[nClsidIndex];
-   if (curr_entry-bUsed  
curr_entry-pstPhsRule) {
-   if (curr_entry-pstPhsRule-u8PHSI == 
u8PHSI) {
+   if (curr_entry-bUsed 
+   curr_entry-pstPhsRule 
+   (curr_entry-pstPhsRule-u8PHSI == u8PHSI)) 
{
 
-   if 
(curr_entry-pstPhsRule-u8RefCnt)
-   
curr_entry-pstPhsRule-u8RefCnt--;
+   if (curr_entry-pstPhsRule-u8RefCnt)
+   
curr_entry-pstPhsRule-u8RefCnt--;
 
-   if (0 == 
curr_entry-pstPhsRule-u8RefCnt)
-   
kfree(curr_entry-pstPhsRule);
+   if (0 == 
curr_entry-pstPhsRule-u8RefCnt)
+   kfree(curr_entry-pstPhsRule);
 
-   memset(curr_entry,
-  0,
-  sizeof(struct 
bcm_phs_classifier_entry));
-   }
+   memset(curr_entry,
+  0,
+  sizeof(struct 
bcm_phs_classifier_entry));
}
}
}
-- 
2.0.1

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


[PATCH 03/22] Staging: bcm: PHSModule.c: Outsourced debug printing for phs classifier entry

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 47 +
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index a6f0bf4..f726f2e 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -1334,6 +1334,32 @@ static bool DerefPhsRule(IN B_UINT16  uiClsId,
return false;
 }
 
+static void dbg_print_st_cls_entry(struct bcm_mini_adapter *ad,
+  struct bcm_phs_entry *st_serv_flow_entry,
+  struct bcm_phs_classifier_entry 
*st_cls_entry)
+{
+   int k;
+
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, \n VCID  
: %#X, st_serv_flow_entry-uiVcid);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n ClassifierID  : %#X, 
st_cls_entry-uiClassifierRuleId);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSRuleID  : %#X, st_cls_entry-u8PHSI);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \nPHS 
Rule\n);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSI  : %#X, 
st_cls_entry-pstPhsRule-u8PHSI);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSFLength : %#X , 
st_cls_entry-pstPhsRule-u8PHSFLength);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSF : );
+
+   for (k = 0 ; k  st_cls_entry-pstPhsRule-u8PHSFLength; k++)
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), %#X  , st_cls_entry-pstPhsRule-u8PHSF[k]);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSMLength  : %#X, 
st_cls_entry-pstPhsRule-u8PHSMLength);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSM :);
+
+   for (k = 0; k  st_cls_entry-pstPhsRule-u8PHSMLength; k++)
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), %#X  , st_cls_entry-pstPhsRule-u8PHSM[k]);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSS : %#X , 
st_cls_entry-pstPhsRule-u8PHSS);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSV  : %#X, 
st_cls_entry-pstPhsRule-u8PHSV);
+   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, 
\n\n);
+}
+
 static void phsrules_per_sf_dbg_print(struct bcm_mini_adapter *ad,
  struct bcm_phs_entry *st_serv_flow_entry)
 {
@@ -1363,24 +1389,9 @@ static void phsrules_per_sf_dbg_print(struct 
bcm_mini_adapter *ad,
}
 
if (st_cls_entry.bUsed) {
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
DBG_LVL_ALL, \n VCID  : %#X, st_serv_flow_entry-uiVcid);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n ClassifierID  : %#X, 
st_cls_entry.uiClassifierRuleId);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSRuleID  : %#X, st_cls_entry.u8PHSI);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \nPHS 
Rule\n);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSI  : %#X, 
st_cls_entry.pstPhsRule-u8PHSI);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSFLength : %#X , 
st_cls_entry.pstPhsRule-u8PHSFLength);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSF : );
-
-   for (k = 0 ; k  
st_cls_entry.pstPhsRule-u8PHSFLength; k++)
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, 
DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), %#X  , 
st_cls_entry.pstPhsRule-u8PHSF[k]);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSMLength  : %#X, 
st_cls_entry.pstPhsRule-u8PHSMLength);
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, DUMP_INFO, 
(DBG_LVL_ALL|DBG_NO_FUNC_PRINT), \n PHSM :);
-
-   for (k = 0; k  
st_cls_entry.pstPhsRule-u8PHSMLength; k++)
-   BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, 
DUMP_INFO, (DBG_LVL_ALL|DBG_NO_FUNC_PRINT), %#X  , 
st_cls_entry.pstPhsRule-u8PHSM[k]);
- 

[PATCH 07/22] Staging: bcm: PHSModule.c: Shortened lines

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index a11474c..7ced228 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -576,12 +576,14 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN 
B_UINT16 uiVcid, IN B_UINT1
return ERR_SF_MATCH_FAIL;
}
 
-   nClsidIndex = 
GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
-uiClsId,
-eActiveClassifierRuleContext,
-pstClassifierEntry);
-
-   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX)  
(!pstClassifierEntry-bUnclassifiedPHSRule)) {
+   nClsidIndex =
+   GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
+  uiClsId,
+  eActiveClassifierRuleContext,
+  pstClassifierEntry);
+
+   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) 
+   (!pstClassifierEntry-bUnclassifiedPHSRule)) {
if (pstClassifierEntry-pstPhsRule) {
if (pstClassifierEntry-pstPhsRule-u8RefCnt)
pstClassifierEntry-pstPhsRule-u8RefCnt--;
@@ -593,12 +595,14 @@ ULONG PhsDeleteClassifierRule(IN void *pvContext, IN 
B_UINT16 uiVcid, IN B_UINT1
   sizeof(struct bcm_phs_classifier_entry));
}
 
-   nClsidIndex = 
GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
-uiClsId,
-eOldClassifierRuleContext,
-pstClassifierEntry);
+   nClsidIndex =
+   GetClassifierEntry(pstServiceFlowEntry-pstClassifierTable,
+  uiClsId,
+  eOldClassifierRuleContext,
+  pstClassifierEntry);
 
-   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX)  
(!pstClassifierEntry-bUnclassifiedPHSRule)) {
+   if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) 
+   (!pstClassifierEntry-bUnclassifiedPHSRule)) {
kfree(pstClassifierEntry-pstPhsRule);
memset(pstClassifierEntry, 0,
   sizeof(struct bcm_phs_classifier_entry));
-- 
2.0.1

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


[PATCH 11/22] Staging: bcm: PHSModule.c: Added missing braces around else block

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index e01c5cf..e3db972 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -783,8 +783,9 @@ static ULONG PhsCompress(IN void *pvContext,
pstPhsRule-PHSModifiedBytes +=
*pOldHeaderSize - *pNewHeaderSize - 1;
pstPhsRule-PHSModifiedNumPackets++;
-   } else
+   } else {
pstPhsRule-PHSErrorNumPackets++;
+   }
 
return lStatus;
 }
-- 
2.0.1

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


[PATCH 12/22] Staging: bcm: PHSModule.c: Replaced member accessing with variable in free_phs_service()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 32 
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index e3db972..d2aa9c9 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -889,6 +889,8 @@ static void free_phs_serviceflow_rules(struct bcm_phs_table 
*psServiceFlowRulesT
 {
int i, j;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
+   struct bcm_phs_classifier_entry *curr_act_rules_list;
+   struct bcm_phs_classifier_entry *curr_old_rules_list;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
===\n);
@@ -902,26 +904,32 @@ static void free_phs_serviceflow_rules(struct 
bcm_phs_table *psServiceFlowRulesT
 
if (pstClassifierRulesTable) {
for (j = 0; j  MAX_PHSRULE_PER_SF; j++) {
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[j].pstPhsRule) {
+   curr_act_rules_list =
+   
pstClassifierRulesTable-stActivePhsRulesList[j];
 
-   if 
(pstClassifierRulesTable-stActivePhsRulesList[j].pstPhsRule-u8RefCnt)
-   
pstClassifierRulesTable-stActivePhsRulesList[j].pstPhsRule-u8RefCnt--;
+   curr_old_rules_list =
+   
pstClassifierRulesTable-stOldPhsRulesList[j];
 
-   if (0 == 
pstClassifierRulesTable-stActivePhsRulesList[j].pstPhsRule-u8RefCnt)
-   
kfree(pstClassifierRulesTable-stActivePhsRulesList[j].pstPhsRule);
+   if (curr_act_rules_list-pstPhsRule) {
 
-   
pstClassifierRulesTable-stActivePhsRulesList[j].pstPhsRule = NULL;
+   if 
(curr_act_rules_list-pstPhsRule-u8RefCnt)
+   
curr_act_rules_list-pstPhsRule-u8RefCnt--;
+
+   if (0 == 
curr_act_rules_list-pstPhsRule-u8RefCnt)
+   
kfree(curr_act_rules_list-pstPhsRule);
+
+   curr_act_rules_list-pstPhsRule 
= NULL;
}
 
-   if 
(pstClassifierRulesTable-stOldPhsRulesList[j].pstPhsRule) {
+   if (curr_old_rules_list-pstPhsRule) {
 
-   if 
(pstClassifierRulesTable-stOldPhsRulesList[j].pstPhsRule-u8RefCnt)
-   
pstClassifierRulesTable-stOldPhsRulesList[j].pstPhsRule-u8RefCnt--;
+   if 
(curr_old_rules_list-pstPhsRule-u8RefCnt)
+   
curr_old_rules_list-pstPhsRule-u8RefCnt--;
 
-   if (0 == 
pstClassifierRulesTable-stOldPhsRulesList[j].pstPhsRule-u8RefCnt)
-   
kfree(pstClassifierRulesTable-stOldPhsRulesList[j].pstPhsRule);
+   if (0 == 
curr_old_rules_list-pstPhsRule-u8RefCnt)
+   
kfree(curr_old_rules_list-pstPhsRule);
 
-   
pstClassifierRulesTable-stOldPhsRulesList[j].pstPhsRule = NULL;
+   curr_old_rules_list-pstPhsRule 
= NULL;
}
}
kfree(pstClassifierRulesTable);
-- 
2.0.1

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


[PATCH 16/22] Staging: bcm: PHSModule.c: Replaced member accessing with variable in GetServiceFlowEntry()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 47eff76..83bd12b 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -959,12 +959,13 @@ UINT GetServiceFlowEntry(IN struct bcm_phs_table 
*psServiceFlowTable,
 struct bcm_phs_entry **ppstServiceFlowEntry)
 {
int i;
+   struct bcm_phs_entry *curr_sf_list;
 
for (i = 0; i  MAX_SERVICEFLOWS; i++) {
-   if (psServiceFlowTable-stSFList[i].bUsed) {
-   if (psServiceFlowTable-stSFList[i].uiVcid == uiVcid) {
-   *ppstServiceFlowEntry =
-   psServiceFlowTable-stSFList[i];
+   curr_sf_list = psServiceFlowTable-stSFList[i];
+   if (curr_sf_list-bUsed) {
+   if (curr_sf_list-uiVcid == uiVcid) {
+   *ppstServiceFlowEntry = curr_sf_list;
return i;
}
}
-- 
2.0.1

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


[PATCH 14/22] Staging: bcm: PHSModule.c: Rewrote ValidatePHSRuleComplete()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 22 --
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index c290178..9a24845 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -948,24 +948,10 @@ out:
 
 static bool ValidatePHSRuleComplete(IN struct bcm_phs_rule *psPhsRule)
 {
-   if (psPhsRule) {
-   if (!psPhsRule-u8PHSI) {
-   /* PHSI is not valid */
-   return false;
-   }
-
-   if (!psPhsRule-u8PHSS) {
-   /* PHSS Is Undefined */
-   return false;
-   }
-
-   /* Check if PHSF is defines for the PHS Rule */
-   if (!psPhsRule-u8PHSFLength) /* If any part of PHSF is valid 
then Rule contains valid PHSF */
-   return false;
-
-   return TRUE;
-   } else
-   return false;
+   return (psPhsRule 
+   psPhsRule-u8PHSI 
+   psPhsRule-u8PHSS 
+   psPhsRule-u8PHSFLength);
 }
 
 UINT GetServiceFlowEntry(IN struct bcm_phs_table *psServiceFlowTable,
-- 
2.0.1

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


[PATCH 18/22] Staging: bcm: PHSModule.c: Simplified nested if statements by linking them with logical AND in GetServiceFlowEntry()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 5eec706..4074eb8 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -990,11 +990,10 @@ static UINT GetClassifierEntry(IN struct 
bcm_phs_classifier_table *pstClassifier
psClassifierRules =
pstClassifierTable-stOldPhsRulesList[i];
 
-   if (psClassifierRules-bUsed) {
-   if (psClassifierRules-uiClassifierRuleId == uiClsid) {
-   *ppstClassifierEntry = psClassifierRules;
-   return i;
-   }
+   if (psClassifierRules-bUsed 
+  (psClassifierRules-uiClassifierRuleId == uiClsid)) {
+   *ppstClassifierEntry = psClassifierRules;
+   return i;
}
}
 
-- 
2.0.1

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


[PATCH 19/22] Staging: bcm: PHSModule.c: Simplified nested if statements by linking them with logical AND in GetPhsRuleEntry()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 4074eb8..ceb5758 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -1017,11 +1017,10 @@ static UINT GetPhsRuleEntry(IN struct 
bcm_phs_classifier_table *pstClassifierTab
pstClassifierRule =
pstClassifierTable-stOldPhsRulesList[i];
 
-   if (pstClassifierRule-bUsed) {
-   if (pstClassifierRule-u8PHSI == uiPHSI) {
-   *ppstPhsRule = pstClassifierRule-pstPhsRule;
-   return i;
-   }
+   if (pstClassifierRule-bUsed 
+  (pstClassifierRule-u8PHSI == uiPHSI)) {
+   *ppstPhsRule = pstClassifierRule-pstPhsRule;
+   return i;
}
}
 
-- 
2.0.1

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


[PATCH 17/22] Staging: bcm: PHSModule.c: Simplified nested if statements by linking them with logical AND in GetServiceFlowEntry()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 83bd12b..5eec706 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -963,11 +963,9 @@ UINT GetServiceFlowEntry(IN struct bcm_phs_table 
*psServiceFlowTable,
 
for (i = 0; i  MAX_SERVICEFLOWS; i++) {
curr_sf_list = psServiceFlowTable-stSFList[i];
-   if (curr_sf_list-bUsed) {
-   if (curr_sf_list-uiVcid == uiVcid) {
-   *ppstServiceFlowEntry = curr_sf_list;
-   return i;
-   }
+   if (curr_sf_list-bUsed  (curr_sf_list-uiVcid == uiVcid)) {
+   *ppstServiceFlowEntry = curr_sf_list;
+   return i;
}
}
 
-- 
2.0.1

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


[PATCH 20/22] Staging: bcm: PHSModule.c: Replaced member accessing with variable in CreateSFToClassifierRuleMapping()

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index ceb5758..bdc29a5 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -1038,10 +1038,12 @@ static UINT CreateSFToClassifierRuleMapping(IN B_UINT16 
uiVcid,
UINT uiStatus = 0;
int iSfIndex;
bool bFreeEntryFound = false;
+   struct bcm_phs_entry *curr_list;
 
/* Check for a free entry in SFID table */
for (iSfIndex = 0; iSfIndex  MAX_SERVICEFLOWS; iSfIndex++) {
-   if (!psServiceFlowTable-stSFList[iSfIndex].bUsed) {
+   curr_list = psServiceFlowTable-stSFList[iSfIndex];
+   if (!curr_list-bUsed) {
bFreeEntryFound = TRUE;
break;
}
@@ -1050,15 +1052,16 @@ static UINT CreateSFToClassifierRuleMapping(IN B_UINT16 
uiVcid,
if (!bFreeEntryFound)
return ERR_SFTABLE_FULL;
 
-   psaClassifiertable =
-   psServiceFlowTable-stSFList[iSfIndex].pstClassifierTable;
-   uiStatus =
-   CreateClassifierPHSRule(uiClsId, psaClassifiertable, psPhsRule,
-   eActiveClassifierRuleContext, 
u8AssociatedPHSI);
+   psaClassifiertable = curr_list-pstClassifierTable;
+   uiStatus = CreateClassifierPHSRule(uiClsId,
+  psaClassifiertable,
+  psPhsRule,
+  eActiveClassifierRuleContext,
+  u8AssociatedPHSI);
if (uiStatus == PHS_SUCCESS) {
/* Add entry at free index to the SF */
-   psServiceFlowTable-stSFList[iSfIndex].bUsed = TRUE;
-   psServiceFlowTable-stSFList[iSfIndex].uiVcid = uiVcid;
+   curr_list-bUsed = TRUE;
+   curr_list-uiVcid = uiVcid;
}
 
return uiStatus;
-- 
2.0.1

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


Re: [PATCH 7/8] staging: dgap: introduce dgap_cleanup_nodes()

2014-07-15 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 04:32:27PM +0900, DaeSeok Youn wrote:
 2014-07-15 15:41 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
  On Tue, Jul 15, 2014 at 12:04:02PM +0900, Daeseok Youn wrote:
  When a configration file is parsed with dgap_parsefile(),
  makes nodes for saving configrations for board.
 
  Making a node will allocate node memory and strings for saving
  configrations with kstrdup().
 
  So these are freed when dgap is unloaded or failed to initialize.
 
  Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
  ---
  It MUST be needed to prevent memory leaks but
  I'm not sure that I fix properly.
 
  Please review.
 
  This thread doesn't have Mark on the CC list and he's the only person
  who can actually test it properly.  Resend it and CC Mark
  Hounschell ma...@compro.net.
 
 Really? I'd added Mark to CC list.
 hmm.. In your reply doesn't have Mark. I was checking sent-box, he is
 in the CC list.
 
 OK. I will try to send this again after fixing 6/7 and 8/8.
 Thanks.

None of them have Mark CC'd except for the I added him to the reply
about pr_err().  I knew you said you were CC'ing him so I figured
something weird was going on...

regards,
dan carpenter

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


[PATCH 21/22] Staging: bcm: PHSModule.c: Replaced if-else return code with simple return assertion

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index bdc29a5..805ecb0 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -1343,15 +1343,7 @@ static bool DerefPhsRule(IN B_UINT16  uiClsId,
if (pstPhsRule-u8RefCnt)
pstPhsRule-u8RefCnt--;
 
-   if (0 == pstPhsRule-u8RefCnt) {
-   /*
-* if(pstPhsRule-u8PHSI)
-* Store the currently active rule into the old rules list
-* 
CreateClassifierPHSRule(uiClsId,psaClassifiertable,pstPhsRule,eOldClassifierRuleContext,pstPhsRule-u8PHSI);
-*/
-   return TRUE;
-   } else
-   return false;
+   return (0 == pstPhsRule-u8RefCnt);
 }
 
 static void dbg_print_st_cls_entry(struct bcm_mini_adapter *ad,
-- 
2.0.1

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


[PATCH 22/22] Staging: bcm: PHSModule.c: Shortened lines

2014-07-15 Thread Matthias Beyer
This patch shortenes all lines where possible without code refactoring,
as well as comment lines. It does not change the wording of comments.

Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 143 +---
 1 file changed, 89 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index 805ecb0..5f4e503 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -110,9 +110,11 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
UINT unPhsOldHdrSize = 0;
UINT unPHSNewPktHeaderLen = 0;
/* Pointer to PHS IN Hdr Buffer */
-   PUCHAR pucPHSPktHdrInBuf = 
Adapter-stPhsTxContextInfo.ucaHdrSuppressionInBuf;
+   PUCHAR pucPHSPktHdrInBuf =
+   Adapter-stPhsTxContextInfo.ucaHdrSuppressionInBuf;
/* Pointer to PHS OUT Hdr Buffer */
-   PUCHAR pucPHSPktHdrOutBuf = 
Adapter-stPhsTxContextInfo.ucaHdrSuppressionOutBuf;
+   PUCHAR pucPHSPktHdrOutBuf =
+   Adapter-stPhsTxContextInfo.ucaHdrSuppressionOutBuf;
UINT usPacketType;
UINT BytesToRemove = 0;
bool bPHSI = 0;
@@ -144,8 +146,10 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
(unPHSPktHdrBytesCopied = MAX_PHS_LENGTHS)) {
 
/*
-* Step 2 Suppress Header using PHS and fill into intermediate 
ucaPHSPktHdrOutBuf.
-* Suppress only if IP Header and PHS Enabled For the Service 
Flow
+* Step 2 Suppress Header using PHS and fill into intermediate
+* ucaPHSPktHdrOutBuf.
+* Suppress only if IP Header and PHS Enabled For the
+* Service Flow
 */
if (((usPacketType == ETHERNET_FRAMETYPE_IPV4) ||
(usPacketType == ETHERNET_FRAMETYPE_IPV6)) 
@@ -183,7 +187,8 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
PHS Sending packet 
Compressed);
 
if (skb_cloned(Packet)) {
-   newPacket = skb_copy(Packet, 
GFP_ATOMIC);
+   newPacket =
+   skb_copy(Packet, GFP_ATOMIC);
 
if (newPacket == NULL)
return STATUS_FAILURE;
@@ -240,7 +245,8 @@ int PHSTransmit(struct bcm_mini_adapter *Adapter,
}
}
 
-   /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, 
DBG_LVL_ALL,PHSTransmit : Dumping data packet After PHS); */
+   /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_SEND, DBG_LVL_ALL,
+* PHSTransmit : Dumping data packet After PHS); */
return STATUS_SUCCESS;
 }
 
@@ -321,11 +327,12 @@ void DumpFullPacket(UCHAR *pBuf, UINT nPktLen)
 /*
  * Procedure:   phs_init
  *
- * Description: This routine is responsible for allocating memory for 
classifier and
- * PHS rules.
+ * Description: This routine is responsible for allocating memory for 
classifier
+ * and PHS rules.
  *
  * Arguments:
- * pPhsdeviceExtension - ptr to Device extension containing PHS Classifier 
rules and PHS Rules , RX, TX buffer etc
+ * pPhsdeviceExtension - ptr to Device extension containing PHS Classifier 
rules
+ * and PHS Rules , RX, TX buffer etc
  *
  * Returns:
  * TRUE(1) -If allocation of memory was successful.
@@ -438,7 +445,8 @@ ULONG PhsUpdateClassifierRule(IN void *pvContext,
UINT nSFIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
-   struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension 
*)pvContext;
+   struct bcm_phs_extension *pDeviceExtension =
+   (struct bcm_phs_extension *)pvContext;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
PHS With Corr2 Changes\n);
@@ -555,7 +563,9 @@ ULONG PhsDeletePHSRule(IN void *pvContext,
  * 0 if successful,
  * 0 Error.
  */
-ULONG PhsDeleteClassifierRule(IN void *pvContext, IN B_UINT16 uiVcid, IN 
B_UINT16 uiClsId)
+ULONG PhsDeleteClassifierRule(IN void *pvContext,
+ IN B_UINT16 uiVcid,
+ IN B_UINT16 uiClsId)
 {
UINT nSFIndex = 0, nClsidIndex = 0;
struct bcm_phs_entry *pstServiceFlowEntry = NULL;
@@ -702,13 +712,18 @@ out:
  *Exported function to compress the data using PHS.
  *
  * Arguments:
- * IN void* pvContext - PHS Driver Specific Context.
- * IN B_UINT16 uiVcid- The Service Flow ID to which current packet 
header compression applies.
- * IN UINT  uiClsId   - The Classifier ID to which current packet header 
compression applies.
- * IN void *pvInputBuffer - The Input buffer containg packet header data
- * IN void 

[PATCH 13/22] Staging: bcm: PHSModule.c: Replaced indentation level with goto jump on bad condition

2014-07-15 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/PHSModule.c | 61 +
 1 file changed, 32 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c
index d2aa9c9..c290178 100644
--- a/drivers/staging/bcm/PHSModule.c
+++ b/drivers/staging/bcm/PHSModule.c
@@ -895,50 +895,53 @@ static void free_phs_serviceflow_rules(struct 
bcm_phs_table *psServiceFlowRulesT
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, PHS_DISPATCH, DBG_LVL_ALL,
===\n);
 
-   if (psServiceFlowRulesTable) {
-   for (i = 0; i  MAX_SERVICEFLOWS; i++) {
-   struct bcm_phs_entry stServiceFlowEntry =
-   psServiceFlowRulesTable-stSFList[i];
-   struct bcm_phs_classifier_table 
*pstClassifierRulesTable =
-   stServiceFlowEntry.pstClassifierTable;
+   if (!psServiceFlowRulesTable)
+   goto out;
 
-   if (pstClassifierRulesTable) {
-   for (j = 0; j  MAX_PHSRULE_PER_SF; j++) {
-   curr_act_rules_list =
-   
pstClassifierRulesTable-stActivePhsRulesList[j];
+   for (i = 0; i  MAX_SERVICEFLOWS; i++) {
+   struct bcm_phs_entry stServiceFlowEntry =
+   psServiceFlowRulesTable-stSFList[i];
+   struct bcm_phs_classifier_table *pstClassifierRulesTable =
+   stServiceFlowEntry.pstClassifierTable;
 
-   curr_old_rules_list =
-   
pstClassifierRulesTable-stOldPhsRulesList[j];
+   if (pstClassifierRulesTable) {
+   for (j = 0; j  MAX_PHSRULE_PER_SF; j++) {
+   curr_act_rules_list =
+   
pstClassifierRulesTable-stActivePhsRulesList[j];
 
-   if (curr_act_rules_list-pstPhsRule) {
+   curr_old_rules_list =
+   
pstClassifierRulesTable-stOldPhsRulesList[j];
 
-   if 
(curr_act_rules_list-pstPhsRule-u8RefCnt)
-   
curr_act_rules_list-pstPhsRule-u8RefCnt--;
+   if (curr_act_rules_list-pstPhsRule) {
 
-   if (0 == 
curr_act_rules_list-pstPhsRule-u8RefCnt)
-   
kfree(curr_act_rules_list-pstPhsRule);
+   if 
(curr_act_rules_list-pstPhsRule-u8RefCnt)
+   
curr_act_rules_list-pstPhsRule-u8RefCnt--;
 
-   curr_act_rules_list-pstPhsRule 
= NULL;
-   }
+   if (0 == 
curr_act_rules_list-pstPhsRule-u8RefCnt)
+   
kfree(curr_act_rules_list-pstPhsRule);
 
-   if (curr_old_rules_list-pstPhsRule) {
+   curr_act_rules_list-pstPhsRule = NULL;
+   }
 
-   if 
(curr_old_rules_list-pstPhsRule-u8RefCnt)
-   
curr_old_rules_list-pstPhsRule-u8RefCnt--;
+   if (curr_old_rules_list-pstPhsRule) {
 
-   if (0 == 
curr_old_rules_list-pstPhsRule-u8RefCnt)
-   
kfree(curr_old_rules_list-pstPhsRule);
+   if 
(curr_old_rules_list-pstPhsRule-u8RefCnt)
+   
curr_old_rules_list-pstPhsRule-u8RefCnt--;
 
-   curr_old_rules_list-pstPhsRule 
= NULL;
-   }
+   if (0 == 
curr_old_rules_list-pstPhsRule-u8RefCnt)
+   
kfree(curr_old_rules_list-pstPhsRule);
+
+   curr_old_rules_list-pstPhsRule = NULL;
}
-   kfree(pstClassifierRulesTable);
-   stServiceFlowEntry.pstClassifierTable =
-   pstClassifierRulesTable = NULL;
}
+   kfree(pstClassifierRulesTable);
+   stServiceFlowEntry.pstClassifierTable =
+   pstClassifierRulesTable = NULL;
}
}
 
+out:
+
kfree(psServiceFlowRulesTable);

Re: [PATCH 06/22] Staging: bcm: PHSModule.c: Reduced indentation level by using jump label

2014-07-15 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 09:42:59AM +0200, Matthias Beyer wrote:

 +
 +out:
   return 0;

Don't do these do-nothing gotos.  Just return directly.

When you are reading the code and you see a goto then you have to think
Oh, I wonder what the goto does?  If has a good name like
err_free_foo then you probably can guess that it frees foo.  If it
says goto out then you probably assume it releases a lock or something
but which lock??  So then you have to jump to the bottom of the screen
to find out.

Once you read the bottom of the screen, you see that it is a pointless
waste of time goto which doesn't do anything at all.  And now you have
lost your place in the code and your train of thought has been de-railed
so you have to figure out where you were and what you were doing before
you started on this wild goose chase.

Don't do that.

regards,
dan carpenter


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


Re: [PATCH 06/22] Staging: bcm: PHSModule.c: Reduced indentation level by using jump label

2014-07-15 Thread Dan Carpenter
Btw, a jump label is something different.  This is just a regular goto.

http://lwn.net/Articles/412072/
http://lwn.net/Articles/436041/

regards,
dan carpenter

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


Re: [PATCH 8/8] staging: dgap: fix memory leak in dgap_parsefile()

2014-07-15 Thread DaeSeok Youn
2014-07-15 15:51 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
 On Tue, Jul 15, 2014 at 12:05:14PM +0900, Daeseok Youn wrote:
 The p-u.board.status is allocated and set a string as
 No once within allocating a node of BNODE type.
 But it also set again with kstrdup() in case of STATUS
 or ID. If it is not allocated yet, use kstrdup().
 If not, use just memcpy().

 I don't think a 2 char buffer is always large enough to hold the new
 strings.

 Just free it and allocate again.
Yes, I will send this again.

Thanks.

regards,
Daeseok Youn.

 regards,
 dan carpenter

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


[PATCH 6/8 V2] staging: dgap: remove unneeded dgap_err()

2014-07-15 Thread Daeseok Youn
The dgap_err() is printing a message with pr_err(),
so all those are replaced.

Use definition pr_fmt and then all of dgap: in
the beginning of print messages are removed.

And also removed out of memory message because
the kernel has own message for that.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
V2: use pr_fmt dgap: prefix on print message on dgap.
remove out of memory message.

Adds Mark to TO list and CC list for checking send
this email properly to him.

 drivers/staging/dgap/dgap.c |  306 +++
 1 files changed, 133 insertions(+), 173 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 06c55cb..9e750fb 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -41,6 +41,8 @@
  */
 #undef DIGI_CONCENTRATORS_SUPPORTED
 
+#define pr_fmt(fmt) dgap:  fmt
+
 #include linux/kernel.h
 #include linux/module.h
 #include linux/pci.h
@@ -153,7 +155,6 @@ static void dgap_firmware_reset_port(struct channel_t *ch);
 static int dgap_gettok(char **in);
 static char *dgap_getword(char **in);
 static int dgap_checknode(struct cnode *p);
-static void dgap_err(char *s);
 
 /*
  * Function prototypes from dgap_sysfs.h
@@ -815,7 +816,7 @@ static struct board_t *dgap_found_board(struct pci_dev 
*pdev, int id,
if (ret)
goto free_brd;
 
-   pr_info(dgap: board %d: %s (rev %d), irq %ld\n,
+   pr_info(board %d: %s (rev %d), irq %ld\n,
boardnum, brd-name, brd-rev, brd-irq);
 
return brd;
@@ -875,7 +876,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(fw, fw_info[card_type].conf_name,
 pdev-dev);
if (ret) {
-   pr_err(dgap: config file %s not found\n,
+   pr_err(config file %s not found\n,
fw_info[card_type].conf_name);
return ret;
}
@@ -920,7 +921,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
dgap_find_config(PAPORT4, brd-pci_bus, brd-pci_slot);
 
if (!brd-bd_config) {
-   pr_err(dgap: No valid configuration found\n);
+   pr_err(No valid configuration found\n);
return -EINVAL;
}
 
@@ -928,7 +929,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(fw, fw_info[card_type].bios_name,
pdev-dev);
if (ret) {
-   pr_err(dgap: bios file %s not found\n,
+   pr_err(bios file %s not found\n,
fw_info[card_type].bios_name);
return ret;
}
@@ -945,7 +946,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(fw, fw_info[card_type].fep_name,
pdev-dev);
if (ret) {
-   pr_err(dgap: fep file %s not found\n,
+   pr_err(fep file %s not found\n,
fw_info[card_type].fep_name);
return ret;
}
@@ -974,7 +975,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(fw, fw_info[card_type].con_name,
pdev-dev);
if (ret) {
-   pr_err(dgap: conc file %s not found\n,
+   pr_err(conc file %s not found\n,
fw_info[card_type].con_name);
return ret;
}
@@ -1379,17 +1380,17 @@ static int dgap_tty_init(struct board_t *brd)
 
if (true_count != brd-nasync) {
if ((brd-type == PPCM)  (true_count == 64)) {
-   pr_warn(dgap: %s configured for %d ports, has %d 
ports.\n,
+   pr_warn(%s configured for %d ports, has %d ports.\n,
brd-name, brd-nasync, true_count);
-   pr_warn(dgap: Please make SURE the EBI cable running 
from the card\n);
-   pr_warn(dgap: to each EM module is plugged into EBI 
IN!\n);
+   pr_warn(Please make SURE the EBI cable running from 
the card\n);
+   pr_warn(to each EM module is plugged into EBI IN!\n);
} else if ((brd-type == PPCM)  (true_count == 0)) {
-   pr_warn(dgap: %s configured for %d ports, has %d 
ports.\n,
+   pr_warn(%s configured for %d ports, has %d ports.\n,
brd-name, brd-nasync, true_count);
-   pr_warn(dgap: Please make SURE the EBI cable running 
from the card\n);
-   

[PATCH 7/8 RESEND] staging: dgap: introduce dgap_cleanup_nodes()

2014-07-15 Thread Daeseok Youn
When a configration file is parsed with dgap_parsefile(),
makes nodes for saving configrations for board.

Making a node will allocate node memory and strings for saving
configrations with kstrdup().

So these are freed when dgap is unloaded or failed to initialize.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
RESEND: Adds Mark to TO list and CC list for
checking send this email properly to him.
And also he can verify this patch.

 drivers/staging/dgap/dgap.c |   47 +++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 9e750fb..e4ea68b 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -202,6 +202,7 @@ static int dgap_test_fep(struct board_t *brd);
 static int dgap_tty_register_ports(struct board_t *brd);
 static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
  struct board_t *brd);
+static void dgap_cleanup_nodes(void);
 
 static void dgap_cleanup_module(void);
 
@@ -620,6 +621,7 @@ unregister_tty:
 free_flipbuf:
dgap_free_flipbuf(brd);
 cleanup_brd:
+   dgap_cleanup_nodes();
dgap_release_remap(brd);
kfree(brd);
 
@@ -660,6 +662,8 @@ static void dgap_cleanup_module(void)
dgap_cleanup_board(dgap_board[i]);
}
 
+   dgap_cleanup_nodes();
+
if (dgap_numboards)
pci_unregister_driver(dgap_driver);
 }
@@ -6324,6 +6328,49 @@ static void dgap_remove_tty_sysfs(struct device *c)
sysfs_remove_group(c-kobj, dgap_tty_attribute_group);
 }
 
+static void dgap_cleanup_nodes(void)
+{
+   struct cnode *p;
+
+   p = dgap_head;
+
+   while (p) {
+   struct cnode *tmp = p-next;
+
+   switch (p-type) {
+   case BNODE:
+   kfree(p-u.board.portstr);
+   kfree(p-u.board.addrstr);
+   kfree(p-u.board.pcibusstr);
+   kfree(p-u.board.pcislotstr);
+   kfree(p-u.board.method);
+   break;
+   case CNODE:
+   kfree(p-u.conc.id);
+   kfree(p-u.conc.connect);
+   break;
+   case MNODE:
+   kfree(p-u.module.id);
+   break;
+   case TNODE:
+   kfree(p-u.ttyname);
+   break;
+   case CUNODE:
+   kfree(p-u.cuname);
+   break;
+   case LNODE:
+   kfree(p-u.line.cable);
+   break;
+   case PNODE:
+   kfree(p-u.printname);
+   break;
+   }
+
+   kfree(p-u.board.status);
+   kfree(p);
+   p = tmp;
+   }
+}
 /*
  * Parse a configuration file read into memory as a string.
  */
-- 
1.7.1

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


[PATCH 8/8 V2] staging: dgap: fix memory leak in dgap_parsefile()

2014-07-15 Thread Daeseok Youn
The p-u.board.status is allocated and set a string as
No once within allocating a node of BNODE type.
But it also set again with kstrdup() in case of STATUS
or ID. So just free this buffer and allocate again with
kstrdup().

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
V2: just use kfree for buffers which assigned to newly value
and then allocate again properly.

 drivers/staging/dgap/dgap.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index e4ea68b..76503fe 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6599,6 +6599,8 @@ static int dgap_parsefile(char **in)
pr_err(parse: unexpected end of file\n);
return -1;
}
+
+   kfree(p-u.board.status);
p-u.board.status = kstrdup(s, GFP_KERNEL);
break;
 
@@ -6649,6 +6651,7 @@ static int dgap_parsefile(char **in)
return -1;
}
 
+   kfree(p-u.board.status);
p-u.board.status = kstrdup(s, GFP_KERNEL);
 
if (p-type == CNODE) {
-- 
1.7.1

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


Re: [PATCH 8/8] staging: dgap: fix memory leak in dgap_parsefile()

2014-07-15 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 06:05:35PM +0900, DaeSeok Youn wrote:
 2014-07-15 15:51 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
  On Tue, Jul 15, 2014 at 12:05:14PM +0900, Daeseok Youn wrote:
  The p-u.board.status is allocated and set a string as
  No once within allocating a node of BNODE type.
  But it also set again with kstrdup() in case of STATUS
  or ID. If it is not allocated yet, use kstrdup().
  If not, use just memcpy().
 
  I don't think a 2 char buffer is always large enough to hold the new
  strings.
 
  Just free it and allocate again.
 Yes, I will send this again.
 

Actually, please just send the whole set again.  I really want Mark on
the CC list so he's reviewing these.

regards,
dan carpenter

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


Re: [PATCH 92/93] Staging: comedi: 8255: fixed by adding an empthy line

2014-07-15 Thread Ian Abbott

On 2014-07-15 04:15, sam-the-6 wrote:

From: Sam Asadi asadi.sam...@gmail.com

fixed a coding style issue.

Signed-off-by: Sam Asadi asadi.sam...@gmail.com
modified:   drivers/staging/comedi/drivers/8255.c
---
  drivers/staging/comedi/drivers/8255.c |  150 -
  1 file changed, 74 insertions(+), 76 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8255.c 
b/drivers/staging/comedi/drivers/8255.c
index 46113a3..de273c7 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -1,77 +1,73 @@
  /*
-comedi/drivers/8255.c
-Driver for 8255
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1998 David A. Schleef d...@schleef.org
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   comedi/drivers/8255.c
+   Driver for 8255
+
+   COMEDI - Linux Control and Measurement Device Interface
+   Copyright (C) 1998 David A. Schleef d...@schleef.org
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   Driver: 8255
+   Description: generic 8255 support
+   Devices: [standard] 8255 (8255)
+   Author: ds
+   Status: works
+   Updated: Fri,  7 Jun 2002 12:56:45 -0700
+
+   The classic in digital I/O.  The 8255 appears in Comedi as a single
+   digital I/O subdevice with 24 channels.  The channel 0 corresponds
+   to the 8255's port A, bit 0; channel 23 corresponds to port C, bit
+   7.  Direction configuration is done in blocks, with channels 0-7,
+   8-15, 16-19, and 20-23 making up the 4 blocks.  The only 8255 mode
+   supported is mode 0.
+
+   You should enable compilation this driver if you plan to use a board
+   that has an 8255 chip.  For multifunction boards, the main driver will
+   configure the 8255 subdevice automatically.
+
+   This driver also works independently with ISA and PCI cards that
+   directly map the 8255 registers to I/O ports, including cards with
+   multiple 8255 chips.  To configure the driver for such a card, the
+   option list should be a list of the I/O port bases for each of the
+   8255 chips.  For example,
+
+   comedi_config /dev/comedi0 8255 0x200,0x204,0x208,0x20c
+
+   Note that most PCI 8255 boards do NOT work with this driver, and
+   need a separate driver as a wrapper.  For those that do work, the
+   I/O port base address can be found in the output of 'lspci -v'.
+
+   This file contains an exported subdevice for driving an 8255.
+
+   To use this subdevice as part of another driver, you need to
+   set up the subdevice in the attach function of the driver by
+   calling:
+
+   subdev_8255_init(device, subdevice, io_function, iobase)
+
+   device and subdevice are pointers to the device and subdevice
+   structures.  io_function will be called to provide the
+   low-level input/output to the device, i.e., actual register
+   access.  io_function will be called with the value of iobase
+   as the last parameter.  If the 8255 device is mapped as 4
+   consecutive I/O ports, you can use NULL for io_function
+   and the I/O port base for iobase, and an internal function will
+   handle the register access.
+
+   In addition, if the main driver handles interrupts, you can
+   enable commands on the subdevice by calling subdev_8255_init_irq()
+   instead.  Then, when you get an interrupt that is likely to be
+   from the 8255, you should call subdev_8255_interrupt(), which
+   will copy the latched value to a Comedi buffer.
  */
-/*
-Driver: 8255
-Description: generic 8255 support
-Devices: [standard] 8255 (8255)
-Author: ds
-Status: works
-Updated: Fri,  7 Jun 2002 12:56:45 -0700
-
-The classic in digital I/O.  The 8255 appears in Comedi as a single
-digital I/O subdevice with 24 channels.  The channel 0 corresponds
-to the 8255's port A, bit 0; channel 23 corresponds to port C, bit
-7.  Direction configuration is done in blocks, with 

Re: [PATCH 8/8] staging: dgap: fix memory leak in dgap_parsefile()

2014-07-15 Thread DaeSeok Youn
2014-07-15 18:21 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
 On Tue, Jul 15, 2014 at 06:05:35PM +0900, DaeSeok Youn wrote:
 2014-07-15 15:51 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
  On Tue, Jul 15, 2014 at 12:05:14PM +0900, Daeseok Youn wrote:
  The p-u.board.status is allocated and set a string as
  No once within allocating a node of BNODE type.
  But it also set again with kstrdup() in case of STATUS
  or ID. If it is not allocated yet, use kstrdup().
  If not, use just memcpy().
 
  I don't think a 2 char buffer is always large enough to hold the new
  strings.
 
  Just free it and allocate again.
 Yes, I will send this again.


 Actually, please just send the whole set again.  I really want Mark on
 the CC list so he's reviewing these.
OK. I already sent 6/8, 7/8 and 8/8 again. I just resend rest of them.

thanks.

regards,
Daeseok Youn

 regards,
 dan carpenter

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


[PATCH 1/8 RESEND] staging: dgap: remove redundant error value check

2014-07-15 Thread Daeseok Youn
The retval in dgap_block_til_ready() is initialized to zero,
and if no error has occurred in this function, the retval has a zero.
So it doesn't need to check retval itself.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
RESEND: Adds Mark to TO list and CC list for checking
send this email properly to him.

 drivers/staging/dgap/dgap.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 32988a8..10bd0f2 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -2181,10 +2181,7 @@ static int dgap_block_til_ready(struct tty_struct *tty, 
struct file *file,
 
spin_unlock_irqrestore(ch-ch_lock, lock_flags);
 
-   if (retval)
-   return retval;
-
-   return 0;
+   return retval;
 }
 
 /*
-- 
1.7.1

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


[PATCH 2/8 RESEND] staging: dgap: remove unused case value in dgap_parsefile()

2014-07-15 Thread Daeseok Youn
If rc is zero, this function will returns with an error and
cannot reach switch-case statement.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
RESEND : Adds Mark to TO list and CC list for checking
send this email properly to him.

 drivers/staging/dgap/dgap.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 10bd0f2..470ae7b 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6357,10 +6357,6 @@ static int dgap_parsefile(char **in)
}
 
switch (rc) {
-   case 0:
-   dgap_err(unexpected end of file);
-   return -1;
-
case BEGIN: /* should only be 1 begin */
dgap_err(unexpected config_begin\n);
return -1;
-- 
1.7.1

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


[PATCH 3/8 RESEND] staging: dgap: fix a typo in dgap_gettok()

2014-07-15 Thread Daeseok Youn
The boar should be board.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
RESEND : Adds Mark to TO list and CC list for checking send this email
properly to him.

 drivers/staging/dgap/dgap.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 470ae7b..17514c8 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -7105,7 +7105,7 @@ static int dgap_gettok(char **in, struct cnode *p)
char *w;
struct toklist *t;
 
-   if (strstr(dgap_cword, boar)) {
+   if (strstr(dgap_cword, board)) {
w = dgap_getword(in);
snprintf(dgap_cword, MAXCWORD, %s, w);
for (t = dgap_tlist; t-token != 0; t++) {
-- 
1.7.1

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


[PATCH 4/8 RESEND] staging: dgap: remove unused a parameter in dgap_gettok()

2014-07-15 Thread Daeseok Youn
The p as parameter is unused.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
RESEND : Adds Mark to TO list and CC list for checking send this email
properly to him.

 drivers/staging/dgap/dgap.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 17514c8..1e52092 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -150,7 +150,7 @@ static void dgap_firmware_reset_port(struct channel_t *ch);
 /*
  * Function prototypes from dgap_parse.c.
  */
-static int dgap_gettok(char **in, struct cnode *p);
+static int dgap_gettok(char **in);
 static char *dgap_getword(char **in);
 static struct cnode *dgap_newnode(int t);
 static int dgap_checknode(struct cnode *p);
@@ -6342,7 +6342,7 @@ static int dgap_parsefile(char **in)
p = p-next;
 
/* file must start with a BEGIN */
-   while ((rc = dgap_gettok(in, p)) != BEGIN) {
+   while ((rc = dgap_gettok(in)) != BEGIN) {
if (rc == 0) {
dgap_err(unexpected EOF);
return -1;
@@ -6350,7 +6350,7 @@ static int dgap_parsefile(char **in)
}
 
for (; ;) {
-   rc = dgap_gettok(in, p);
+   rc = dgap_gettok(in);
if (rc == 0) {
dgap_err(unexpected EOF);
return -1;
@@ -7100,7 +7100,7 @@ static char *dgap_sindex(char *string, char *group)
 /*
  * Get a token from the input file; return 0 if end of file is reached
  */
-static int dgap_gettok(char **in, struct cnode *p)
+static int dgap_gettok(char **in)
 {
char *w;
struct toklist *t;
-- 
1.7.1

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


[PATCH 5/8 RESEND] staging: dgap: remove dgap_newnode()

2014-07-15 Thread Daeseok Youn
The dgap_newnode() is useless for creating new node.
So just use kzalloc and set a type in case statement.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
RESEND : Adds Mark to TO list and CC list for checking send this email
properly to him.

 drivers/staging/dgap/dgap.c |  104 ++
 1 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 1e52092..06c55cb 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -152,7 +152,6 @@ static void dgap_firmware_reset_port(struct channel_t *ch);
  */
 static int dgap_gettok(char **in);
 static char *dgap_getword(char **in);
-static struct cnode *dgap_newnode(int t);
 static int dgap_checknode(struct cnode *p);
 static void dgap_err(char *s);
 
@@ -6367,13 +6366,15 @@ static int dgap_parsefile(char **in)
case BOARD: /* board info */
if (dgap_checknode(p))
return -1;
-   p-next = dgap_newnode(BNODE);
+
+   p-next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p-next) {
dgap_err(out of memory);
return -1;
}
p = p-next;
 
+   p-type = BNODE;
p-u.board.status = kstrdup(No, GFP_KERNEL);
line = conc = NULL;
brd = p;
@@ -6658,12 +6659,16 @@ static int dgap_parsefile(char **in)
case TTYN:  /* tty name prefix */
if (dgap_checknode(p))
return -1;
-   p-next = dgap_newnode(TNODE);
+
+   p-next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p-next) {
dgap_err(out of memory);
return -1;
}
+
p = p-next;
+   p-type = TNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err(unexpeced end of file);
@@ -6679,12 +6684,16 @@ static int dgap_parsefile(char **in)
case CU:/* cu name prefix */
if (dgap_checknode(p))
return -1;
-   p-next = dgap_newnode(CUNODE);
+
+   p-next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p-next) {
dgap_err(out of memory);
return -1;
}
+
p = p-next;
+   p-type = CUNODE;
+
s = dgap_getword(in);
if (!s) {
dgap_err(unexpeced end of file);
@@ -6709,12 +6718,15 @@ static int dgap_parsefile(char **in)
dgap_err(line not vaild for PC/em);
return -1;
}
-   p-next = dgap_newnode(LNODE);
+
+   p-next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p-next) {
dgap_err(out of memory);
return -1;
}
+
p = p-next;
+   p-type = LNODE;
conc = NULL;
line = p;
linecnt++;
@@ -6727,13 +6739,17 @@ static int dgap_parsefile(char **in)
dgap_err(must specify line info before 
concentrator);
return -1;
}
-   p-next = dgap_newnode(CNODE);
+
+   p-next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p-next) {
dgap_err(out of memory);
return -1;
}
+
p = p-next;
+   p-type = CNODE;
conc = p;
+
if (linecnt)
brd-u.board.conc2++;
else
@@ -6776,12 +6792,15 @@ static int dgap_parsefile(char **in)
return -1;
}
}
-   p-next = dgap_newnode(MNODE);
+
+   p-next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p-next) {
dgap_err(out of memory);
return -1;
}
p = p-next;
+   p-type = MNODE;
+

Re: [PATCH 93/93] Staging: comedi: adl_pci9118: fixed style issues

2014-07-15 Thread Ian Abbott

On 2014-07-15 04:17, sam-the-6 wrote:

From: Sam Asadi asadi.sam...@gmail.com

several style issues fixed.

Signed-off-by: Sam Asadi asadi.sam...@gmail.com

modified:   drivers/staging/comedi/drivers/adl_pci9118.c
---
  drivers/staging/comedi/drivers/adl_pci9118.c |  124 +-
  1 file changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 59a65cb..7139f87 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -8,59 +8,63 @@
   * Author: Michal Dobes do...@tesnet.cz
   *
  */
-/*
-Driver: adl_pci9118
-Description: Adlink PCI-9118DG, PCI-9118HG, PCI-9118HR
-Author: Michal Dobes do...@tesnet.cz
-Devices: [ADLink] PCI-9118DG (pci9118dg), PCI-9118HG (pci9118hg),
-  PCI-9118HR (pci9118hr)
-Status: works
-
-This driver supports AI, AO, DI and DO subdevices.
-AI subdevice supports cmd and insn interface,
-other subdevices support only insn interface.
-For AI:
-- If cmd-scan_begin_src=TRIG_EXT then trigger input is TGIN (pin 46).
-- If cmd-convert_src=TRIG_EXT then trigger input is EXTTRG (pin 44).
-- If cmd-start_src/stop_src=TRIG_EXT then trigger input is TGIN (pin 46).
-- It is not necessary to have cmd.scan_end_arg=cmd.chanlist_len but
-  cmd.scan_end_arg modulo cmd.chanlist_len must by 0.
-- If return value of cmdtest is 5 then you've bad channel list
-  (it isn't possible mixture S.E. and DIFF inputs or bipolar and unipolar
-  ranges).
-
-There are some hardware limitations:
-a) You cann't use mixture of unipolar/bipoar ranges or differencial/single
-   ended inputs.
-b) DMA transfers must have the length aligned to two samples (32 bit),
-   so there is some problems if cmd-chanlist_len is odd. This driver tries
-   bypass this with adding one sample to the end of the every scan and discard
-   it on output but this cann't be used if cmd-scan_begin_src=TRIG_FOLLOW
-   and is used flag TRIG_WAKE_EOS, then driver switch to interrupt driven mode
-   with interrupt after every sample.
-c) If isn't used DMA then you can use only mode where
-   cmd-scan_begin_src=TRIG_FOLLOW.
-
-Configuration options:
-  [0] - PCI bus of device (optional)
-  [1] - PCI slot of device (optional)
-   If bus/slot is not specified, then first available PCI
-   card will be used.
-  [2] - 0= standard 8 DIFF/16 SE channels configuration
-   n = external multiplexer connected, 1 = n = 256
-  [3] - 0=autoselect DMA or EOC interrupts operation
-   1 = disable DMA mode
-   3 = disable DMA and INT, only insn interface will work
-  [4] - samplehold signal - card can generate signal for external SH board
-   0 = use SSHO(pin 45) signal is generated in onboard hardware SH logic
-   0 != use ADCHN7(pin 23) signal is generated from driver, number say how
-   long delay is requested in ns and sign polarity of the hold
-   (in this case external multiplexor can serve only 128 channels)
-  [5] - 0=stop measure on all hardware errors
-   2 | = ignore ADOR - A/D Overrun status
-   8|=ignore Bover - A/D Burst Mode Overrun status
-   256|=ignore nFull - A/D FIFO Full status

+/*
+ Driver: adl_pci9118
+ Description: Adlink PCI-9118DG, PCI-9118HG, PCI-9118HR
+ Author: Michal Dobes do...@tesnet.cz
+ Devices: [ADLink] PCI-9118DG (pci9118dg), PCI-9118HG (pci9118hg),
+ PCI-9118HR (pci9118hr)
+ Status: works
+
+ This driver supports AI, AO, DI and DO subdevices.
+ AI subdevice supports cmd and insn interface,
+ other subdevices support only insn interface.
+ For AI:
+ - If cmd-scan_begin_src=TRIG_EXT then trigger input is TGIN (pin 46).
+ - If cmd-convert_src=TRIG_EXT then trigger input is EXTTRG (pin 44).
+ - If cmd-start_src/stop_src=TRIG_EXT then trigger input is TGIN (pin 46).
+ - It is not necessary to have cmd.scan_end_arg=cmd.chanlist_len but
+   cmd.scan_end_arg modulo cmd.chanlist_len must by 0.
+ - If return value of cmdtest is 5 then you've bad channel list
+   (it isn't possible mixture S.E. and DIFF inputs or bipolar and unipolar
+   ranges).
+
+ There are some hardware limitations:
+ a) You cann't use mixture of unipolar/bipoar ranges or differencial/single
+   ended inputs.
+ b) DMA transfers must have the length aligned to two samples (32 bit),
+   so there is some problems if cmd-chanlist_len is odd. This driver
+   tries bypass this with adding one sample to the end of the every scan
+   and discard it on output but this cann't be used if
+   cmd-scan_begin_src=TRIG_FOLLOW and is used flag TRIG_WAKE_EOS, then
+   driver switch to interrupt driven mode with interrupt after every
+   sample.
+ c) If isn't used DMA then you can use only mode where
+   cmd-scan_begin_src=TRIG_FOLLOW.
+
+ Configuration options:
+   [0] - PCI bus of device (optional)
+   [1] - PCI slot of 

Re: [PATCH 2/2] staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice

2014-07-15 Thread Ian Abbott

On 2014-07-15 05:00, Chase Southwood wrote:

On Mon, Jul 14, 2014 at 4:22 AM, Ian Abbott abbo...@mev.co.uk wrote:

On 2014-07-12 23:44, Chase Southwood wrote:


Use the addi_watchdog module to provide support for the watchdog
subdevice.

Also, rearrange the subdevice init blocks so that the order makes sense.
Digital input/output subdevices and subdevices for DI/DO interrupt
support, followed by timer/counter/watchdog subdevices is the new order.

Signed-off-by: Chase Southwood chase.southw...@gmail.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: H Hartley Sweeten hswee...@visionengravers.com
---
   drivers/staging/comedi/drivers/addi_apci_1564.c | 34
+++--
   1 file changed, 20 insertions(+), 14 deletions(-)



I don't think the subdevice order matters that much, and I prefer to keep
them stable, but since this driver is in such a state of flux, it doesn't
really matter.



Hi Ian!
Quick question here about this.  First off, duly noted that grouping
subdevices by function isn't necessary and I won't shuffle them around
like this in the future.  Second, the reason I stuck the watchdog at
the end is because it causes an early return if addi_watchdog_init()
returns an error and it seemed  appropriate at the end so it doesn't
prevent the initialization of any other subdevices if that call should
fail.  Now I realize that it is very unlikely that that call fails,
but in any case should I put future subdevice inits above the watchdog
for the same reason (so they aren't at risk of not getting
initialized), or does that count for subdevice order not being stable
and you would prefer them all to go at the end?


Since you return an error from the auto_attach handler 
apci1564_auto_attach() when addi_watchdog_init() fails, it makes little 
difference what order the subdevices are initialized in.  The error from 
auto_attach handler causes the comedi core to call the detach handler 
apci1564_detach() and tear everything down.  Ultimately, 
comedi_pci_auto_attach() will return an error back to the PCI probe 
function apci1564_pci_probe(), which will propagate it to the PCI subsystem.


In general, if adding a new subdevice, either add it to the end or 
replace an unused subdevice.


--
-=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 91/93] Staging: comedi: 8253.h fixed by removing 'return' from generic func

2014-07-15 Thread Ian Abbott

On 2014-07-15 04:13, sam-the-6 wrote:

From: Sam Asadi asadi.sam...@gmail.com

Signed-off-by: Sam Asadi asadi.sam...@gmail.com

modified:   drivers/staging/comedi/drivers/8253.h
---
  drivers/staging/comedi/drivers/8253.h |3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8253.h 
b/drivers/staging/comedi/drivers/8253.h
index 5829b46..f6b8607 100644
--- a/drivers/staging/comedi/drivers/8253.h
+++ b/drivers/staging/comedi/drivers/8253.h
@@ -55,7 +55,7 @@ static inline void i8253_cascade_ns_to_timer(int 
i8253_osc_base,
/* check for overflow */
divider  div1  divider  div2 
divider * i8253_osc_base  divider 
-   divider * i8253_osc_base  i8253_osc_base) {
+   divider * i8253_osc_base  i8253_osc_base)   {


Keep the space before the '{'.  Don't replace it with a tab.


return;
}

@@ -118,7 +118,6 @@ static inline void i8253_cascade_ns_to_timer(int 
i8253_osc_base,
/*  masking is done since counter maps zero to 0x1 */
*d1 = div1  0x;
*d2 = div2  0x;
-   return;
  }

  #ifndef CMDTEST




--
-=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 0/5] staging:iio:hmc5843: Few adjustments and support for hmc5983

2014-07-15 Thread Josef Gajdusek
This patch series modifies the hmc5843 driver to support the hmc5983 i2c and
spi interfaces.

v2:
* Reverted the changed order of iio unregister and setting hmc mode to 
sleep

v3:
* Fixed bug introduced in the first patch
* Readded few comment lines which have gone missing in the hmc5843.c -
  hmc5843_core.c move

v4: 
* Changes suggested by Lars in https://lkml.org/lkml/2014/7/14/968
  * The i2c and spi drivers are now user-selectable with the core driver
being selected automatically
  * The regmap_config structs in both _spi and _i2c files are now static
  * The iio_dev allocation is now done in the common function
  * pm ops are now defined in the header file and the same definition is
shared between both interface-specific drivers
* regmap tables in hmc5843.h are not longer static (this fixed bunch of 
  variable not used warnings)

Jonathan, the patch series applies cleanly against mainline (for me at least), 
maybe you already have some hmc5843 related patches in your tree which are not 
yet in upstream? (probably https://lkml.org/lkml/2014/2/14/312)

Josef Gajdusek (5):
  staging:iio:hmc5843: Added regmap support
  staging:iio:hmc5843: Split hmc5843.c to multiple files
  staging:iio:hmc5843: register - value arrays now can have different
lengths
  staging:iio:hmc5843: Add support for i2c hmc5983
  staging:iio:hmc5843: Add support for spi hmc5983

 drivers/staging/iio/magnetometer/Kconfig|  30 +-
 drivers/staging/iio/magnetometer/Makefile   |   4 +-
 drivers/staging/iio/magnetometer/hmc5843.c  | 652 
 drivers/staging/iio/magnetometer/hmc5843.h  |  86 
 drivers/staging/iio/magnetometer/hmc5843_core.c | 638 +++
 drivers/staging/iio/magnetometer/hmc5843_i2c.c  |  74 +++
 drivers/staging/iio/magnetometer/hmc5843_spi.c  |  73 +++
 7 files changed, 900 insertions(+), 657 deletions(-)
 delete mode 100644 drivers/staging/iio/magnetometer/hmc5843.c
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843.h
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_core.c
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_i2c.c
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_spi.c

-- 
1.8.5.5

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


[PATCH v4 2/5] staging:iio:hmc5843: Split hmc5843.c to multiple files

2014-07-15 Thread Josef Gajdusek
This patch splits hmc5843.c to multiple files - the interface-agnostic
hmc5843_core.c, i2c specific hmc5843_i2c.c and header file hmc5843.h. This is
another step to add support of SPI-enabled hmc5983.

Signed-off-by: Josef Gajdusek a...@atx.name
---
 drivers/staging/iio/magnetometer/Kconfig   |  14 +-
 drivers/staging/iio/magnetometer/Makefile  |   3 +-
 drivers/staging/iio/magnetometer/hmc5843.h |  85 
 .../iio/magnetometer/{hmc5843.c = hmc5843_core.c} | 152 +
 drivers/staging/iio/magnetometer/hmc5843_i2c.c |  73 ++
 5 files changed, 201 insertions(+), 126 deletions(-)
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843.h
 rename drivers/staging/iio/magnetometer/{hmc5843.c = hmc5843_core.c} (80%)
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_i2c.c

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index ad88d61..0a27f98 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -4,16 +4,22 @@
 menu Magnetometer sensors
 
 config SENSORS_HMC5843
-   tristate Honeywell HMC5843/5883/5883L 3-Axis Magnetometer
-   depends on I2C
+   tristate
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
+
+config SENSORS_HMC5843_I2C
+   tristate Honeywell HMC5843/5883/5883L 3-Axis Magnetometer (I2C)
+   depends on I2C
+   select SENSORS_HMC5843
select REGMAP_I2C
help
  Say Y here to add support for the Honeywell HMC5843, HMC5883 and
  HMC5883L 3-Axis Magnetometer (digital compass).
 
- To compile this driver as a module, choose M here: the module
- will be called hmc5843.
+ This driver can also be compiled as a set of modules.
+ If so, these modules will be created:
+ - hmc5843_core (core functions)
+ - hmc5843_i2c (support for HMC5843, HMC5883 and HMC5883L)
 
 endmenu
diff --git a/drivers/staging/iio/magnetometer/Makefile 
b/drivers/staging/iio/magnetometer/Makefile
index f9bfb2e..65baf1c 100644
--- a/drivers/staging/iio/magnetometer/Makefile
+++ b/drivers/staging/iio/magnetometer/Makefile
@@ -2,4 +2,5 @@
 # Makefile for industrial I/O Magnetometer sensors
 #
 
-obj-$(CONFIG_SENSORS_HMC5843)  += hmc5843.o
+obj-$(CONFIG_SENSORS_HMC5843)  += hmc5843_core.o
+obj-$(CONFIG_SENSORS_HMC5843_I2C)  += hmc5843_i2c.o
diff --git a/drivers/staging/iio/magnetometer/hmc5843.h 
b/drivers/staging/iio/magnetometer/hmc5843.h
new file mode 100644
index 000..0d9b02e
--- /dev/null
+++ b/drivers/staging/iio/magnetometer/hmc5843.h
@@ -0,0 +1,85 @@
+/*
+ * Header file for hmc5843 driver
+ *
+ * Split from hmc5843.c
+ * Copyright (C) Josef Gajdusek a...@atx.name
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * */
+
+
+#ifndef HMC5843_CORE_H
+#define HMC5843_CORE_H
+
+#include linux/regmap.h
+#include linux/iio/iio.h
+
+#define HMC5843_CONFIG_REG_A   0x00
+#define HMC5843_CONFIG_REG_B   0x01
+#define HMC5843_MODE_REG   0x02
+#define HMC5843_DATA_OUT_MSB_REGS  0x03
+#define HMC5843_STATUS_REG 0x09
+#define HMC5843_ID_REG 0x0a
+#define HMC5843_ID_END 0x0c
+
+enum hmc5843_ids {
+   HMC5843_ID,
+   HMC5883_ID,
+   HMC5883L_ID,
+};
+
+struct hmc5843_data {
+   struct device *dev;
+   struct mutex lock;
+   struct regmap *regmap;
+   const struct hmc5843_chip_info *variant;
+   __be16 buffer[8]; /* 3x 16-bit channels + padding + 64-bit timestamp */
+};
+
+int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
+   enum hmc5843_ids id);
+int hmc5843_common_remove(struct device *dev);
+
+int hmc5843_common_suspend(struct device *dev);
+int hmc5843_common_resume(struct device *dev);
+
+#ifdef CONFIG_PM_SLEEP
+static SIMPLE_DEV_PM_OPS(hmc5843_pm_ops,
+   hmc5843_common_suspend,
+   hmc5843_common_resume);
+#define HMC5843_PM_OPS (hmc5843_pm_ops)
+#else
+#define HMC5843_PM_OPS NULL
+#endif
+
+static const struct regmap_range hmc5843_readable_ranges[] = {
+   regmap_reg_range(0, HMC5843_ID_END),
+};
+
+struct regmap_access_table hmc5843_readable_table = {
+   .yes_ranges = hmc5843_readable_ranges,
+   .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges),
+};
+
+static const struct regmap_range hmc5843_writable_ranges[] = {
+   regmap_reg_range(0, HMC5843_MODE_REG),
+};
+
+struct regmap_access_table hmc5843_writable_table = {
+   .yes_ranges = hmc5843_writable_ranges,
+   .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges),
+};
+
+static const struct regmap_range hmc5843_volatile_ranges[] = {
+   

[PATCH v4 3/5] staging:iio:hmc5843: register - value arrays now can have different lengths

2014-07-15 Thread Josef Gajdusek
Changed structure of struct hmc5843_chip_info to include length of translation
arrays. Code previously using #defined constant has been changed accordingly.
This allows to integrate devices which do have different amounts of available
rates/scales.

Signed-off-by: Josef Gajdusek a...@atx.name
---
 drivers/staging/iio/magnetometer/hmc5843_core.c | 34 +
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c 
b/drivers/staging/iio/magnetometer/hmc5843_core.c
index bdeaf43..08fb0be 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_core.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
@@ -39,7 +39,6 @@
  */
 #define HMC5843_RANGE_GAIN_OFFSET  0x05
 #define HMC5843_RANGE_GAIN_DEFAULT 0x01
-#define HMC5843_RANGE_GAINS8
 #define HMC5843_RANGE_GAIN_MASK0xe0
 
 /* Device status */
@@ -59,7 +58,6 @@
  */
 #define HMC5843_RATE_OFFSET0x02
 #define HMC5843_RATE_DEFAULT   0x04
-#define HMC5843_RATES  7
 #define HMC5843_RATE_MASK  0x1c
 
 /* Device measurement configuration */
@@ -69,15 +67,15 @@
 #define HMC5843_MEAS_CONF_MASK 0x03
 
 /* Scaling factors: 1000/Gain */
-static const int hmc5843_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
+static const int hmc5843_regval_to_nanoscale[] = {
6173, 7692, 10309, 12821, 18868, 21739, 25641, 35714
 };
 
-static const int hmc5883_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
+static const int hmc5883_regval_to_nanoscale[] = {
7812, 9766, 13021, 16287, 24096, 27701, 32573, 45662
 };
 
-static const int hmc5883l_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
+static const int hmc5883l_regval_to_nanoscale[] = {
7299, 9174, 12195, 15152, 22727, 25641, 30303, 43478
 };
 
@@ -94,11 +92,11 @@ static const int 
hmc5883l_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
  * 6   | 50| 75
  * 7   | Not used  | Not used
  */
-static const int hmc5843_regval_to_samp_freq[7][2] = {
+static const int hmc5843_regval_to_samp_freq[][2] = {
{0, 50}, {1, 0}, {2, 0}, {5, 0}, {10, 0}, {20, 0}, {50, 0}
 };
 
-static const int hmc5883_regval_to_samp_freq[7][2] = {
+static const int hmc5883_regval_to_samp_freq[][2] = {
{0, 75}, {1, 50}, {3, 0}, {7, 50}, {15, 0}, {30, 0},
{75, 0}
 };
@@ -107,7 +105,9 @@ static const int hmc5883_regval_to_samp_freq[7][2] = {
 struct hmc5843_chip_info {
const struct iio_chan_spec *channels;
const int (*regval_to_samp_freq)[2];
+   const int n_regval_to_samp_freq;
const int *regval_to_nanoscale;
+   const int n_regval_to_nanoscale;
 };
 
 /* The lower two bits contain the current conversion mode */
@@ -248,7 +248,7 @@ static ssize_t hmc5843_show_samp_freq_avail(struct device 
*dev,
size_t len = 0;
int i;
 
-   for (i = 0; i  HMC5843_RATES; i++)
+   for (i = 0; i  data-variant-n_regval_to_samp_freq; i++)
len += scnprintf(buf + len, PAGE_SIZE - len,
%d.%d , data-variant-regval_to_samp_freq[i][0],
data-variant-regval_to_samp_freq[i][1]);
@@ -278,7 +278,7 @@ static int hmc5843_get_samp_freq_index(struct hmc5843_data 
*data,
 {
int i;
 
-   for (i = 0; i  HMC5843_RATES; i++)
+   for (i = 0; i  data-variant-n_regval_to_samp_freq; i++)
if (val == data-variant-regval_to_samp_freq[i][0] 
val2 == data-variant-regval_to_samp_freq[i][1])
return i;
@@ -307,7 +307,7 @@ static ssize_t hmc5843_show_scale_avail(struct device *dev,
size_t len = 0;
int i;
 
-   for (i = 0; i  HMC5843_RANGE_GAINS; i++)
+   for (i = 0; i  data-variant-n_regval_to_nanoscale; i++)
len += scnprintf(buf + len, PAGE_SIZE - len,
0.%09d , data-variant-regval_to_nanoscale[i]);
 
@@ -327,7 +327,7 @@ static int hmc5843_get_scale_index(struct hmc5843_data 
*data, int val, int val2)
if (val != 0)
return -EINVAL;
 
-   for (i = 0; i  HMC5843_RANGE_GAINS; i++)
+   for (i = 0; i  data-variant-n_regval_to_nanoscale; i++)
if (val2 == data-variant-regval_to_nanoscale[i])
return i;
 
@@ -480,17 +480,29 @@ static const struct hmc5843_chip_info 
hmc5843_chip_info_tbl[] = {
[HMC5843_ID] = {
.channels = hmc5843_channels,
.regval_to_samp_freq = hmc5843_regval_to_samp_freq,
+   .n_regval_to_samp_freq =
+   ARRAY_SIZE(hmc5843_regval_to_samp_freq),
.regval_to_nanoscale = hmc5843_regval_to_nanoscale,
+   .n_regval_to_nanoscale =
+   ARRAY_SIZE(hmc5843_regval_to_nanoscale),
},
[HMC5883_ID] = {
.channels 

[PATCH v4 1/5] staging:iio:hmc5843: Added regmap support

2014-07-15 Thread Josef Gajdusek
This patch changes hmc5843.c to use regmap. This provides transparent caching
to the code as well as abstraction necessary to add support for SPI-based
hmc5983.

Signed-off-by: Josef Gajdusek a...@atx.name
---
 drivers/staging/iio/magnetometer/Kconfig   |   1 +
 drivers/staging/iio/magnetometer/hmc5843.c | 140 +++--
 2 files changed, 96 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index 34634da..ad88d61 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -8,6 +8,7 @@ config SENSORS_HMC5843
depends on I2C
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
+   select REGMAP_I2C
help
  Say Y here to add support for the Honeywell HMC5843, HMC5883 and
  HMC5883L 3-Axis Magnetometer (digital compass).
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c 
b/drivers/staging/iio/magnetometer/hmc5843.c
index d4f4dd9..a458160 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -21,6 +21,7 @@
 
 #include linux/module.h
 #include linux/i2c.h
+#include linux/regmap.h
 #include linux/iio/iio.h
 #include linux/iio/sysfs.h
 #include linux/iio/trigger_consumer.h
@@ -34,6 +35,7 @@
 #define HMC5843_DATA_OUT_MSB_REGS  0x03
 #define HMC5843_STATUS_REG 0x09
 #define HMC5843_ID_REG 0x0a
+#define HMC5843_ID_END 0x0c
 
 enum hmc5843_ids {
HMC5843_ID,
@@ -49,6 +51,7 @@ enum hmc5843_ids {
 #define HMC5843_RANGE_GAIN_OFFSET  0x05
 #define HMC5843_RANGE_GAIN_DEFAULT 0x01
 #define HMC5843_RANGE_GAINS8
+#define HMC5843_RANGE_GAIN_MASK0xe0
 
 /* Device status */
 #define HMC5843_DATA_READY 0x01
@@ -68,6 +71,7 @@ enum hmc5843_ids {
 #define HMC5843_RATE_OFFSET0x02
 #define HMC5843_RATE_DEFAULT   0x04
 #define HMC5843_RATES  7
+#define HMC5843_RATE_MASK  0x1c
 
 /* Device measurement configuration */
 #define HMC5843_MEAS_CONF_NORMAL   0x00
@@ -121,10 +125,7 @@ struct hmc5843_chip_info {
 struct hmc5843_data {
struct i2c_client *client;
struct mutex lock;
-   u8 rate;
-   u8 meas_conf;
-   u8 operating_mode;
-   u8 range;
+   struct regmap *regmap;
const struct hmc5843_chip_info *variant;
__be16 buffer[8]; /* 3x 16-bit channels + padding + 64-bit timestamp */
 };
@@ -135,10 +136,8 @@ static s32 hmc5843_set_mode(struct hmc5843_data *data, u8 
operating_mode)
int ret;
 
mutex_lock(data-lock);
-   ret = i2c_smbus_write_byte_data(data-client, HMC5843_MODE_REG,
-   operating_mode  HMC5843_MODE_MASK);
-   if (ret = 0)
-   data-operating_mode = operating_mode;
+   ret = regmap_update_bits(data-regmap, HMC5843_MODE_REG,
+   HMC5843_MODE_MASK, operating_mode);
mutex_unlock(data-lock);
 
return ret;
@@ -146,15 +145,15 @@ static s32 hmc5843_set_mode(struct hmc5843_data *data, u8 
operating_mode)
 
 static int hmc5843_wait_measurement(struct hmc5843_data *data)
 {
-   s32 result;
int tries = 150;
+   int val;
+   int ret;
 
while (tries--  0) {
-   result = i2c_smbus_read_byte_data(data-client,
-   HMC5843_STATUS_REG);
-   if (result  0)
-   return result;
-   if (result  HMC5843_DATA_READY)
+   ret = regmap_read(data-regmap, HMC5843_STATUS_REG, val);
+   if (ret  0)
+   return ret;
+   if (val  HMC5843_DATA_READY)
break;
msleep(20);
}
@@ -171,20 +170,20 @@ static int hmc5843_wait_measurement(struct hmc5843_data 
*data)
 static int hmc5843_read_measurement(struct hmc5843_data *data,
int idx, int *val)
 {
-   s32 result;
__be16 values[3];
+   int ret;
 
mutex_lock(data-lock);
-   result = hmc5843_wait_measurement(data);
-   if (result  0) {
+   ret = hmc5843_wait_measurement(data);
+   if (ret  0) {
mutex_unlock(data-lock);
-   return result;
+   return ret;
}
-   result = i2c_smbus_read_i2c_block_data(data-client,
-   HMC5843_DATA_OUT_MSB_REGS, sizeof(values), (u8 *) values);
+   ret = regmap_bulk_read(data-regmap, HMC5843_DATA_OUT_MSB_REGS,
+   values, sizeof(values));
mutex_unlock(data-lock);
-   if (result  0)
-   return -EINVAL;
+   if (ret  0)
+   return ret;
 
*val = sign_extend32(be16_to_cpu(values[idx]), 15);
return IIO_VAL_INT;
@@ -208,16 +207,13 @@ 

[PATCH v4 4/5] staging:iio:hmc5843: Add support for i2c hmc5983

2014-07-15 Thread Josef Gajdusek
This patch adds support for the hmc5983 i2c interface.
This chip is almost identical to the hmc5883. The difference being added
temperature compensation, additional available sample rate (220Hz) and an SPI
interface.

Signed-off-by: Josef Gajdusek a...@atx.name
---
 drivers/staging/iio/magnetometer/Kconfig|  2 +-
 drivers/staging/iio/magnetometer/hmc5843.h  |  1 +
 drivers/staging/iio/magnetometer/hmc5843_core.c | 20 +---
 drivers/staging/iio/magnetometer/hmc5843_i2c.c  |  5 +++--
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index 0a27f98..c086f33 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -20,6 +20,6 @@ config SENSORS_HMC5843_I2C
  This driver can also be compiled as a set of modules.
  If so, these modules will be created:
  - hmc5843_core (core functions)
- - hmc5843_i2c (support for HMC5843, HMC5883 and HMC5883L)
+ - hmc5843_i2c (support for HMC5843, HMC5883, HMC5883L and HMC5983)
 
 endmenu
diff --git a/drivers/staging/iio/magnetometer/hmc5843.h 
b/drivers/staging/iio/magnetometer/hmc5843.h
index 0d9b02e..204bf92 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.h
+++ b/drivers/staging/iio/magnetometer/hmc5843.h
@@ -29,6 +29,7 @@ enum hmc5843_ids {
HMC5843_ID,
HMC5883_ID,
HMC5883L_ID,
+   HMC5983_ID,
 };
 
 struct hmc5843_data {
diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c 
b/drivers/staging/iio/magnetometer/hmc5843_core.c
index 08fb0be..914ae1a 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_core.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
@@ -101,6 +101,11 @@ static const int hmc5883_regval_to_samp_freq[][2] = {
{75, 0}
 };
 
+static const int hmc5983_regval_to_samp_freq[][2] = {
+   {0, 75}, {1, 50}, {3, 0}, {7, 50}, {15, 0}, {30, 0},
+   {75, 0}, {220, 0}
+};
+
 /* Describe chip variants */
 struct hmc5843_chip_info {
const struct iio_chan_spec *channels;
@@ -457,7 +462,7 @@ static const struct iio_chan_spec hmc5843_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(3),
 };
 
-/* Beware: Y and Z are exchanged on HMC5883 */
+/* Beware: Y and Z are exchanged on HMC5883 and 5983 */
 static const struct iio_chan_spec hmc5883_channels[] = {
HMC5843_CHANNEL(X, 0),
HMC5843_CHANNEL(Z, 1),
@@ -504,6 +509,15 @@ static const struct hmc5843_chip_info 
hmc5843_chip_info_tbl[] = {
.n_regval_to_nanoscale =
ARRAY_SIZE(hmc5883l_regval_to_nanoscale),
},
+   [HMC5983_ID] = {
+   .channels = hmc5883_channels,
+   .regval_to_samp_freq = hmc5983_regval_to_samp_freq,
+   .n_regval_to_samp_freq =
+   ARRAY_SIZE(hmc5983_regval_to_samp_freq),
+   .regval_to_nanoscale = hmc5883l_regval_to_nanoscale,
+   .n_regval_to_nanoscale =
+   ARRAY_SIZE(hmc5883l_regval_to_nanoscale),
+   }
 };
 
 static int hmc5843_init(struct hmc5843_data *data)
@@ -516,7 +530,7 @@ static int hmc5843_init(struct hmc5843_data *data)
if (ret  0)
return ret;
if (id[0] != 'H' || id[1] != '4' || id[2] != '3') {
-   dev_err(data-dev, no HMC5843/5883/5883L sensor\n);
+   dev_err(data-dev, no HMC5843/5883/5883L/5983 sensor\n);
return -ENODEV;
}
 
@@ -620,5 +634,5 @@ int hmc5843_common_remove(struct device *dev)
 EXPORT_SYMBOL(hmc5843_common_remove);
 
 MODULE_AUTHOR(Shubhrajyoti Datta shubhrajy...@ti.com);
-MODULE_DESCRIPTION(HMC5843/5883/5883L core driver);
+MODULE_DESCRIPTION(HMC5843/5883/5883L/5983 core driver);
 MODULE_LICENSE(GPL);
diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c 
b/drivers/staging/iio/magnetometer/hmc5843_i2c.c
index 1ae97d9..416e09a 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c
@@ -1,5 +1,5 @@
 /*
- * i2c driver for hmc5843/5843/5883/5883l
+ * i2c driver for hmc5843/5843/5883/5883l/5983
  *
  * Split from hmc5843.c
  * Copyright (C) Josef Gajdusek a...@atx.name
@@ -46,6 +46,7 @@ static const struct i2c_device_id hmc5843_id[] = {
{ hmc5843, HMC5843_ID },
{ hmc5883, HMC5883_ID },
{ hmc5883l, HMC5883L_ID },
+   { hmc5983, HMC5983_ID },
{ }
 };
 MODULE_DEVICE_TABLE(i2c, hmc5843_id);
@@ -69,5 +70,5 @@ static struct i2c_driver hmc5843_driver = {
 module_i2c_driver(hmc5843_driver);
 
 MODULE_AUTHOR(Josef Gajdusek a...@atx.name);
-MODULE_DESCRIPTION(HMC5843/5883/5883L i2c driver);
+MODULE_DESCRIPTION(HMC5843/5883/5883L/5983 i2c driver);
 MODULE_LICENSE(GPL);
-- 
1.8.5.5

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

[PATCH v4 5/5] staging:iio:hmc5843: Add support for spi hmc5983

2014-07-15 Thread Josef Gajdusek
This patch adds support for the hmc5983 spi interface.
This chip is almost identical to the hmc5883. The difference being added
temperature compensation, additional available sample rate (220Hz) and an SPI
interface.

Signed-off-by: Josef Gajdusek a...@atx.name
---
 drivers/staging/iio/magnetometer/Kconfig   | 15 ++
 drivers/staging/iio/magnetometer/Makefile  |  1 +
 drivers/staging/iio/magnetometer/hmc5843_spi.c | 73 ++
 3 files changed, 89 insertions(+)
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_spi.c

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index c086f33..dec814a 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -22,4 +22,19 @@ config SENSORS_HMC5843_I2C
  - hmc5843_core (core functions)
  - hmc5843_i2c (support for HMC5843, HMC5883, HMC5883L and HMC5983)
 
+config SENSORS_HMC5843_SPI
+   tristate Honeywell HMC5983 3-Axis Magnetometer (SPI)
+   depends on SPI_MASTER
+   select SENSORS_HMC5843
+   select REGMAP_SPI
+   help
+ Say Y here to add support for the Honeywell HMC5983 3-Axis 
Magnetometer
+ (digital compass).
+
+ This driver can also be compiled as a set of modules.
+ If so, these modules will be created:
+ - hmc5843_core (core functions)
+ - hmc5843_spi (support for HMC5983)
+
+
 endmenu
diff --git a/drivers/staging/iio/magnetometer/Makefile 
b/drivers/staging/iio/magnetometer/Makefile
index 65baf1c..33761a1 100644
--- a/drivers/staging/iio/magnetometer/Makefile
+++ b/drivers/staging/iio/magnetometer/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_SENSORS_HMC5843)  += hmc5843_core.o
 obj-$(CONFIG_SENSORS_HMC5843_I2C)  += hmc5843_i2c.o
+obj-$(CONFIG_SENSORS_HMC5843_SPI)  += hmc5843_spi.o
diff --git a/drivers/staging/iio/magnetometer/hmc5843_spi.c 
b/drivers/staging/iio/magnetometer/hmc5843_spi.c
new file mode 100644
index 000..62964a4
--- /dev/null
+++ b/drivers/staging/iio/magnetometer/hmc5843_spi.c
@@ -0,0 +1,73 @@
+/*
+ * SPI driver for hmc5983
+ *
+ * Copyright (C) Josef Gajdusek a...@atx.name
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * */
+
+#include linux/module.h
+#include linux/spi/spi.h
+#include linux/iio/iio.h
+
+#include hmc5843.h
+
+static struct regmap_config hmc5843_spi_regmap_config = {
+   .reg_bits = 8,
+   .val_bits = 8,
+
+   .rd_table = hmc5843_readable_table,
+   .wr_table = hmc5843_writable_table,
+   .volatile_table = hmc5843_volatile_table,
+
+   /* Autoincrement address pointer */
+   .read_flag_mask = 0xc0,
+
+   .cache_type = REGCACHE_RBTREE,
+};
+
+static int hmc5843_spi_probe(struct spi_device *spi)
+{
+   int ret;
+
+   spi-mode = SPI_MODE_3;
+   spi-max_speed_hz = 800;
+   spi-bits_per_word = 8;
+   ret = spi_setup(spi);
+   if (ret)
+   return ret;
+
+   return hmc5843_common_probe(spi-dev,
+   devm_regmap_init_spi(spi, hmc5843_spi_regmap_config),
+   HMC5983_ID);
+}
+
+static int hmc5843_spi_remove(struct spi_device *spi)
+{
+   return hmc5843_common_remove(spi-dev);
+}
+
+static const struct spi_device_id hmc5843_id[] = {
+   { hmc5983, HMC5983_ID },
+   { }
+};
+
+static struct spi_driver hmc5843_driver = {
+   .driver = {
+   .name = hmc5843,
+   .pm = HMC5843_PM_OPS,
+   .owner = THIS_MODULE,
+   },
+   .id_table = hmc5843_id,
+   .probe = hmc5843_spi_probe,
+   .remove = hmc5843_spi_remove,
+};
+
+module_spi_driver(hmc5843_driver);
+
+MODULE_AUTHOR(Josef Gajdusek a...@atx.name);
+MODULE_DESCRIPTION(HMC5983 SPI driver);
+MODULE_LICENSE(GPL);
-- 
1.8.5.5

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


Re: [PATCH 00/22] drivers/staging/bcm/PHSModule.c cleanup patches

2014-07-15 Thread Dan Carpenter
Looks good.  Don't bother resending those patches I complained about,
those are fine for now.

Reviewed-by: Dan Carpenter dan.carpen...@oracle.com

regards,
dan carpenter

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


[PATCH 94/94] Staging: comedi: 3 files revised fixed style issues

2014-07-15 Thread sam-the-6
From: Sam Asadi asadi.sam...@gmail.com

3 files in 'staging/comedi/drivers/' revised again
and style issues fixed

Signed-off-by: Sam Asadi asadi.sam...@gmail.com

modified:   drivers/staging/comedi/drivers/8253.h
modified:   drivers/staging/comedi/drivers/8255.c
modified:   drivers/staging/comedi/drivers/adl_pci9118.c
---
 drivers/staging/comedi/drivers/8253.h|   34 +++---
 drivers/staging/comedi/drivers/8255.c|  154 +-
 drivers/staging/comedi/drivers/adl_pci9118.c |  140 +++
 3 files changed, 167 insertions(+), 161 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8253.h 
b/drivers/staging/comedi/drivers/8253.h
index f6b8607..31d0fc9 100644
--- a/drivers/staging/comedi/drivers/8253.h
+++ b/drivers/staging/comedi/drivers/8253.h
@@ -1,20 +1,20 @@
 /*
-comedi/drivers/8253.h
-Header file for 8253
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 2000 David A. Schleef d...@schleef.org
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedi/drivers/8253.h
+ * Header file for 8253
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2000 David A. Schleef d...@schleef.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #ifndef _8253_H
 #define _8253_H
@@ -55,7 +55,7 @@ static inline void i8253_cascade_ns_to_timer(int 
i8253_osc_base,
/* check for overflow */
divider  div1  divider  div2 
divider * i8253_osc_base  divider 
-   divider * i8253_osc_base  i8253_osc_base)  {
+   divider * i8253_osc_base  i8253_osc_base) {
return;
}
 
diff --git a/drivers/staging/comedi/drivers/8255.c 
b/drivers/staging/comedi/drivers/8255.c
index de273c7..246bf30 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -1,73 +1,77 @@
 /*
-   comedi/drivers/8255.c
-   Driver for 8255
-
-   COMEDI - Linux Control and Measurement Device Interface
-   Copyright (C) 1998 David A. Schleef d...@schleef.org
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   Driver: 8255
-   Description: generic 8255 support
-   Devices: [standard] 8255 (8255)
-   Author: ds
-   Status: works
-   Updated: Fri,  7 Jun 2002 12:56:45 -0700
-
-   The classic in digital I/O.  The 8255 appears in Comedi as a single
-   digital I/O subdevice with 24 channels.  The channel 0 corresponds
-   to the 8255's port A, bit 0; channel 23 corresponds to port C, bit
-   7.  Direction configuration is done in blocks, with channels 0-7,
-   8-15, 16-19, and 20-23 making up the 4 blocks.  The only 8255 mode
-   supported is mode 0.
-
-   You should enable compilation this driver if you plan to use a board
-   that has an 8255 chip.  For multifunction boards, the main driver will
-   configure the 8255 subdevice automatically.
-
-   This driver also works independently with ISA and PCI cards that
-   directly map the 8255 registers to I/O ports, including cards with
-   multiple 8255 chips.  To configure the driver for such a card, the
-   option list should be a list of the I/O port bases for each of the
-   8255 chips.  For example,
-
-   comedi_config /dev/comedi0 8255 0x200,0x204,0x208,0x20c
-
-   Note that most PCI 8255 boards do NOT work with this driver, and
-   need a separate driver as a wrapper.  For those that do work, the
-   I/O port base address can be found in 

Re: [PATCH 91/93] Staging: comedi: 8253.h fixed by removing 'return' from generic func

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 06:13:19AM +0300, sam-the-6 wrote:
 From: Sam Asadi asadi.sam...@gmail.com
 
 Signed-off-by: Sam Asadi asadi.sam...@gmail.com

Where are the other 90 patches in this series, I only received 91, 92,
93, and 94.  Wait, 94 out of 93  What is going on here?

 
   modified:   drivers/staging/comedi/drivers/8253.h

What is this line for?

Also, please look at your email client's From: line up above, it isn't
matching your From: and Signed-off-by: line in the body of the patch,
why?

thanks,

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


Re: [PATCH 92/93] Staging: comedi: 8255: fixed by adding an empthy line

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 06:15:44AM +0300, sam-the-6 wrote:
 From: Sam Asadi asadi.sam...@gmail.com
 
 fixed a coding style issue.

Your Subject: does not match the body of the patch at all, why not?

Please be descriptive as to what you are doing.

Also, only do one thing per patch, and one thing is NOT fix all
coding style issues.

Please redo this whole series, starting with the numbering of them, and
break them up into individual changes, not large patches.

thanks,

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


Re: [PATCH 94/94] Staging: comedi: 3 files revised fixed style issues

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 04:19:22PM +0300, sam-the-6 wrote:
 From: Sam Asadi asadi.sam...@gmail.com
 
 3 files in 'staging/comedi/drivers/' revised again
 and style issues fixed
 
 Signed-off-by: Sam Asadi asadi.sam...@gmail.com
 
   modified:   drivers/staging/comedi/drivers/8253.h
   modified:   drivers/staging/comedi/drivers/8255.c
   modified:   drivers/staging/comedi/drivers/adl_pci9118.c
 ---
  drivers/staging/comedi/drivers/8253.h|   34 +++---
  drivers/staging/comedi/drivers/8255.c|  154 
 +-
  drivers/staging/comedi/drivers/adl_pci9118.c |  140 +++
  3 files changed, 167 insertions(+), 161 deletions(-)

As said before, this isn't an ok way to do this, please break it up into
individual changes per patch.

thanks,

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


[PATCH] staging: unisys: added virtpci info entry

2014-07-15 Thread Erik Arfvidson
This patch adds the virtpci debugfs directory and the info entry
inside of it.

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
v4: Fixed comments, upper bound buffer, removed #define for virtpci and info,
modified printvbus to work with scnprintf and added and extra element to
print_vbus_info struct
v3: Fixed formating and comments. Also added debufs_remove_recursive() and
simple simple_read_from_buffer()
v2: Fixed comments and applied Dan Carpenter suggestions
 drivers/staging/unisys/virtpci/virtpci.c | 111 ++-
 1 file changed, 108 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/virtpci/virtpci.c 
b/drivers/staging/unisys/virtpci/virtpci.c
index 7d840b0..1929137 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -36,6 +36,7 @@
 #include linux/mod_devicetable.h
 #include linux/if_ether.h
 #include linux/version.h
+#include linux/debugfs.h
 #include version.h
 #include guestlinuxdebug.h
 #include timskmodutils.h
@@ -57,6 +58,7 @@ struct driver_private {
 #endif
 
 #define BUS_ID(x) dev_name(x)
+#define MAX_BUF 16384
 
 #include virtpci.h
 
@@ -100,6 +102,12 @@ static int virtpci_device_resume(struct device *dev);
 static int virtpci_device_probe(struct device *dev);
 static int virtpci_device_remove(struct device *dev);
 
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset);
+
+static const struct file_operations debugfs_info_fops = {
+   .read = info_debugfs_read,
+};
 
 /*/
 /* Globals   */
@@ -139,7 +147,17 @@ static DEFINE_RWLOCK(VpcidevListLock);
 
 /* filled in with info about this driver, wrt it servicing client busses */
 static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
-
+/*/
+/* debugfs entries   */
+/*/
+/* dentry is used to create the debugfs entry directory
+ * for virtpci
+ */
+static struct dentry *virtpci_debugfs_dir;
+static struct dentry *info_debugfs_entry;
+/* info_debugfs_entry is used to tell virtpci to display current info
+ * kept in the driver
+ */
 
 struct virtpci_busdev {
struct device virtpci_bus_device;
@@ -1375,6 +1393,89 @@ void virtpci_unregister_driver(struct virtpci_driver 
*drv)
DBGINF(Leaving\n);
 }
 EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
+/*/
+/* debugfs filesystem functions  */
+/*/
+struct print_vbus_info {
+   int *str_pos;
+   char *buf;
+   size_t *len;
+};
+
+static int print_vbus(struct device *vbus, void *data)
+{
+   struct print_vbus_info *p = (struct print_vbus_info *)data;
+
+   *p-str_pos += scnprintf(p-buf + *p-str_pos, *p-len - *p-str_pos,
+   bus_id:%s\n, dev_name(vbus));
+   return 0;
+}
+
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset)
+{
+   ssize_t bytes_read = 0;
+   int str_pos = 0;
+   struct virtpci_dev *tmpvpcidev;
+   unsigned long flags;
+   struct print_vbus_info printparam;
+   char *vbuf;
+
+   if (len  MAX_BUF)
+   len = MAX_BUF;
+   vbuf = kzalloc(len, GFP_KERNEL);
+   if (!vbuf)
+   return -ENOMEM;
+
+   str_pos += scnprintf(vbuf + str_pos, len - str_pos,
+Virtual PCI Bus devices\n);
+   printparam.str_pos = str_pos;
+   printparam.buf = vbuf;
+   printparam.len = len;
+   if (bus_for_each_dev(virtpci_bus_type, NULL,
+(void *) printparam, print_vbus))
+   LOGERR(Failed to find bus\n);
+
+   str_pos += scnprintf(vbuf + str_pos, len - str_pos,
+   \n Virtual PCI devices\n);
+   read_lock_irqsave(VpcidevListLock, flags);
+   tmpvpcidev = VpcidevListHead;
+   while (tmpvpcidev) {
+   if (tmpvpcidev-devtype == VIRTHBA_TYPE) {
+   str_pos += scnprintf(vbuf + str_pos, len - str_pos,
+   [%d:%d] VHba:%08x:%08x 
max-config:%d-%d-%d-%d,
+   tmpvpcidev-busNo, tmpvpcidev-deviceNo,
+   tmpvpcidev-scsi.wwnn.wwnn1,
+   tmpvpcidev-scsi.wwnn.wwnn2,
+   tmpvpcidev-scsi.max.max_channel,
+   tmpvpcidev-scsi.max.max_id,
+   tmpvpcidev-scsi.max.max_lun,
+   tmpvpcidev-scsi.max.cmd_per_lun);
+   } else {
+  

Re: [PATCH] drivers: Let several drivers depends on HAS_IOMEM for 'devm_ioremap_resource'

2014-07-15 Thread Chen Gang
On 07/15/2014 09:11 AM, Chen Gang wrote:
 
 
 On 07/15/2014 08:53 AM, Guenter Roeck wrote:
 On 07/14/2014 05:34 PM, Chen Gang wrote:
 On 07/14/2014 05:22 PM, Chen Gang wrote:

 在 2014年7月14日,下午4:57,Richard Weinberger rich...@nod.at 写道:

 Am 14.07.2014 10:48, schrieb Lars-Peter Clausen:
 On 07/14/2014 10:31 AM, Richard Weinberger wrote:
 Am 13.07.2014 22:17, schrieb Greg Kroah-Hartman:
 On Sun, Jul 13, 2014 at 09:33:38PM +0200, Richard Weinberger wrote:
 Maybe we could add COMPILE_TEST to the version string too?
 Just to detect such kernels fast in user bug reports...

 What kind of bug report are you going to get?

 User manages to enable CONFIG_FOO by selecting COMPILE_TEST and
 complains that it does not work. :)

 These drivers are typically drivers for some SoC peripheral and the
 device will simply physically not exist on a platform that does not
 provide HAS_IOMEM. This is not really any
 different from making the driver selectable via COMPILE_TEST for
 any other platform. To hit the issue you'd have to instantiate a
 device driver instance for a device that
 physically does not exist. This will always result in a failure.

 Okay, you have convinced me. :)


 After search the history patches, I found one related patch which made
 by myself (when I am in Asianux):

https://lkml.org/lkml/2013/7/1/641;

 For me, it is a long discussion, and forced many members have to join
 in. Please help check again.


 One thing you could try would be to return NULL (or where appropriate
 an error) in the #else case of CONFIG_HAS_IOMEM and CONFIG_HAS_IOPORT,
 ie dont take COMPILE_TEST into account at all. Obviously that means
 you won't be able to dump a warning message in the COMPILE_TEST
 case, but at least the code would compile. The rejection of above patch
 would make a good case for this approach.

 
 OK, thanks: at least, it can be improved.  But still welcome any other
 opinions of another related members.
 

If no reply within 3 days (2014-07-18), I shall try to send related
patch for it within this week end (2014-07-20).

Thanks.
-- 
Chen Gang

Open share and attitude like air water and life which God blessed
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] staging: comedi: fixes of checkpatch.pl warnings

2014-07-15 Thread Kinka Huang
From: kinka kinkabr...@gmail.com

Signed-off-by: Kinka Huang kinkabr...@gmail.com
---
 drivers/staging/comedi/comedi.h  | 8 
 drivers/staging/comedi/comedi_fops.c | 9 -
 drivers/staging/comedi/comedidev.h   | 4 ++--
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index dbaeba7..552a5e2 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -555,16 +555,16 @@ static inline unsigned NI_USUAL_PFI_SELECT(unsigned 
pfi_channel)
 {
if (pfi_channel  10)
return 0x1 + pfi_channel;
-   else
-   return 0xb + pfi_channel;
+
+   return 0xb + pfi_channel;
 }
 
 static inline unsigned NI_USUAL_RTSI_SELECT(unsigned rtsi_channel)
 {
if (rtsi_channel  7)
return 0xb + rtsi_channel;
-   else
-   return 0x1b;
+
+   return 0x1b;
 }
 
 /* mode bits for NI general-purpose counters, set with
diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 038b69a..3686296 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -206,8 +206,8 @@ struct comedi_device *comedi_dev_get_from_minor(unsigned 
minor)
 {
if (minor  COMEDI_NUM_BOARD_MINORS)
return comedi_dev_get_from_board_minor(minor);
-   else
-   return comedi_dev_get_from_subdevice_minor(minor);
+
+   return comedi_dev_get_from_subdevice_minor(minor);
 }
 EXPORT_SYMBOL_GPL(comedi_dev_get_from_minor);
 
@@ -2625,10 +2625,9 @@ static int __init comedi_init(void)
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
 COMEDI_NUM_MINORS);
return PTR_ERR(dev);
-   } else {
-   /* comedi_alloc_board_minor() locked the mutex */
-   mutex_unlock(dev-mutex);
}
+   /* comedi_alloc_board_minor() locked the mutex */
+   mutex_unlock(dev-mutex);
}
 
return 0;
diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 83fd155..0167945 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -388,8 +388,8 @@ static inline unsigned int bytes_per_sample(const struct 
comedi_subdevice *subd)
 {
if (subd-subdev_flags  SDF_LSAMPL)
return sizeof(unsigned int);
-   else
-   return sizeof(short);
+
+   return sizeof(short);
 }
 
 /*
-- 
1.8.3.2

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


Re: [PATCH 1/1] staging: comedi: fixes of checkpatch.pl warnings

2014-07-15 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 10:39:02PM +0800, Kinka Huang wrote:
 From: kinka kinkabr...@gmail.com

Don't put this line.

Which kind of checkpatch warning?  Also put mention that in the subject
as well.

 
 Signed-off-by: Kinka Huang kinkabr...@gmail.com

regards,
dan carpenter

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


Re: [PATCH] staging: unisys: added virtpci info entry

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 10:36:43AM -0400, Erik Arfvidson wrote:
 This patch adds the virtpci debugfs directory and the info entry
 inside of it.
 
 Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
 Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
 ---
 v4: Fixed comments, upper bound buffer, removed #define for virtpci and info,
 modified printvbus to work with scnprintf and added and extra element to
 print_vbus_info struct
 v3: Fixed formating and comments. Also added debufs_remove_recursive() and
 simple simple_read_from_buffer()
 v2: Fixed comments and applied Dan Carpenter suggestions
  drivers/staging/unisys/virtpci/virtpci.c | 111 
 ++-
  1 file changed, 108 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/staging/unisys/virtpci/virtpci.c 
 b/drivers/staging/unisys/virtpci/virtpci.c
 index 7d840b0..1929137 100644
 --- a/drivers/staging/unisys/virtpci/virtpci.c
 +++ b/drivers/staging/unisys/virtpci/virtpci.c
 @@ -36,6 +36,7 @@
  #include linux/mod_devicetable.h
  #include linux/if_ether.h
  #include linux/version.h
 +#include linux/debugfs.h
  #include version.h
  #include guestlinuxdebug.h
  #include timskmodutils.h
 @@ -57,6 +58,7 @@ struct driver_private {
  #endif
  
  #define BUS_ID(x) dev_name(x)
 +#define MAX_BUF 16384

Lovely magic number, care to explain why this is this size?

  
  #include virtpci.h
  
 @@ -100,6 +102,12 @@ static int virtpci_device_resume(struct device *dev);
  static int virtpci_device_probe(struct device *dev);
  static int virtpci_device_remove(struct device *dev);
  
 +static ssize_t info_debugfs_read(struct file *file, char __user *buf,
 +   size_t len, loff_t *offset);
 +
 +static const struct file_operations debugfs_info_fops = {
 + .read = info_debugfs_read,
 +};
  
  /*/
  /* Globals   */
 @@ -139,7 +147,17 @@ static DEFINE_RWLOCK(VpcidevListLock);
  
  /* filled in with info about this driver, wrt it servicing client busses */
  static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
 -
 +/*/
 +/* debugfs entries   */
 +/*/
 +/* dentry is used to create the debugfs entry directory
 + * for virtpci
 + */
 +static struct dentry *virtpci_debugfs_dir;
 +static struct dentry *info_debugfs_entry;
 +/* info_debugfs_entry is used to tell virtpci to display current info
 + * kept in the driver
 + */

Odd to comment both above and below the variables, pick one style and
stick to it.

Also, no empty line ater the Bus_DriverInfo variable and the comment?

And again, you don't need the info_debugfs_entry variable at all.  You
set it once and then never touch it again, seems like a waste to have
it, right?


  
  struct virtpci_busdev {
   struct device virtpci_bus_device;
 @@ -1375,6 +1393,89 @@ void virtpci_unregister_driver(struct virtpci_driver 
 *drv)
   DBGINF(Leaving\n);
  }
  EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
 +/*/
 +/* debugfs filesystem functions  */
 +/*/

Again, no blank line before the comment?


 +struct print_vbus_info {
 + int *str_pos;
 + char *buf;
 + size_t *len;
 +};
 +
 +static int print_vbus(struct device *vbus, void *data)
 +{
 + struct print_vbus_info *p = (struct print_vbus_info *)data;
 +
 + *p-str_pos += scnprintf(p-buf + *p-str_pos, *p-len - *p-str_pos,
 + bus_id:%s\n, dev_name(vbus));
 + return 0;
 +}
 +
 +static ssize_t info_debugfs_read(struct file *file, char __user *buf,
 +   size_t len, loff_t *offset)
 +{
 + ssize_t bytes_read = 0;
 + int str_pos = 0;
 + struct virtpci_dev *tmpvpcidev;
 + unsigned long flags;
 + struct print_vbus_info printparam;
 + char *vbuf;
 +
 + if (len  MAX_BUF)
 + len = MAX_BUF;
 + vbuf = kzalloc(len, GFP_KERNEL);
 + if (!vbuf)
 + return -ENOMEM;
 +
 + str_pos += scnprintf(vbuf + str_pos, len - str_pos,
 +  Virtual PCI Bus devices\n);
 + printparam.str_pos = str_pos;
 + printparam.buf = vbuf;
 + printparam.len = len;
 + if (bus_for_each_dev(virtpci_bus_type, NULL,
 +  (void *) printparam, print_vbus))
 + LOGERR(Failed to find bus\n);
 +
 + str_pos += scnprintf(vbuf + str_pos, len - str_pos,
 + \n Virtual PCI devices\n);
 + read_lock_irqsave(VpcidevListLock, flags);
 + tmpvpcidev = VpcidevListHead;
 + while (tmpvpcidev) {
 + if (tmpvpcidev-devtype == VIRTHBA_TYPE) {
 + str_pos += scnprintf(vbuf + str_pos, len - str_pos,
 + [%d:%d] VHba:%08x:%08x 
 

Re: [PATCH 1/1] staging: comedi: fixes of checkpatch.pl warnings

2014-07-15 Thread Greg Kroah-Hartman
On Tue, Jul 15, 2014 at 10:39:02PM +0800, Kinka Huang wrote:
 From: kinka kinkabr...@gmail.com

I need a real name here please.

Also, describe what fixes you are doing in this patch, be descriptive.

care to try it again?

thanks,

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


Re: [PATCH V4 1/6] staging: vt6556: Cleanup trivial coding style issues

2014-07-15 Thread Greg KH
On Mon, Jul 14, 2014 at 09:15:28PM +0200, Peter Senna Tschudin wrote:
 This patch cleans up the following checkpatch issues:
  - tabs instead of spaces on the beginning of a line
  - use correct /* */ comment style
  - put { and } on the correct places
  - line over 80 chars
  - indentation style for multi-line calls / comments
  - space after semicolon ,
  - new line after declaration
 
 Tested by compilation only.
 
 Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
 ---
 Cahnges from V3:
  - Splitted the patches by change type

That's a lot of things to be doing all in one single patch, why didn't
you split this up further?

Please do so.

thanks,

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


Re: [PATCH V4 4/6] staging: vt6556: Remove typedefs

2014-07-15 Thread Greg KH
On Mon, Jul 14, 2014 at 09:15:31PM +0200, Peter Senna Tschudin wrote:
 This patch removes uneeded typedefs reported by chackpatch and removes
 one enum. The removed enum from card.h:
 
 typedef enum _CARD_PHY_TYPE {
 PHY_TYPE_AUTO = 0,
 PHY_TYPE_11B,
 PHY_TYPE_11G,
 PHY_TYPE_11A
 } CARD_PHY_TYPE, *PCARD_PHY_TYPE;

Why did you remove this?

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


Re: [PATCH V4 6/6] staging: vt6556: Replace printk by pr_warn

2014-07-15 Thread Greg KH
On Mon, Jul 14, 2014 at 09:15:33PM +0200, Peter Senna Tschudin wrote:
 This patch fixes a checkpatch warning by replacing printk by pr_warn.
 
 Tested by compilation only.
 
 Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
 ---
 Cahnges from V3:
  - Splitted the patches by change type
 
  drivers/staging/vt6656/main_usb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/staging/vt6656/main_usb.c 
 b/drivers/staging/vt6656/main_usb.c
 index cc0281a..64c25e2 100644
 --- a/drivers/staging/vt6656/main_usb.c
 +++ b/drivers/staging/vt6656/main_usb.c
 @@ -527,7 +527,7 @@ static void usb_device_reset(struct vnt_private *pDevice)
  
   status = usb_reset_device(pDevice-usb);
   if (status)
 -printk(usb_device_reset fail status=%d\n,status);
 + pr_warn(usb_device_reset fail status=%d\n, status);

Please use dev_warn() instead.

thanks,

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


[PATCH 1/1] staging: comedi: removing not useful `else` after return

2014-07-15 Thread Kinka Huang
Signed-off-by: Kinka Huang kinkabr...@gmail.com
---
 drivers/staging/comedi/comedi.h  | 8 
 drivers/staging/comedi/comedi_fops.c | 9 -
 drivers/staging/comedi/comedidev.h   | 4 ++--
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index dbaeba7..552a5e2 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -555,16 +555,16 @@ static inline unsigned NI_USUAL_PFI_SELECT(unsigned 
pfi_channel)
 {
if (pfi_channel  10)
return 0x1 + pfi_channel;
-   else
-   return 0xb + pfi_channel;
+
+   return 0xb + pfi_channel;
 }
 
 static inline unsigned NI_USUAL_RTSI_SELECT(unsigned rtsi_channel)
 {
if (rtsi_channel  7)
return 0xb + rtsi_channel;
-   else
-   return 0x1b;
+
+   return 0x1b;
 }
 
 /* mode bits for NI general-purpose counters, set with
diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 038b69a..3686296 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -206,8 +206,8 @@ struct comedi_device *comedi_dev_get_from_minor(unsigned 
minor)
 {
if (minor  COMEDI_NUM_BOARD_MINORS)
return comedi_dev_get_from_board_minor(minor);
-   else
-   return comedi_dev_get_from_subdevice_minor(minor);
+
+   return comedi_dev_get_from_subdevice_minor(minor);
 }
 EXPORT_SYMBOL_GPL(comedi_dev_get_from_minor);
 
@@ -2625,10 +2625,9 @@ static int __init comedi_init(void)
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
 COMEDI_NUM_MINORS);
return PTR_ERR(dev);
-   } else {
-   /* comedi_alloc_board_minor() locked the mutex */
-   mutex_unlock(dev-mutex);
}
+   /* comedi_alloc_board_minor() locked the mutex */
+   mutex_unlock(dev-mutex);
}
 
return 0;
diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 83fd155..0167945 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -388,8 +388,8 @@ static inline unsigned int bytes_per_sample(const struct 
comedi_subdevice *subd)
 {
if (subd-subdev_flags  SDF_LSAMPL)
return sizeof(unsigned int);
-   else
-   return sizeof(short);
+
+   return sizeof(short);
 }
 
 /*
-- 
1.8.3.2

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


Re: [PATCH 6/8 V2] staging: dgap: remove unneeded dgap_err()

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 06:11:44PM +0900, Daeseok Youn wrote:
 The dgap_err() is printing a message with pr_err(),
 so all those are replaced.
 
 Use definition pr_fmt and then all of dgap: in
 the beginning of print messages are removed.
 
 And also removed out of memory message because
 the kernel has own message for that.
 
 Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
 ---
 V2: use pr_fmt dgap: prefix on print message on dgap.
 remove out of memory message.
 
 Adds Mark to TO list and CC list for checking send
 this email properly to him.
 
  drivers/staging/dgap/dgap.c |  306 
 +++
  1 files changed, 133 insertions(+), 173 deletions(-)
 
 diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
 index 06c55cb..9e750fb 100644
 --- a/drivers/staging/dgap/dgap.c
 +++ b/drivers/staging/dgap/dgap.c
 @@ -41,6 +41,8 @@
   */
  #undef DIGI_CONCENTRATORS_SUPPORTED
  
 +#define pr_fmt(fmt) dgap:  fmt
 +
  #include linux/kernel.h
  #include linux/module.h
  #include linux/pci.h
 @@ -153,7 +155,6 @@ static void dgap_firmware_reset_port(struct channel_t 
 *ch);
  static int dgap_gettok(char **in);
  static char *dgap_getword(char **in);
  static int dgap_checknode(struct cnode *p);
 -static void dgap_err(char *s);
  
  /*
   * Function prototypes from dgap_sysfs.h
 @@ -815,7 +816,7 @@ static struct board_t *dgap_found_board(struct pci_dev 
 *pdev, int id,
   if (ret)
   goto free_brd;
  
 - pr_info(dgap: board %d: %s (rev %d), irq %ld\n,
 + pr_info(board %d: %s (rev %d), irq %ld\n,
   boardnum, brd-name, brd-rev, brd-irq);

Almost all of the pr_*() calls in this driver should be converted over
to use dev_*() calls instead.  And some of them, like this one, should
be removed entirely (no need for a driver to be noisy when a device
for it is found, it should be quiet if at all possible, unless something
went wrong.)

So can you do that here instead?  I've applied the earlier patches in
this series, and stopped here.

thanks,

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


Re: [PATCH] staging: unisys: added virtpci info entry

2014-07-15 Thread Erik Arfvidson


On 07/15/2014 10:45 AM, Greg KH wrote:

[SNIP]
+#define MAX_BUF 16384
Lovely magic number, care to explain why this is this size?


Assuming we have the maximum possible configuration:
4 busses, 32 devices per bus, and we assume max of 80
characters per linegives us 10,560 bytes which rounds
up to 2^14.


[SNIP]
thanks, greg k-h 


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


Re: [PATCH 7/8 RESEND] staging: dgap: introduce dgap_cleanup_nodes()

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 06:14:25PM +0900, Daeseok Youn wrote:
 When a configration file is parsed with dgap_parsefile(),
 makes nodes for saving configrations for board.

configuration files should not be parsed in the kernel at all.  That
logic should be removed as it should not be needed.

Mark, can you verify that this is not needed with your hardware anymore?

thanks,

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


[PATCH] staging: unisys: added virtpci info entry

2014-07-15 Thread Erik Arfvidson
This patch adds the virtpci debugfs directory and the info entry
inside of it.

Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
v5: Adjusted comments and formatting, remove unused function
v4: Fixed comments, upper bound buffer, removed #define for virtpci and info,
modified printvbus to work with scnprintf and added and extra element to
print_vbus_info struct
v3: Fixed formating and comments. Also added debufs_remove_recursive() and
simple simple_read_from_buffer()
v2: Fixed comments and applied Dan Carpenter suggestions

 drivers/staging/unisys/virtpci/virtpci.c | 106 ++-
 1 file changed, 104 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/virtpci/virtpci.c 
b/drivers/staging/unisys/virtpci/virtpci.c
index 7d840b0..f498116 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -36,6 +36,7 @@
 #include linux/mod_devicetable.h
 #include linux/if_ether.h
 #include linux/version.h
+#include linux/debugfs.h
 #include version.h
 #include guestlinuxdebug.h
 #include timskmodutils.h
@@ -57,6 +58,7 @@ struct driver_private {
 #endif
 
 #define BUS_ID(x) dev_name(x)
+#define MAX_BUF 16384
 
 #include virtpci.h
 
@@ -100,6 +102,12 @@ static int virtpci_device_resume(struct device *dev);
 static int virtpci_device_probe(struct device *dev);
 static int virtpci_device_remove(struct device *dev);
 
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset);
+
+static const struct file_operations debugfs_info_fops = {
+   .read = info_debugfs_read,
+};
 
 /*/
 /* Globals   */
@@ -140,6 +148,13 @@ static DEFINE_RWLOCK(VpcidevListLock);
 /* filled in with info about this driver, wrt it servicing client busses */
 static ULTRA_VBUS_DEVICEINFO Bus_DriverInfo;
 
+/*/
+/* debugfs entries   */
+/*/
+/* dentry is used to create the debugfs entry directory
+ * for virtpci
+ */
+static struct dentry *virtpci_debugfs_dir;
 
 struct virtpci_busdev {
struct device virtpci_bus_device;
@@ -1377,6 +1392,90 @@ void virtpci_unregister_driver(struct virtpci_driver 
*drv)
 EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
 
 /*/
+/* debugfs filesystem functions  */
+/*/
+struct print_vbus_info {
+   int *str_pos;
+   char *buf;
+   size_t *len;
+};
+
+static int print_vbus(struct device *vbus, void *data)
+{
+   struct print_vbus_info *p = (struct print_vbus_info *)data;
+
+   *p-str_pos += scnprintf(p-buf + *p-str_pos, *p-len - *p-str_pos,
+   bus_id:%s\n, dev_name(vbus));
+   return 0;
+}
+
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset)
+{
+   ssize_t bytes_read = 0;
+   int str_pos = 0;
+   struct virtpci_dev *tmpvpcidev;
+   unsigned long flags;
+   struct print_vbus_info printparam;
+   char *vbuf;
+
+   if (len  MAX_BUF)
+   len = MAX_BUF;
+   vbuf = kzalloc(len, GFP_KERNEL);
+   if (!vbuf)
+   return -ENOMEM;
+
+   str_pos += scnprintf(vbuf + str_pos, len - str_pos,
+Virtual PCI Bus devices\n);
+   printparam.str_pos = str_pos;
+   printparam.buf = vbuf;
+   printparam.len = len;
+   if (bus_for_each_dev(virtpci_bus_type, NULL,
+(void *) printparam, print_vbus))
+   LOGERR(Failed to find bus\n);
+
+   str_pos += scnprintf(vbuf + str_pos, len - str_pos,
+   \n Virtual PCI devices\n);
+   read_lock_irqsave(VpcidevListLock, flags);
+   tmpvpcidev = VpcidevListHead;
+   while (tmpvpcidev) {
+   if (tmpvpcidev-devtype == VIRTHBA_TYPE) {
+   str_pos += scnprintf(vbuf + str_pos, len - str_pos,
+   [%d:%d] VHba:%08x:%08x 
max-config:%d-%d-%d-%d,
+   tmpvpcidev-busNo, tmpvpcidev-deviceNo,
+   tmpvpcidev-scsi.wwnn.wwnn1,
+   tmpvpcidev-scsi.wwnn.wwnn2,
+   tmpvpcidev-scsi.max.max_channel,
+   tmpvpcidev-scsi.max.max_id,
+   tmpvpcidev-scsi.max.max_lun,
+   tmpvpcidev-scsi.max.cmd_per_lun);
+   } else {
+   str_pos += scnprintf(vbuf + str_pos, len 

Re: [PATCH] staging: unisys: added virtpci info entry

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 11:31:03AM -0400, Erik Arfvidson wrote:
 
 On 07/15/2014 10:45 AM, Greg KH wrote:
 [SNIP]
 +#define MAX_BUF 16384
 Lovely magic number, care to explain why this is this size?
 
 Assuming we have the maximum possible configuration:
 4 busses, 32 devices per bus, and we assume max of 80
 characters per linegives us 10,560 bytes which rounds
 up to 2^14.

Then _DOCUMENT IT_.

So in 5 years, when you look at the code again, you will remember this
is how you came up with that number.

thanks,

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


Re: [PATCH] staging: unisys: added virtpci info entry

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 11:38:16AM -0400, Erik Arfvidson wrote:
 This patch adds the virtpci debugfs directory and the info entry
 inside of it.
 
 Signed-off-by: Erik Arfvidson erik.arfvid...@unisys.com
 Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
 ---
 v5: Adjusted comments and formatting, remove unused function

What unused function?

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


[PATCH] Staging:tidspbridge Fix checkpatch.pl warning char * array declaration might be better as static const

2014-07-15 Thread Adithya Krishnamurthy
From: Adithya Krishnamurthy linux.challen...@gmail.com

Fixed checkpatch WARNING: char * array declaration might be better as static 
const

Signed-off-by: Adithya Krishnamurthy linux.challen...@gmail.com
---
 drivers/staging/tidspbridge/core/io_sm.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/io_sm.c 
b/drivers/staging/tidspbridge/core/io_sm.c
index 42f94e1..24bd962 100644
--- a/drivers/staging/tidspbridge/core/io_sm.c
+++ b/drivers/staging/tidspbridge/core/io_sm.c
@@ -1910,10 +1910,11 @@ int dump_dsp_stack(struct bridge_dev_context 
*bridge_context)
u32 offset_output;
u32 total_size;
u32 poll_cnt;
-   const char *dsp_regs[] = {EFR, IERR, ITSR, NTSR,
+   static const char * const dsp_regs[] = {EFR, IERR, ITSR, NTSR,
IRP, NRP, AMR, SSR,
ILC, RILC, IER, CSR};
-   const char *exec_ctxt[] = {Task, SWI, HWI, Unknown};
+   static const char * const exec_ctxt[] = {Task, SWI, HWI,
+   Unknown};
struct bridge_drv_interface *intf_fxns;
struct dev_object *dev_object = bridge_context-dev_obj;
 
-- 
1.7.9.5

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


[PATCH] Staging:tidspbridge Fix minor checkpatch.pl warning unnecessary whitespace before a quoted newline

2014-07-15 Thread Adithya Krishnamurthy
From: Adithya Krishnamurthy linux.challen...@gmail.com

Fixed checkpatch WARNING: unnecessary whitespace before a quoted newline

Signed-off-by: Adithya Krishnamurthy linux.challen...@gmail.com
---
 drivers/staging/tidspbridge/core/tiomap3430.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c 
b/drivers/staging/tidspbridge/core/tiomap3430.c
index f63dd8f..0559ab6 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -536,7 +536,7 @@ static int bridge_brd_start(struct bridge_dev_context 
*dev_ctxt,
if ((unsigned int *)ul_dsp_clk_addr != NULL) {
/* Get the clock rate */
ul_dsp_clk_rate = dsp_clk_get_iva2_rate();
-   dev_dbg(bridge, %s: DSP clock rate (KHZ): 0x%x \n,
+   dev_dbg(bridge, %s: DSP clock rate (KHZ): 0x%x\n,
__func__, ul_dsp_clk_rate);
(void)bridge_brd_write(dev_context,
   (u8 *) ul_dsp_clk_rate,
-- 
1.7.9.5

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


[PATCH] Staging:tidspbridge Fix minor checkpatch.pl warining Unnecessary parentheses

2014-07-15 Thread Adithya Krishnamurthy
From: Adithya Krishnamurthy linux.challen...@gmail.com

Fixed checkpatch WARNING: Unnecessary parentheses

Signed-off-by: Adithya Krishnamurthy linux.challen...@gmail.com
---
 drivers/staging/tidspbridge/dynload/cload.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/tidspbridge/dynload/cload.c 
b/drivers/staging/tidspbridge/dynload/cload.c
index 83f2106..b306349 100644
--- a/drivers/staging/tidspbridge/dynload/cload.c
+++ b/drivers/staging/tidspbridge/dynload/cload.c
@@ -376,7 +376,7 @@ void dload_headers(struct dload_state *dlthis)
return;
}
/* Check for valid file format */
-   if ((dlthis-dfile_hdr.df_doff_version != DOFF0)) {
+   if (dlthis-dfile_hdr.df_doff_version != DOFF0) {
dload_error(dlthis, Bad DOFF version 0x%x,
dlthis-dfile_hdr.df_doff_version);
return;
-- 
1.7.9.5

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


[PATCH 01/94] ARM: shmobile: Add DT and defconfigs to MAINTAINERS

2014-07-15 Thread Sam Asadi
From: Simon Horman horms+rene...@verge.net.au

There are a number of DT and defconfig files which
are maintained as part of shmobile but have not been
listed as such in the MAINTAINERS file. This creates
confusion from time to time.

Signed-off-by: Simon Horman horms+rene...@verge.net.au
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 MAINTAINERS |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c411c40..e31c874 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1314,6 +1314,20 @@ W:   http://oss.renesas.com
 Q: http://patchwork.kernel.org/project/linux-sh/list/
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next
 S: Supported
+F: arch/arm/boot/dts/emev2*
+F: arch/arm/boot/dts/r7s*
+F: arch/arm/boot/dts/r8a*
+F: arch/arm/boot/dts/sh*
+F: arch/arm/configs/ape6evm_defconfig
+F: arch/arm/configs/armadillo800eva_defconfig
+F: arch/arm/configs/bockw_defconfig
+F: arch/arm/configs/genmai_defconfig
+F: arch/arm/configs/koelsch_defconfig
+F: arch/arm/configs/kzm9g_defconfig
+F: arch/arm/configs/lager_defconfig
+F: arch/arm/configs/mackerel_defconfig
+F: arch/arm/configs/marzen_defconfig
+F: arch/arm/configs/shmobile_defconfig
 F: arch/arm/mach-shmobile/
 F: drivers/sh/
 
-- 
1.7.10.4

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


Re: [PATCH 01/94] ARM: shmobile: Add DT and defconfigs to MAINTAINERS

2014-07-15 Thread Greg KH
On Tue, Jul 15, 2014 at 07:53:07PM +0300, Sam Asadi wrote:
 From: Simon Horman horms+rene...@verge.net.au
 
 There are a number of DT and defconfig files which
 are maintained as part of shmobile but have not been
 listed as such in the MAINTAINERS file. This creates
 confusion from time to time.
 
 Signed-off-by: Simon Horman horms+rene...@verge.net.au
 Signed-off-by: sam-the-6 asadi.sam...@gmail.com

Really?  We need a real name here.

And why are you passing on Simon's patches, why would I care about this
patch to the MAINTAINERS file?

confused,

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


[PATCH 01/94] ARM: shmobile: Add DT and defconfigs to MAINTAINERS

2014-07-15 Thread Sam Asadi
From: Simon Horman horms+rene...@verge.net.au

There are a number of DT and defconfig files which
are maintained as part of shmobile but have not been
listed as such in the MAINTAINERS file. This creates
confusion from time to time.

Signed-off-by: Simon Horman horms+rene...@verge.net.au
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 MAINTAINERS |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c411c40..e31c874 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1314,6 +1314,20 @@ W:   http://oss.renesas.com
 Q: http://patchwork.kernel.org/project/linux-sh/list/
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next
 S: Supported
+F: arch/arm/boot/dts/emev2*
+F: arch/arm/boot/dts/r7s*
+F: arch/arm/boot/dts/r8a*
+F: arch/arm/boot/dts/sh*
+F: arch/arm/configs/ape6evm_defconfig
+F: arch/arm/configs/armadillo800eva_defconfig
+F: arch/arm/configs/bockw_defconfig
+F: arch/arm/configs/genmai_defconfig
+F: arch/arm/configs/koelsch_defconfig
+F: arch/arm/configs/kzm9g_defconfig
+F: arch/arm/configs/lager_defconfig
+F: arch/arm/configs/mackerel_defconfig
+F: arch/arm/configs/marzen_defconfig
+F: arch/arm/configs/shmobile_defconfig
 F: arch/arm/mach-shmobile/
 F: drivers/sh/
 
-- 
1.7.10.4

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


[PATCH 05/94] clk: ti: set CLK_SET_RATE_NO_REPARENT for ti,mux-clock

2014-07-15 Thread Sam Asadi
From: Tomi Valkeinen tomi.valkei...@ti.com

When setting the rate of a clock, by default the clock framework will
change the parent of the clock to the most suitable one in
__clk_mux_determine_rate() (most suitable by looking at the clock rate).

This is a rather dangerous default, and causes problems on AM43x when
using display and ethernet. There are multiple ways to select the clock
muxes on AM43x, and some of those clock paths have the same source
clocks for display and ethernet. When changing the clock rate for the
display subsystem, the clock framework decides to change the display mux
from the dedicated display PLL to a shared PLL which is used by the
ethernet, and then changes the rate of the shared PLL, breaking the
ethernet.

As I don't think there ever is a case where we want the clock framework
to automatically change the parent clock of a clock mux, this patch sets
the CLK_SET_RATE_NO_REPARENT for all ti,mux-clocks.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
Reviewed-by: Paul Walmsley p...@pwsan.com
Tested-by: Felipe Balbi ba...@ti.com
Signed-off-by: Tero Kristo t-kri...@ti.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/ti/mux.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c
index 0197a47..e9d650e 100644
--- a/drivers/clk/ti/mux.c
+++ b/drivers/clk/ti/mux.c
@@ -160,7 +160,7 @@ static void of_mux_clk_setup(struct device_node *node)
u8 clk_mux_flags = 0;
u32 mask = 0;
u32 shift = 0;
-   u32 flags = 0;
+   u32 flags = CLK_SET_RATE_NO_REPARENT;
 
num_parents = of_clk_get_parent_count(node);
if (num_parents  2) {
-- 
1.7.10.4

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


[PATCH 04/94] clk: ti: am43x: Fix boot with CONFIG_SOC_AM33XX disabled

2014-07-15 Thread Sam Asadi
From: Roger Quadros rog...@ti.com

Define ti_clk_register_dpll_x2() and of_ti_am3_dpll_x2_setup() if
AM43XX is defined.

Fixes the below boot issue.

[2.157258] gpmc_l3_clk not enabled
[2.161194] gpmc_l3_clk not enabled
[2.164896] Division by zero in kernel.
[2.169055] CPU: 0 PID: 321 Comm: kworker/u2:2 Tainted: GW 
3.16.0-rc1-8-g4c0e520 #273
[2.178880] Workqueue: deferwq deferred_probe_work_func
[2.184459] [c001477c] (unwind_backtrace) from [c001187c] 
(show_stack+0x10/0x14)
[2.192752] [c001187c] (show_stack) from [c0530f28] 
(dump_stack+0x80/0x9c)
[2.200486] [c0530f28] (dump_stack) from [c02c867c] (Ldiv0+0x8/0x10)
[2.207678] [c02c867c] (Ldiv0) from [c0022da0] 
(gpmc_calc_divider+0x24/0x40)
[2.215490] [c0022da0] (gpmc_calc_divider) from [c0022e20] 
(gpmc_cs_set_timings+0x18/0x474)
[2.224783] [c0022e20] (gpmc_cs_set_timings) from [c003069c] 
(gpmc_nand_init+0x74/0x1a8)
[2.233791] [c003069c] (gpmc_nand_init) from [c0024668] 
(gpmc_probe+0x52c/0x874)
[2.242089] [c0024668] (gpmc_probe) from [c0349218] 
(platform_drv_probe+0x18/0x48)
[2.250534] [c0349218] (platform_drv_probe) from [c0347d88] 
(driver_probe_device+0x104/0x22c)
[2.259988] [c0347d88] (driver_probe_device) from [c03464dc] 
(bus_for_each_drv+0x44/0x8c)
[2.269087] [c03464dc] (bus_for_each_drv) from [c0347c4c] 
(device_attach+0x74/0x8c)
[2.277620] [c0347c4c] (device_attach) from [c0347380] 
(bus_probe_device+0x88/0xb0)
[2.286074] [c0347380] (bus_probe_device) from [c0347768] 
(deferred_probe_work_func+0x60/0x90)
[2.295611] [c0347768] (deferred_probe_work_func) from [c004ef50] 
(process_one_work+0x1b4/0x4bc)
[2.305288] [c004ef50] (process_one_work) from [c004f3d4] 
(worker_thread+0x148/0x550)
[2.313954] [c004f3d4] (worker_thread) from [c0055a48] 
(kthread+0xc8/0xe4)
[2.321628] [c0055a48] (kthread) from [c000e648] 
(ret_from_fork+0x14/0x2c)

Signed-off-by: Roger Quadros rog...@ti.com
Reported-by: Tony Lindgren t...@atomide.com
Signed-off-by: Tero Kristo t-kri...@ti.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/ti/dpll.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
index abd956d..79791e1 100644
--- a/drivers/clk/ti/dpll.c
+++ b/drivers/clk/ti/dpll.c
@@ -161,7 +161,8 @@ cleanup:
 }
 
 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
-   defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX)
+   defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \
+   defined(CONFIG_SOC_AM43XX)
 /**
  * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock
  * @node: device node for this clock
@@ -322,7 +323,7 @@ CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, 
ti,omap4-dpll-x2-clock,
   of_ti_omap4_dpll_x2_setup);
 #endif
 
-#ifdef CONFIG_SOC_AM33XX
+#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
 static void __init of_ti_am3_dpll_x2_setup(struct device_node *node)
 {
ti_clk_register_dpll_x2(node, dpll_x2_ck_ops, NULL);
-- 
1.7.10.4

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


[PATCH 03/94] clk: ti: dra7: return error code in failure case

2014-07-15 Thread Sam Asadi
From: Julia Lawall julia.law...@lip6.fr

Add a returned error code in the MAX_APLL_WAIT_TRIES case.  Remove the
updating of the return variable r to 0 if MAX_APLL_WAIT_TRIES is not yet
reached, because r is already 0 at this point.

Signed-off-by: Julia Lawall julia.law...@lip6.fr
Signed-off-by: Tero Kristo t-kri...@ti.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/ti/apll.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c
index 18dbaf12..72d9727 100644
--- a/drivers/clk/ti/apll.c
+++ b/drivers/clk/ti/apll.c
@@ -77,13 +77,11 @@ static int dra7_apll_enable(struct clk_hw *hw)
if (i == MAX_APLL_WAIT_TRIES) {
pr_warn(clock: %s failed transition to '%s'\n,
clk_name, (state) ? locked : bypassed);
-   } else {
+   r = -EBUSY;
+   } else
pr_debug(clock: %s transition to '%s' in %d loops\n,
 clk_name, (state) ? locked : bypassed, i);
 
-   r = 0;
-   }
-
return r;
 }
 
-- 
1.7.10.4

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


[PATCH 12/94] dma: cppi41: handle 0-length packets

2014-07-15 Thread Sam Asadi
From: Daniel Mack zon...@gmail.com

When a 0-length packet is received on the bus, desc-pd0 yields 1,
which confuses the driver's users. This information is clearly wrong
and not in accordance to the datasheet, but it's been observed on an
AM335x board, very reproducible.

Fix this by looking at bit 19 in PD2 of the completed packet. This bit
will tell us if a zero-length packet was received on a queue. If it's
set, ignore the value in PD0 and report a total length of 0 instead.

Signed-off-by: Daniel Mack zon...@gmail.com
Signed-off-by: Vinod Koul vinod.k...@intel.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/dma/cppi41.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index d028f36..8f8b0b6 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -86,6 +86,9 @@
 
 #define USBSS_IRQ_PD_COMP  (1   2)
 
+/* Packet Descriptor */
+#define PD2_ZERO_LENGTH(1  19)
+
 struct cppi41_channel {
struct dma_chan chan;
struct dma_async_tx_descriptor txd;
@@ -307,7 +310,7 @@ static irqreturn_t cppi41_irq(int irq, void *data)
__iormb();
 
while (val) {
-   u32 desc;
+   u32 desc, len;
 
q_num = __fls(val);
val = ~(1  q_num);
@@ -319,9 +322,13 @@ static irqreturn_t cppi41_irq(int irq, void *data)
q_num, desc);
continue;
}
-   c-residue = pd_trans_len(c-desc-pd6) -
-   pd_trans_len(c-desc-pd0);
 
+   if (c-desc-pd2  PD2_ZERO_LENGTH)
+   len = 0;
+   else
+   len = pd_trans_len(c-desc-pd0);
+
+   c-residue = pd_trans_len(c-desc-pd6) - len;
dma_cookie_complete(c-txd);
c-txd.callback(c-txd.callback_param);
}
-- 
1.7.10.4

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


[PATCH 09/94] clk: s3c64xx: Hookup SPI clocks correctly

2014-07-15 Thread Sam Asadi
From: Charles Keepax ckee...@opensource.wolfsonmicro.com

In the move to this clock driver the hookups for the SPI clocks were
dropped, which causes my system Cragganmore (s3c6410 based) to be unable
to locate any spibus clocks. This patch adds them back in.

When taking the clock from the epll clock (SCLK) the rates on the SPI
bus are incorrect, this needs further debugging but the hookup here
should be correct and the problem should be else where.

The USBCLK case has been dropped because this requires the USB PHY to be
enabled.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
Signed-off-by: Tomasz Figa t.f...@samsung.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/samsung/clk-s3c64xx.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-s3c64xx.c 
b/drivers/clk/samsung/clk-s3c64xx.c
index efa16ee..8889ff1c 100644
--- a/drivers/clk/samsung/clk-s3c64xx.c
+++ b/drivers/clk/samsung/clk-s3c64xx.c
@@ -418,8 +418,10 @@ static struct samsung_clock_alias s3c64xx_clock_aliases[] 
= {
ALIAS(SCLK_MMC2, s3c-sdhci.2, mmc_busclk.2),
ALIAS(SCLK_MMC1, s3c-sdhci.1, mmc_busclk.2),
ALIAS(SCLK_MMC0, s3c-sdhci.0, mmc_busclk.2),
-   ALIAS(SCLK_SPI1, s3c6410-spi.1, spi-bus),
-   ALIAS(SCLK_SPI0, s3c6410-spi.0, spi-bus),
+   ALIAS(PCLK_SPI1, s3c6410-spi.1, spi_busclk0),
+   ALIAS(SCLK_SPI1, s3c6410-spi.1, spi_busclk2),
+   ALIAS(PCLK_SPI0, s3c6410-spi.0, spi_busclk0),
+   ALIAS(SCLK_SPI0, s3c6410-spi.0, spi_busclk2),
ALIAS(SCLK_AUDIO1, samsung-pcm.1, audio-bus),
ALIAS(SCLK_AUDIO1, samsung-i2s.1, audio-bus),
ALIAS(SCLK_AUDIO0, samsung-pcm.0, audio-bus),
-- 
1.7.10.4

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


[PATCH 15/94] clk: sunxi: fix devm_ioremap_resource error detection code

2014-07-15 Thread Sam Asadi
From: Himangi Saraogi himangi...@gmail.com

devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure.

A simplified version of the semantic match that finds this problem is as
follows:

// smpl
@@
expression e,e1;
statement S;
@@

*e = devm_ioremap_resource(...);
if (!e1) S

// /smpl

Signed-off-by: Himangi Saraogi himangi...@gmail.com
Acked-by: Julia Lawall julia.law...@lip6.fr
Acked-by Boris BREZILLON boris.brezil...@free-electrons.com
Signed-off-by: Mike Turquette mturque...@linaro.org
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/sunxi/clk-sun6i-apb0-gates.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c 
b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c
index 44cd27c..670f90d 100644
--- a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c
+++ b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c
@@ -29,7 +29,7 @@ static int sun6i_a31_apb0_gates_clk_probe(struct 
platform_device *pdev)
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
reg = devm_ioremap_resource(pdev-dev, r);
-   if (!reg)
+   if (IS_ERR(reg))
return PTR_ERR(reg);
 
clk_parent = of_clk_get_parent_name(np, 0);
-- 
1.7.10.4

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


[PATCH 11/94] clk: exynos5420: Remove aclk66_peric from the clock tree description

2014-07-15 Thread Sam Asadi
From: Doug Anderson diand...@chromium.org

The aclk66_peric clock is a gate clock with a whole bunch of gates
underneath it.  This big gate isn't very useful to include in our
clock tree.  If any of the children need to be turned on then the big
gate will need to be on anyway.  ...and there are plenty of other big
gates that aren't described in our clock tree, some of which shut off
collections of clocks that have no relationship in the hierarchy so
are hard to model.

aclk66_peric is causing earlyprintk problems since it gets disabled
as part of the boot process, so let's just remove it.

Strangely (and for no good reason) this clock is exported as part of
the common clock bindings.  Remove it since there are no in-kernel
device trees using it and no reason anyone out of tree should refer to
it either.

Signed-off-by: Doug Anderson diand...@chromium.org
Signed-off-by: Tomasz Figa t.f...@samsung.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/samsung/clk-exynos5420.c   |   85 +---
 include/dt-bindings/clock/exynos5420.h |1 -
 2 files changed, 55 insertions(+), 31 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5420.c 
b/drivers/clk/samsung/clk-exynos5420.c
index 9d7d7ee..61eccf0 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -890,8 +890,6 @@ static struct samsung_gate_clock exynos5x_gate_clks[] 
__initdata = {
GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0),
GATE(0, aclk66_psgen, mout_user_aclk66_psgen,
GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0),
-   GATE(CLK_ACLK66_PERIC, aclk66_peric, mout_user_aclk66_peric,
-   GATE_BUS_TOP, 11, CLK_IGNORE_UNUSED, 0),
GATE(0, aclk266_isp, mout_user_aclk266_isp,
GATE_BUS_TOP, 13, 0, 0),
GATE(0, aclk166, mout_user_aclk166,
@@ -994,34 +992,61 @@ static struct samsung_gate_clock exynos5x_gate_clks[] 
__initdata = {
SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0),
 
/* PERIC Block */
-   GATE(CLK_UART0, uart0, aclk66_peric, GATE_IP_PERIC, 0, 0, 0),
-   GATE(CLK_UART1, uart1, aclk66_peric, GATE_IP_PERIC, 1, 0, 0),
-   GATE(CLK_UART2, uart2, aclk66_peric, GATE_IP_PERIC, 2, 0, 0),
-   GATE(CLK_UART3, uart3, aclk66_peric, GATE_IP_PERIC, 3, 0, 0),
-   GATE(CLK_I2C0, i2c0, aclk66_peric, GATE_IP_PERIC, 6, 0, 0),
-   GATE(CLK_I2C1, i2c1, aclk66_peric, GATE_IP_PERIC, 7, 0, 0),
-   GATE(CLK_I2C2, i2c2, aclk66_peric, GATE_IP_PERIC, 8, 0, 0),
-   GATE(CLK_I2C3, i2c3, aclk66_peric, GATE_IP_PERIC, 9, 0, 0),
-   GATE(CLK_USI0, usi0, aclk66_peric, GATE_IP_PERIC, 10, 0, 0),
-   GATE(CLK_USI1, usi1, aclk66_peric, GATE_IP_PERIC, 11, 0, 0),
-   GATE(CLK_USI2, usi2, aclk66_peric, GATE_IP_PERIC, 12, 0, 0),
-   GATE(CLK_USI3, usi3, aclk66_peric, GATE_IP_PERIC, 13, 0, 0),
-   GATE(CLK_I2C_HDMI, i2c_hdmi, aclk66_peric, GATE_IP_PERIC, 14, 0, 0),
-   GATE(CLK_TSADC, tsadc, aclk66_peric, GATE_IP_PERIC, 15, 0, 0),
-   GATE(CLK_SPI0, spi0, aclk66_peric, GATE_IP_PERIC, 16, 0, 0),
-   GATE(CLK_SPI1, spi1, aclk66_peric, GATE_IP_PERIC, 17, 0, 0),
-   GATE(CLK_SPI2, spi2, aclk66_peric, GATE_IP_PERIC, 18, 0, 0),
-   GATE(CLK_I2S1, i2s1, aclk66_peric, GATE_IP_PERIC, 20, 0, 0),
-   GATE(CLK_I2S2, i2s2, aclk66_peric, GATE_IP_PERIC, 21, 0, 0),
-   GATE(CLK_PCM1, pcm1, aclk66_peric, GATE_IP_PERIC, 22, 0, 0),
-   GATE(CLK_PCM2, pcm2, aclk66_peric, GATE_IP_PERIC, 23, 0, 0),
-   GATE(CLK_PWM, pwm, aclk66_peric, GATE_IP_PERIC, 24, 0, 0),
-   GATE(CLK_SPDIF, spdif, aclk66_peric, GATE_IP_PERIC, 26, 0, 0),
-   GATE(CLK_USI4, usi4, aclk66_peric, GATE_IP_PERIC, 28, 0, 0),
-   GATE(CLK_USI5, usi5, aclk66_peric, GATE_IP_PERIC, 30, 0, 0),
-   GATE(CLK_USI6, usi6, aclk66_peric, GATE_IP_PERIC, 31, 0, 0),
-
-   GATE(CLK_KEYIF, keyif, aclk66_peric, GATE_BUS_PERIC, 22, 0, 0),
+   GATE(CLK_UART0, uart0, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 0, 0, 0),
+   GATE(CLK_UART1, uart1, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 1, 0, 0),
+   GATE(CLK_UART2, uart2, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 2, 0, 0),
+   GATE(CLK_UART3, uart3, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 3, 0, 0),
+   GATE(CLK_I2C0, i2c0, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 6, 0, 0),
+   GATE(CLK_I2C1, i2c1, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 7, 0, 0),
+   GATE(CLK_I2C2, i2c2, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 8, 0, 0),
+   GATE(CLK_I2C3, i2c3, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 9, 0, 0),
+   GATE(CLK_USI0, usi0, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 10, 0, 0),
+   GATE(CLK_USI1, usi1, mout_user_aclk66_peric,
+   GATE_IP_PERIC, 11, 0, 

[PATCH 32/94] ext4: clarify error count warning messages

2014-07-15 Thread Sam Asadi
From: Theodore Ts'o ty...@mit.edu

Make it clear that values printed are times, and that it is error
since last fsck. Also add note about fsck version required.

Signed-off-by: Pavel Machek pa...@ucw.cz
Signed-off-by: Theodore Ts'o ty...@mit.edu
Reviewed-by: Andreas Dilger adil...@dilger.ca
Cc: sta...@vger.kernel.org
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 fs/ext4/super.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b9b9aab..3423947 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2809,10 +2809,11 @@ static void print_daily_error_info(unsigned long arg)
es = sbi-s_es;
 
if (es-s_error_count)
-   ext4_msg(sb, KERN_NOTICE, error count: %u,
+   /* fsck newer than v1.41.13 is needed to clean this condition. 
*/
+   ext4_msg(sb, KERN_NOTICE, error count since last fsck: %u,
 le32_to_cpu(es-s_error_count));
if (es-s_first_error_time) {
-   printk(KERN_NOTICE EXT4-fs (%s): initial error at %u: %.*s:%d,
+   printk(KERN_NOTICE EXT4-fs (%s): initial error at time %u: 
%.*s:%d,
   sb-s_id, le32_to_cpu(es-s_first_error_time),
   (int) sizeof(es-s_first_error_func),
   es-s_first_error_func,
@@ -2826,7 +2827,7 @@ static void print_daily_error_info(unsigned long arg)
printk(\n);
}
if (es-s_last_error_time) {
-   printk(KERN_NOTICE EXT4-fs (%s): last error at %u: %.*s:%d,
+   printk(KERN_NOTICE EXT4-fs (%s): last error at time %u: 
%.*s:%d,
   sb-s_id, le32_to_cpu(es-s_last_error_time),
   (int) sizeof(es-s_last_error_func),
   es-s_last_error_func,
-- 
1.7.10.4

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


[PATCH 22/94] ARM: dts: fix pwm-cells in pwm node for exynos4

2014-07-15 Thread Sam Asadi
From: Jaewon Kim jaewon02@samsung.com

pwm-cells should be 3. Third cell is optional PWM flags. And This flag
supported by this binding is PWM_POLARITY_INVERTED.

Signed-off-by: Jaewon Kim jaewon02@samsung.com
Reviewed-by: Sachin Kamat sachin.ka...@samsung.com
Signed-off-by: Kukjin Kim kgene@samsung.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 arch/arm/boot/dts/exynos4.dtsi |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index fbaf426..17b22e9 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -554,7 +554,7 @@
interrupts = 0 37 0, 0 38 0, 0 39 0, 0 40 0, 0 41 0;
clocks = clock CLK_PWM;
clock-names = timers;
-   #pwm-cells = 2;
+   #pwm-cells = 3;
status = disabled;
};
 
-- 
1.7.10.4

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


[PATCH 24/94] clocksource: exynos_mct: Register the timer for stable udelay

2014-07-15 Thread Sam Asadi
From: Amit Daniel Kachhap amit.dan...@samsung.com

This patch registers the exynos mct clocksource as the current timer
as it has constant clock rate. This will generate correct udelay for
the exynos platform and avoid using unnecessary calibrated
jiffies. This change has been tested on exynos5420 based board and
udelay is very close to expected.

Without this patch udelay() on exynos5400 / exynos5800 is wildly
inaccurate due to big.LITTLE not adjusting loops_per_jiffy correctly.
Also without this patch udelay() on exynos5250 can be innacruate
during transitions between frequencies  800 MHz (you'll go 200 MHz -
800 MHz - 300 MHz and will run at 800 MHz for a time with the wrong
loops_per_jiffy).

[dianders: reworked and created version 3]

Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
Signed-off-by: Doug Anderson diand...@chromium.org
Signed-off-by: Kukjin Kim kgene@samsung.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clocksource/exynos_mct.c |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 5ce99c0..ab51bf20a 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -200,10 +200,21 @@ static u64 notrace exynos4_read_sched_clock(void)
return _exynos4_frc_read();
 }
 
+static struct delay_timer exynos4_delay_timer;
+
+static cycles_t exynos4_read_current_timer(void)
+{
+   return _exynos4_frc_read();
+}
+
 static void __init exynos4_clocksource_init(void)
 {
exynos4_mct_frc_start();
 
+   exynos4_delay_timer.read_current_timer = exynos4_read_current_timer;
+   exynos4_delay_timer.freq = clk_rate;
+   register_current_timer_delay(exynos4_delay_timer);
+
if (clocksource_register_hz(mct_frc, clk_rate))
panic(%s: can't register clocksource\n, mct_frc.name);
 
-- 
1.7.10.4

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


[PATCH 21/94] ARM: EXYNOS: Fix the check for non-smp configuration

2014-07-15 Thread Sam Asadi
From: Abhilash Kesavan a.kesa...@samsung.com

Commit 1754c42e3db5(ARM: exynos: move sysram info to exynos.c) missed
out the CONFIG_ prefix causing exynos_sysram_init() to get called twice
for SMP configurations.

Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com
Reviewed-by: Sachin Kamat sachin.ka...@samsug.com
Signed-off-by: Kukjin Kim kgene@samsung.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 arch/arm/mach-exynos/exynos.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index f38cf7c..95cad25 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -297,7 +297,7 @@ static void __init exynos_dt_machine_init(void)
 * This is called from smp_prepare_cpus if we've built for SMP, but
 * we still need to set it up for PM and firmware ops if not.
 */
-   if (!IS_ENABLED(SMP))
+   if (!IS_ENABLED(CONFIG_SMP))
exynos_sysram_init();
 
exynos_cpuidle_init();
-- 
1.7.10.4

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


[PATCH 82/94] ext4: fix a potential deadlock in __ext4_es_shrink()

2014-07-15 Thread Sam Asadi
From: Theodore Ts'o ty...@mit.edu

This fixes the following lockdep complaint:

[ INFO: possible circular locking dependency detected ]
3.16.0-rc2-mm1+ #7 Tainted: G   O
---
kworker/u24:0/4356 is trying to acquire lock:
 ((sbi-s_es_lru_lock)-rlock){+.+.-.}, at: [81285fff] 
__ext4_es_shrink+0x4f/0x2e0

but task is already holding lock:
 (ei-i_es_lock){-.}, at: [81286961] 
ext4_es_insert_extent+0x71/0x180

which lock already depends on the new lock.

 Possible unsafe locking scenario:

   CPU0CPU1
   
  lock(ei-i_es_lock);
   lock((sbi-s_es_lru_lock)-rlock);
   lock(ei-i_es_lock);
  lock((sbi-s_es_lru_lock)-rlock);

 *** DEADLOCK ***

6 locks held by kworker/u24:0/4356:
 #0:  (writeback){.+.+.+}, at: [81071d00] 
process_one_work+0x180/0x560
 #1:  (((wb-dwork)-work)){+.+.+.}, at: [81071d00] 
process_one_work+0x180/0x560
 #2:  (type-s_umount_key#22){++}, at: [811a9c74] 
grab_super_passive+0x44/0x90
 #3:  (jbd2_handle){+.+...}, at: [812979f9] 
start_this_handle+0x189/0x5f0
 #4:  (ei-i_data_sem){..}, at: [81247062] 
ext4_map_blocks+0x132/0x550
 #5:  (ei-i_es_lock){-.}, at: [81286961] 
ext4_es_insert_extent+0x71/0x180

stack backtrace:
CPU: 0 PID: 4356 Comm: kworker/u24:0 Tainted: G   O   3.16.0-rc2-mm1+ #7
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Workqueue: writeback bdi_writeback_workfn (flush-253:0)
 8213dce0 880014b07538 815df0bb 0007
 8213e040 880014b07588 815db3dd 880014b07568
 880014b07610 88003b868930 88003b868908 88003b868930
Call Trace:
 [815df0bb] dump_stack+0x4e/0x68
 [815db3dd] print_circular_bug+0x1fb/0x20c
 [810a7a3e] __lock_acquire+0x163e/0x1d00
 [815e89dc] ? retint_restore_args+0xe/0xe
 [815ddc7b] ? __slab_alloc+0x4a8/0x4ce
 [81285fff] ? __ext4_es_shrink+0x4f/0x2e0
 [810a8707] lock_acquire+0x87/0x120
 [81285fff] ? __ext4_es_shrink+0x4f/0x2e0
 [8128592d] ? ext4_es_free_extent+0x5d/0x70
 [815e6f09] _raw_spin_lock+0x39/0x50
 [81285fff] ? __ext4_es_shrink+0x4f/0x2e0
 [8119760b] ? kmem_cache_alloc+0x18b/0x1a0
 [81285fff] __ext4_es_shrink+0x4f/0x2e0
 [812869b8] ext4_es_insert_extent+0xc8/0x180
 [812470f4] ext4_map_blocks+0x1c4/0x550
 [8124c4c4] ext4_writepages+0x6d4/0xd00
...

Reported-by: Minchan Kim minc...@kernel.org
Signed-off-by: Theodore Ts'o ty...@mit.edu
Reported-by: Minchan Kim minc...@kernel.org
Cc: sta...@vger.kernel.org
Cc: Zheng Liu gnehzuil@gmail.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 fs/ext4/extents_status.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 3f5c188..0b7e28e 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -966,10 +966,10 @@ retry:
continue;
}
 
-   if (ei-i_es_lru_nr == 0 || ei == locked_ei)
+   if (ei-i_es_lru_nr == 0 || ei == locked_ei ||
+   !write_trylock(ei-i_es_lock))
continue;
 
-   write_lock(ei-i_es_lock);
shrunk = __es_try_to_reclaim_extents(ei, nr_to_scan);
if (ei-i_es_lru_nr == 0)
list_del_init(ei-i_es_lru);
-- 
1.7.10.4

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


[PATCH 36/94] ARM: DRA7: hwmod: Fixup SATA hwmod

2014-07-15 Thread Sam Asadi
From: Roger Quadros rog...@ti.com

Get rid of optional clock as that is now managed by the
AHCI platform driver.

Correct .mpu_rt_idx to 1 as the module register space (SYSCONFIG..)
is passed as the second memory resource in the device tree.

Signed-off-by: Roger Quadros rog...@ti.com
Reviewed-by: Rajendra Nayak rna...@ti.com
Tested-by: Sekhar Nori nsek...@ti.com
Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 20b4398..1209266 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1268,9 +1268,6 @@ static struct omap_hwmod_class dra7xx_sata_hwmod_class = {
 };
 
 /* sata */
-static struct omap_hwmod_opt_clk sata_opt_clks[] = {
-   { .role = ref_clk, .clk = sata_ref_clk },
-};
 
 static struct omap_hwmod dra7xx_sata_hwmod = {
.name   = sata,
@@ -1278,6 +1275,7 @@ static struct omap_hwmod dra7xx_sata_hwmod = {
.clkdm_name = l3init_clkdm,
.flags  = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
.main_clk   = func_48m_fclk,
+   .mpu_rt_idx = 1,
.prcm = {
.omap4 = {
.clkctrl_offs = DRA7XX_CM_L3INIT_SATA_CLKCTRL_OFFSET,
@@ -1285,8 +1283,6 @@ static struct omap_hwmod dra7xx_sata_hwmod = {
.modulemode   = MODULEMODE_SWCTRL,
},
},
-   .opt_clks   = sata_opt_clks,
-   .opt_clks_cnt   = ARRAY_SIZE(sata_opt_clks),
 };
 
 /*
-- 
1.7.10.4

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


[PATCH 28/94] iio: hid-sensor-als: Fix return values

2014-07-15 Thread Sam Asadi
From: Sachin Kamat sachin.ka...@samsung.com

IIO_CHAN_INFO_SAMP_FREQ and IIO_CHAN_INFO_HYSTERESIS cases ignored
the actual return values (which could be -EINVAL) and instead
returned IIO_VAL_INT_PLUS_MICRO always. Return the actual value
obtained from the functions. Both functions return IIO_VAL_INT_PLUS_MICRO
upon success.

Signed-off-by: Sachin Kamat sachin.ka...@samsung.com
Cc: Srinivas Pandruvada srinivas.pandruv...@linux.intel.com
Signed-off-by: Jonathan Cameron ji...@kernel.org
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/iio/light/hid-sensor-als.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/light/hid-sensor-als.c 
b/drivers/iio/light/hid-sensor-als.c
index f34c943..96e71e1 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -79,7 +79,6 @@ static int als_read_raw(struct iio_dev *indio_dev,
struct als_state *als_state = iio_priv(indio_dev);
int report_id = -1;
u32 address;
-   int ret;
int ret_type;
s32 poll_value;
 
@@ -129,14 +128,12 @@ static int als_read_raw(struct iio_dev *indio_dev,
ret_type = IIO_VAL_INT;
break;
case IIO_CHAN_INFO_SAMP_FREQ:
-   ret = hid_sensor_read_samp_freq_value(
+   ret_type = hid_sensor_read_samp_freq_value(
als_state-common_attributes, val, val2);
-   ret_type = IIO_VAL_INT_PLUS_MICRO;
break;
case IIO_CHAN_INFO_HYSTERESIS:
-   ret = hid_sensor_read_raw_hyst_value(
+   ret_type = hid_sensor_read_raw_hyst_value(
als_state-common_attributes, val, val2);
-   ret_type = IIO_VAL_INT_PLUS_MICRO;
break;
default:
ret_type = -EINVAL;
-- 
1.7.10.4

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


[PATCH 77/94] Documentation/Changes: clean up mcelog paragraph

2014-07-15 Thread Sam Asadi
From: Paul Bolle pebo...@tiscali.nl

The paragraph on mcelog currently describes kernel v2.6.31. In that
kernel the mce code (for i386, that is) was in transition. Ever since
v2.6.32 the situation is much simpler (eg, mcelog is now needed to
process events on almost all x86 machines, i386 and x86-64). Since this
document is designed to provide a list of the minimum levels of
software necessary to run the 3.0 kernels let's just describe that
situation.

Signed-off-by: Paul Bolle pebo...@tiscali.nl
Acked-by: Andi Kleen a...@linux.intel.com
Signed-off-by: Randy Dunlap rdun...@infradead.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 Documentation/Changes |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/Documentation/Changes b/Documentation/Changes
index 2254db0..227bec8 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -280,12 +280,9 @@ that is possible.
 mcelog
 --
 
-In Linux 2.6.31+ the i386 kernel needs to run the mcelog utility
-as a regular cronjob similar to the x86-64 kernel to process and log
-machine check events when CONFIG_X86_NEW_MCE is enabled. Machine check
-events are errors reported by the CPU. Processing them is strongly encouraged.
-All x86-64 kernels since 2.6.4 require the mcelog utility to
-process machine checks.
+On x86 kernels the mcelog utility is needed to process and log machine check
+events when CONFIG_X86_MCE is enabled. Machine check events are errors reported
+by the CPU. Processing them is strongly encouraged.
 
 Getting updated software
 
-- 
1.7.10.4

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


[PATCH 19/94] clk: qcom: HDMI source sel is 3 not 2

2014-07-15 Thread Sam Asadi
From: Stephen Boyd sb...@codeaurora.org

The HDMI PLL input to the tv mux is supposed to be 3, not 2. Fix
the code so that we can properly select the HDMI PLL.

Fixes: 6d00b56fe clk: qcom: Add support for MSM8960's multimedia clock 
controller (MMCC)
Reported-by: Rob Clark robdcl...@gmail.com
Signed-off-by: Stephen Boyd sb...@codeaurora.org
Signed-off-by: Mike Turquette mturque...@linaro.org
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/qcom/mmcc-msm8960.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/mmcc-msm8960.c b/drivers/clk/qcom/mmcc-msm8960.c
index 12f3c0b..4c449b3 100644
--- a/drivers/clk/qcom/mmcc-msm8960.c
+++ b/drivers/clk/qcom/mmcc-msm8960.c
@@ -1209,7 +1209,7 @@ static struct clk_branch rot_clk = {
 
 static u8 mmcc_pxo_hdmi_map[] = {
[P_PXO] = 0,
-   [P_HDMI_PLL]= 2,
+   [P_HDMI_PLL]= 3,
 };
 
 static const char *mmcc_pxo_hdmi[] = {
-- 
1.7.10.4

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


[PATCH 90/94] Staging: comedi: 8253.h fixed by removing 'return' from generic func

2014-07-15 Thread Sam Asadi
Signed-off-by: Sam Asadi asadi.sam...@gmail.com

modified:   drivers/staging/comedi/drivers/8253.h
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/staging/comedi/drivers/8253.h |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8253.h 
b/drivers/staging/comedi/drivers/8253.h
index 5829b46..f6b8607 100644
--- a/drivers/staging/comedi/drivers/8253.h
+++ b/drivers/staging/comedi/drivers/8253.h
@@ -55,7 +55,7 @@ static inline void i8253_cascade_ns_to_timer(int 
i8253_osc_base,
/* check for overflow */
divider  div1  divider  div2 
divider * i8253_osc_base  divider 
-   divider * i8253_osc_base  i8253_osc_base) {
+   divider * i8253_osc_base  i8253_osc_base)  {
return;
}
 
@@ -118,7 +118,6 @@ static inline void i8253_cascade_ns_to_timer(int 
i8253_osc_base,
/*  masking is done since counter maps zero to 0x1 */
*d1 = div1  0x;
*d2 = div2  0x;
-   return;
 }
 
 #ifndef CMDTEST
-- 
1.7.10.4

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


[PATCH 86/94] parisc: drop unused defines and header includes

2014-07-15 Thread Sam Asadi
From: Helge Deller del...@gmx.de

Signed-off-by: Helge Deller del...@gmx.de
Cc: sta...@vger.kernel.org # 3.13+
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 arch/parisc/kernel/sys_parisc32.c |   36 
 1 file changed, 36 deletions(-)

diff --git a/arch/parisc/kernel/sys_parisc32.c 
b/arch/parisc/kernel/sys_parisc32.c
index ec741fe..93c1963 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -12,44 +12,8 @@
 
 #include linux/compat.h
 #include linux/kernel.h
-#include linux/sched.h
-#include linux/fs.h 
-#include linux/mm.h 
-#include linux/file.h 
-#include linux/signal.h
-#include linux/resource.h
-#include linux/times.h
-#include linux/time.h
-#include linux/smp.h
-#include linux/sem.h
-#include linux/shm.h
-#include linux/slab.h
-#include linux/uio.h
-#include linux/ncp_fs.h
-#include linux/poll.h
-#include linux/personality.h
-#include linux/stat.h
-#include linux/highmem.h
-#include linux/highuid.h
-#include linux/mman.h
-#include linux/binfmts.h
-#include linux/namei.h
-#include linux/vfs.h
-#include linux/ptrace.h
-#include linux/swap.h
 #include linux/syscalls.h
 
-#include asm/types.h
-#include asm/uaccess.h
-#include asm/mmu_context.h
-
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(x) printk x
-#else
-#define DBG(x)
-#endif
 
 asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
int r22, int r21, int r20)
-- 
1.7.10.4

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


[PATCH 88/94] clk: spear3xx: Set proper clock parent of uart1/2

2014-07-15 Thread Sam Asadi
From: Thomas Gleixner t...@linutronix.de

The uarts only work when the parent is ras_ahb_clk. The stale 3.5
based ST tree does this in the board file.

Add it to the clk init function. Not pretty, but the mess there is
amazing anyway.

Signed-off-by: Thomas Gleixner t...@linutronix.de
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Mike Turquette mturque...@linaro.org
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 drivers/clk/spear/spear3xx_clock.c |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/spear/spear3xx_clock.c 
b/drivers/clk/spear/spear3xx_clock.c
index 125eba8..bb5f387 100644
--- a/drivers/clk/spear/spear3xx_clock.c
+++ b/drivers/clk/spear/spear3xx_clock.c
@@ -245,7 +245,8 @@ static const char *smii0_parents[] = { smii_125m_pad, 
ras_pll2_clk,
ras_syn0_gclk, };
 static const char *uartx_parents[] = { ras_syn1_gclk, ras_apb_clk, };
 
-static void __init spear320_clk_init(void __iomem *soc_config_base)
+static void __init spear320_clk_init(void __iomem *soc_config_base,
+struct clk *ras_apb_clk)
 {
struct clk *clk;
 
@@ -342,6 +343,8 @@ static void __init spear320_clk_init(void __iomem 
*soc_config_base)
SPEAR320_CONTROL_REG, UART1_PCLK_SHIFT, UART1_PCLK_MASK,
0, _lock);
clk_register_clkdev(clk, NULL, a300.serial);
+   /* Enforce ras_apb_clk */
+   clk_set_parent(clk, ras_apb_clk);
 
clk = clk_register_mux(NULL, uart2_clk, uartx_parents,
ARRAY_SIZE(uartx_parents),
@@ -349,6 +352,8 @@ static void __init spear320_clk_init(void __iomem 
*soc_config_base)
SPEAR320_EXT_CTRL_REG, SPEAR320_UART2_PCLK_SHIFT,
SPEAR320_UARTX_PCLK_MASK, 0, _lock);
clk_register_clkdev(clk, NULL, a400.serial);
+   /* Enforce ras_apb_clk */
+   clk_set_parent(clk, ras_apb_clk);
 
clk = clk_register_mux(NULL, uart3_clk, uartx_parents,
ARRAY_SIZE(uartx_parents),
@@ -379,12 +384,12 @@ static void __init spear320_clk_init(void __iomem 
*soc_config_base)
clk_register_clkdev(clk, NULL, 6010.serial);
 }
 #else
-static inline void spear320_clk_init(void __iomem *soc_config_base) { }
+static inline void spear320_clk_init(void __iomem *sb, struct clk *rc) { }
 #endif
 
 void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem 
*soc_config_base)
 {
-   struct clk *clk, *clk1;
+   struct clk *clk, *clk1, *ras_apb_clk;
 
clk = clk_register_fixed_rate(NULL, osc_32k_clk, NULL, CLK_IS_ROOT,
32000);
@@ -613,6 +618,7 @@ void __init spear3xx_clk_init(void __iomem *misc_base, void 
__iomem *soc_config_
clk = clk_register_gate(NULL, ras_apb_clk, apb_clk, 0, RAS_CLK_ENB,
RAS_APB_CLK_ENB, 0, _lock);
clk_register_clkdev(clk, ras_apb_clk, NULL);
+   ras_apb_clk = clk;
 
clk = clk_register_gate(NULL, ras_32k_clk, osc_32k_clk, 0,
RAS_CLK_ENB, RAS_32K_CLK_ENB, 0, _lock);
@@ -659,5 +665,5 @@ void __init spear3xx_clk_init(void __iomem *misc_base, void 
__iomem *soc_config_
else if (of_machine_is_compatible(st,spear310))
spear310_clk_init();
else if (of_machine_is_compatible(st,spear320))
-   spear320_clk_init(soc_config_base);
+   spear320_clk_init(soc_config_base, ras_apb_clk);
 }
-- 
1.7.10.4

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


[PATCH 69/94] serial: sh-sci: Add device tree support for r8a7{778, 740, 3a4} and sh73a0

2014-07-15 Thread Sam Asadi
From: Simon Horman horms+rene...@verge.net.au

Simply document new compat strings.
There appears to be no need for a driver updates.

Signed-off-by: Simon Horman horms+rene...@verge.net.au
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: sam-the-6 asadi.sam...@gmail.com
---
 Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt 
b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
index 64fd7de..b355660 100644
--- a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
+++ b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
@@ -4,6 +4,13 @@ Required properties:
 
   - compatible: Must contain one of the following:
 
+- renesas,scifa-sh73a0 for SH73A0 (SH-Mobile AG5) SCIFA compatible UART.
+- renesas,scifb-sh73a0 for SH73A0 (SH-Mobile AG5) SCIFB compatible UART.
+- renesas,scifa-r8a73a4 for R8A73A4 (R-Mobile APE6) SCIFA compatible 
UART.
+- renesas,scifb-r8a73a4 for R8A73A4 (R-Mobile APE6) SCIFB compatible 
UART.
+- renesas,scifa-r8a7740 for R8A7740 (R-Mobile A1) SCIFA compatible UART.
+- renesas,scifb-r8a7740 for R8A7740 (R-Mobile A1) SCIFB compatible UART.
+- renesas,scif-r8a7778 for R8A7778 (R-Car M1) SCIF compatible UART.
 - renesas,scif-r8a7779 for R8A7779 (R-Car H1) SCIF compatible UART.
 - renesas,scif-r8a7790 for R8A7790 (R-Car H2) SCIF compatible UART.
 - renesas,scifa-r8a7790 for R8A7790 (R-Car H2) SCIFA compatible UART.
-- 
1.7.10.4

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


  1   2   3   >