Re: [PATCH] Staging: bcm: Fix tab between spaces in InterfaceMacros.h This is a patch to the InterfaceMacros.h file that fixes an added tab instead of a space. Found by the checkpatch.pl tool.
Hi Pieter, as far as I know, this driver was removed from the source tree. Please update your local copy of the kernel. -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. On 02-12-2014 18:25:49, Pieter Waegeman wrote: > --- > drivers/staging/bcm/InterfaceMacros.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/bcm/InterfaceMacros.h > b/drivers/staging/bcm/InterfaceMacros.h > index fedb794..67e7b62 100644 > --- a/drivers/staging/bcm/InterfaceMacros.h > +++ b/drivers/staging/bcm/InterfaceMacros.h > @@ -4,7 +4,7 @@ > #define BCM_USB_MAX_READ_LENGTH 2048 > > #define MAXIMUM_USB_TCB 128 > -#define MAXIMUM_USB_RCB 128 > +#define MAXIMUM_USB_RCB 128 > > #define MAX_BUFFERS_PER_QUEUE 256 > > -- > 2.1.0 > pgp3KIyYKql4d.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: bcm: Fix tab between spaces in InterfaceMacros.h This is a patch to the InterfaceMacros.h file that fixes an added tab instead of a space. Found by the checkpatch.pl tool.
Hi Pieter, On 02-12-2014 19:04:31, 1Ago - Pieter Waegeman wrote: > That's weird. I can still see the driver in the 'master' branch on > https://github.com/torvalds/linux/tree/master/drivers/staging/bcm > I've cloned from > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > > Or am I doing something wrong? nope, you've done everything right. BUT the staging stuff gets developed in the repo/branch from gregkh, so you should base your patches to drivers/staging on that branch. And there, this driver is removed already! Feel free to contact me directly if you get stuck with it! -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. pgpGL2Rj4YPQ2.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: bcm: fix spaces before commas in Bcmchar.c
Hi Jack, bcm is removed from the linux kernel. You are working against the wrong tree! Please work against staging-next of gregkh for staging drivers! Ask me if you do not understand what the problem is! Feel free to ask me other questions as well! On 15-12-2014 11:22:29, Jack Wilson wrote: > This is a patch to the Bcmchar.c file that fixes a space before comma warning > found by checkpatch.pl. > Signed-off-by: Jack Wilson -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. pgpDApKCsYCOL.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/1] drivers: staging: android: Remove checkpatch.pl-TODO
Hi Arve, Hi Riley, I just noticed that the drivers/staging/android driver has only 4 remaining checkpatch.pl warnings, two of them beeing 80-character-per-line warnings (the two lines are 81 characters exactly). The other warnings are: ./sw_sync.c:258: WARNING: memory barrier without comment ./uapi/ion.h:23: WARNING: do not add new typedefs I'm not sure about the first one, though I could provide a patch for the second one. The change would simply remove typedef int ion_user_handle_t; and replace all occurences of `ion_user_handle_t` with `int`. I'm not sure, though, whether such a patch would be welcome. Either way, I propose to remove the TODO note on checkpatch cleanup with the attached patch. Matthias Beyer (1): Remove checkpatch.pl cleanups todo drivers/staging/android/TODO | 1 - 1 file changed, 1 deletion(-) -- 2.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] Remove checkpatch.pl cleanups todo
Signed-off-by: Matthias Beyer --- drivers/staging/android/TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO index 64d8c87..4ce0ac6 100644 --- a/drivers/staging/android/TODO +++ b/drivers/staging/android/TODO @@ -1,5 +1,4 @@ TODO: - - checkpatch.pl cleanups - sparse fixes - rename files to be not so "generic" - add proper arch dependencies as needed -- 2.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] drivers: staging: rtl8723au: hal: Remove pointless test
This patch removes the pointless `else if` test. Signed-off-by: Matthias Beyer Reported-by: David Binderman --- drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index bfcbd7a..7f11521 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -3530,7 +3530,7 @@ bthci_CmdLinkStatusNotify( pBtMgnt->ExtConfig.linkInfo[i].BTProfile, pBtMgnt->ExtConfig.linkInfo[i].BTCoreSpec)); pTriple += 4; - } else if (pBtMgnt->ExtConfig.HCIExtensionVer >= 1) { + } else { pBtMgnt->ExtConfig.linkInfo[i].ConnectHandle = *((u16 *)&pTriple[0]); pBtMgnt->ExtConfig.linkInfo[i].BTProfile = pTriple[2]; pBtMgnt->ExtConfig.linkInfo[i].BTCoreSpec = pTriple[3]; -- 2.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] drivers: staging: rtl823au: hal: Remove pointless test
As reported by David Binderman, this test is useless as of if (a < 3) { /* ... */ } else if (a >= 3) { /* ... */ } so this patch removes the second check. Matthias Beyer (1): drivers: staging: rtl8723au: hal: Remove pointless test drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] drivers: staging: rtl823au: hal: Remove pointless test
Pinging here as nobody responded yet. Maybe this was overlooked. On 23-08-2016 21:44:16, Matthias Beyer wrote: > As reported by David Binderman, this test is useless as of > > if (a < 3) { > /* ... */ > } else if (a >= 3) { > /* ... */ > } > > so this patch removes the second check. > > Matthias Beyer (1): > drivers: staging: rtl8723au: hal: Remove pointless test > > drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > -- > 2.9.2 > -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/1] Remove pointless test
Re-sending as On 01-09-2016 17:54:47, Greg KH wrote: > There is no patch here :( 8< As reported by David Binderman, this test is useless as of if (a < 3) { /* ... */ } else if (a >= 3) { /* ... */ } so this patch removes the second check. Matthias Beyer (1): drivers: staging: rtl8723au: hal: Remove pointless test drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/1] drivers: staging: rtl8723au: hal: Remove pointless test
This patch removes the pointless `else if` test. Signed-off-by: Matthias Beyer Reported-by: David Binderman --- drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index 6989580..47e8d69 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -3530,7 +3530,7 @@ bthci_CmdLinkStatusNotify( pBtMgnt->ExtConfig.linkInfo[i].BTProfile, pBtMgnt->ExtConfig.linkInfo[i].BTCoreSpec)); pTriple += 4; - } else if (pBtMgnt->ExtConfig.HCIExtensionVer >= 1) { + } else { pBtMgnt->ExtConfig.linkInfo[i].ConnectHandle = *((u16 *)&pTriple[0]); pBtMgnt->ExtConfig.linkInfo[i].BTProfile = pTriple[2]; pBtMgnt->ExtConfig.linkInfo[i].BTCoreSpec = pTriple[3]; -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/5] Some cleanup patches for drivers/staging/rtl8723au/core/rtw_mlme.c
This patchset fixes some errors and warnings reported by checkpatch.pl. Matthias Beyer (5): drivers: staging: rtl8723au: core: Fix checkpatch.pl errors drivers: staging: rtl8723au: core: simplify if-break-else drivers: staging: rtl8723au: core: Refactor pointless branching drivers: staging: rtl8723au: core: Fix "space prohibited" warning drivers: staging: rtl8723au: core: Fix indentation drivers/staging/rtl8723au/core/rtw_mlme.c | 72 ++- 1 file changed, 33 insertions(+), 39 deletions(-) -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/5] drivers: staging: rtl8723au: core: Fix checkpatch.pl errors
This patch fixes the ERRORs which are reported from the checkpatch.pl script for this file. Signed-off-by: Matthias Beyer --- drivers/staging/rtl8723au/core/rtw_mlme.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index a786fc4..8b8b6a9 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -1397,7 +1397,7 @@ void rtw23a_join_to_handler (unsigned long data) do_join_r = rtw_do_join(adapter); if (do_join_r != _SUCCESS) { DBG_8723A("%s roaming do_join return " - "%d\n", __func__ , do_join_r); + "%d\n", __func__, do_join_r); continue; } break; @@ -1546,7 +1546,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv, } if (!*candidate || - (*candidate)->network.Rssinetwork.Rssi) { + (*candidate)->network.Rssi < competitor->network.Rssi) { *candidate = competitor; updated = true; } @@ -1894,7 +1894,7 @@ static int SecIsInPMKIDList(struct rtw_adapter *Adapter, u8 *bssid) do { if (psecuritypriv->PMKIDList[i].bUsed && -ether_addr_equal(psecuritypriv->PMKIDList[i].Bssid, bssid)) { + ether_addr_equal(psecuritypriv->PMKIDList[i].Bssid, bssid)) { break; } else { i++; @@ -2139,7 +2139,7 @@ bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie, out_len = *pout_len; pframe = rtw_set_ie23a(out_ie + out_len, WLAN_EID_HT_OPERATION, - p[1], p + 2 , pout_len); + p[1], p + 2, pout_len); } } -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/5] drivers: staging: rtl8723au: core: simplify if-break-else
As the if statement breaks/continues the loop, the else block is not useful and can be omitted. Signed-off-by: Matthias Beyer Signed-off-by: Manuel Messner --- drivers/staging/rtl8723au/core/rtw_mlme.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 8b8b6a9..da9f298 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -244,21 +244,18 @@ static void _rtw_roaming(struct rtw_adapter *padapter, do_join_r = rtw_do_join(padapter); if (do_join_r == _SUCCESS) break; - else { - DBG_8723A("roaming do_join return %d\n", - do_join_r); - pmlmepriv->to_roaming--; - if (padapter->mlmepriv.to_roaming > 0) - continue; - else { - DBG_8723A("%s(%d) -to roaming fail, " - "indicate_disconnect\n", - __func__, __LINE__); - rtw_indicate_disconnect23a(padapter); - break; - } - } + DBG_8723A("roaming do_join return %d\n", do_join_r); + pmlmepriv->to_roaming--; + + if (padapter->mlmepriv.to_roaming > 0) + continue; + + DBG_8723A("%s(%d) -to roaming fail, " + "indicate_disconnect\n", + __func__, __LINE__); + rtw_indicate_disconnect23a(padapter); + break; } } } -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/5] drivers: staging: rtl8723au: core: Refactor pointless branching
As ether_addr_equal returns a bool, we can simply use the return value to set the variable. Signed-off-by: Matthias Beyer Signed-off-by: Manuel Messner --- drivers/staging/rtl8723au/core/rtw_mlme.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index da9f298..196447b 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -1062,11 +1062,8 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) pmlmepriv->assoc_ssid.ssid); } - if (ether_addr_equal(pnetwork->network.MacAddress, -cur_network->network.MacAddress)) - the_same_macaddr = true; - else - the_same_macaddr = false; + the_same_macaddr = ether_addr_equal(pnetwork->network.MacAddress, + cur_network->network.MacAddress); pnetwork->network.Length = get_wlan_bssid_ex_sz(&pnetwork->network); if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) { -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] drivers: staging: rtl8723au: core: Fix "space prohibited" warning
This patch fixes the "space prohibited between function name and open parenthesis '('" warning from checkpatch.pl Signed-off-by: Matthias Beyer Signed-off-by: Manuel Messner --- drivers/staging/rtl8723au/core/rtw_mlme.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 196447b..1e01d62 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -900,15 +900,15 @@ rtw_joinbss_update_stainfo(struct rtw_adapter *padapter, padapter->securitypriv.dot11PrivacyAlgrthm; memset(&psta->dot118021x_UncstKey, 0, - sizeof (union Keytype)); + sizeof(union Keytype)); memset(&psta->dot11tkiprxmickey, 0, - sizeof (union Keytype)); + sizeof(union Keytype)); memset(&psta->dot11tkiptxmickey, 0, - sizeof (union Keytype)); + sizeof(union Keytype)); - memset(&psta->dot11txpn, 0, sizeof (union pn48)); - memset(&psta->dot11rxpn, 0, sizeof (union pn48)); + memset(&psta->dot11txpn, 0, sizeof(union pn48)); + memset(&psta->dot11rxpn, 0, sizeof(union pn48)); } /* Commented by Albert 2012/07/21 */ -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/5] drivers: staging: rtl8723au: core: Fix indentation
Signed-off-by: Matthias Beyer Signed-off-by: Manuel Messner --- drivers/staging/rtl8723au/core/rtw_mlme.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 1e01d62..1c31774 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -1921,17 +1921,17 @@ static int rtw_append_pmkid(struct rtw_adapter *Adapter, int iEntry, struct security_priv *psecuritypriv = &Adapter->securitypriv; if (ie[1] <= 20) { - /* The RSN IE didn't include the PMK ID, - append the PMK information */ - ie[ie_len] = 1; - ie_len++; - ie[ie_len] = 0; /* PMKID count = 0x0100 */ - ie_len++; - memcpy(&ie[ie_len], - &psecuritypriv->PMKIDList[iEntry].PMKID, 16); - - ie_len += 16; - ie[1] += 18;/* PMKID length = 2+16 */ + /* The RSN IE didn't include the PMK ID, + append the PMK information */ + ie[ie_len] = 1; + ie_len++; + ie[ie_len] = 0; /* PMKID count = 0x0100 */ + ie_len++; + memcpy(&ie[ie_len], + &psecuritypriv->PMKIDList[iEntry].PMKID, 16); + + ie_len += 16; + ie[1] += 18;/* PMKID length = 2+16 */ } return ie_len; } -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/5] Some cleanup patches for drivers/staging/rtl8723au/core/rtw_mlme.c
On 06-09-2016 12:00:37, Jes Sorensen wrote: > Matthias Beyer writes: > > This patchset fixes some errors and warnings reported by checkpatch.pl. > > > > Matthias Beyer (5): > > drivers: staging: rtl8723au: core: Fix checkpatch.pl errors > > drivers: staging: rtl8723au: core: simplify if-break-else > > drivers: staging: rtl8723au: core: Refactor pointless branching > > drivers: staging: rtl8723au: core: Fix "space prohibited" warning > > drivers: staging: rtl8723au: core: Fix indentation > > > > drivers/staging/rtl8723au/core/rtw_mlme.c | 72 > > ++- > > 1 file changed, 33 insertions(+), 39 deletions(-) > > Nothing wrong with these patches, however I intend to post a patch to > remove this driver soon, so it's kind of a waste of your time to spend > too many cycles on it. > Alright, thanks for telling me, I won't waste any more time on it. Besides that - thanks for telling me that the patchset is okay as-is. That keeps me motivated! -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] Staging: bcm: Outsourced IsFlash2x() handling
This patch outsources the code from the IsFlash2x() check in bcm_char_ioctl_nvm_rw() function to shorten it. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 98 --- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 71818b1..118149c 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -4,6 +4,7 @@ static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, PUCHAR pReadData); +static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter); /*** * Function - bcm_char_open() @@ -1474,48 +1475,11 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, Adapter->bHeaderChangeAllowed = TRUE; if (IsFlash2x(Adapter)) { - /* -* New Requirement:- -* DSD section updation will be allowed in two case:- -* 1. if DSD sig is present in DSD header means dongle -* is ok and updation is fruitfull -* 2. if point 1 failes then user buff should have -* DSD sig. this point ensures that if dongle is -* corrupted then user space program first modify -* the DSD header with valid DSD sig so that this -* as well as further write may be worthwhile. -* -* This restriction has been put assuming that -* if DSD sig is corrupted, DSD data won't be -* considered valid. -*/ - - Status = BcmFlash2xCorruptSig(Adapter, - Adapter->eActiveDSD); - if (Status != STATUS_SUCCESS) { - if (((stNVMReadWrite.uiOffset + stNVMReadWrite.uiNumBytes) != - Adapter->uiNVMDSDSize) || - (stNVMReadWrite.uiNumBytes < SIGNATURE_SIZE)) { - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, - OSAL_DBG, DBG_LVL_ALL, - "DSD Sig is present neither in Flash nor User provided Input.."); - up(&Adapter->NVMRdmWrmLock); - kfree(pReadData); - return Status; - } - - ulDSDMagicNumInUsrBuff = ntohl(*(PUINT)(pReadData + stNVMReadWrite.uiNumBytes - SIGNATURE_SIZE)); - if (ulDSDMagicNumInUsrBuff != - DSD_IMAGE_MAGIC_NUMBER) { - BCM_DEBUG_PRINT(Adapter, - DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, - "DSD Sig is present neither in Flash nor User provided Input.."); - up(&Adapter->NVMRdmWrmLock); - kfree(pReadData); - return Status; - } - } + int ret = handle_flash2x_adapter(Adapter, + pReadData, + &stNVMReadWrite); + if (ret != STATUS_SUCCESS) + return ret; } Status = BeceemNVMWrite(Adapter, (PUINT)pReadData, @@ -2629,3 +2593,53 @@ static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } + +static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite) +{ + /* +* New Requirement:- +* DSD section updation will be allowed in two case:- +* 1. if DSD sig is present in DSD header means dongle +* is ok and updation is fruitfull +* 2. if point 1 failes then user buff should have +* DSD sig. this point ensures that if dongle is +* corrupted then user space program first modify +* the DSD header with valid DSD sig so that this +* as well as further write may be worthwhile. +* +* This restriction has been put assuming that +* if DSD sig is corrupted, DSD data won't be +* considered valid. +*/ + INT Status = STATUS_FAILURE; + + Status = BcmFlash2xCorruptSig(Adapter, Adapter->eActiveD
[PATCH 0/3] Staging: bcm: Bcmchar.c cleanup patches
Hi, I did some cleanup for the file drivers/staging/bcm/Bcmchar.c The patches shorten some lines and do some code outsourcing from large functions into smaller ones. Can someone tell me how to compile (and maybe even test) my patches? I'm not on the ML, please keep me in CC. Regards, Matthias Beyer Matthias Beyer (3): Staging: bcm: Fixed line lengths Staging: bcm: Outsourced cmd handling to function Staging: bcm: Outsourced IsFlash2x() handling drivers/staging/bcm/Bcmchar.c | 246 +- 1 file changed, 150 insertions(+), 96 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] Staging: bcm: Outsourced cmd handling to function
This patch outsourced the true-branch for the IOCTL_BCM_NVM_READ command handling to shorten the bcm_char_ioctl_nvm_rw() function. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 72 ++- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index e5283dd..71818b1 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1,6 +1,10 @@ #include #include "headers.h" + +static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData); + /*** * Function - bcm_char_open() * @@ -1449,34 +1453,10 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, do_gettimeofday(&tv0); if (IOCTL_BCM_NVM_READ == cmd) { - down(&Adapter->NVMRdmWrmLock); - - if ((Adapter->IdleMode == TRUE) || - (Adapter->bShutStatus == TRUE) || - (Adapter->bPreparingForLowPowerMode == TRUE)) { - - BCM_DEBUG_PRINT(Adapter, - DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, - "Device is in Idle/Shutdown Mode\n"); - up(&Adapter->NVMRdmWrmLock); - kfree(pReadData); - return -EACCES; - } - - Status = BeceemNVMRead(Adapter, (PUINT)pReadData, - stNVMReadWrite.uiOffset, stNVMReadWrite.uiNumBytes); - up(&Adapter->NVMRdmWrmLock); - - if (Status != STATUS_SUCCESS) { - kfree(pReadData); - return Status; - } - - if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, - stNVMReadWrite.uiNumBytes)) { - kfree(pReadData); - return -EFAULT; - } + int ret = bcm_handle_nvm_read_cmd(Adapter, pReadData, + &stNVMReadWrite); + if (ret != STATUS_SUCCESS) + return ret; } else { down(&Adapter->NVMRdmWrmLock); @@ -2613,3 +2593,39 @@ void unregister_control_device_interface(struct bcm_mini_adapter *Adapter) } } +static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite) +{ + INT Status = STATUS_FAILURE; + + down(&Adapter->NVMRdmWrmLock); + + if ((Adapter->IdleMode == TRUE) || + (Adapter->bShutStatus == TRUE) || + (Adapter->bPreparingForLowPowerMode == TRUE)) { + + BCM_DEBUG_PRINT(Adapter, + DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, + "Device is in Idle/Shutdown Mode\n"); + up(&Adapter->NVMRdmWrmLock); + kfree(pReadData); + return -EACCES; + } + + Status = BeceemNVMRead(Adapter, (PUINT)pReadData, + stNVMReadWrite->uiOffset, stNVMReadWrite->uiNumBytes); + up(&Adapter->NVMRdmWrmLock); + + if (Status != STATUS_SUCCESS) { + kfree(pReadData); + return Status; + } + + if (copy_to_user(stNVMReadWrite->pBuffer, pReadData, + stNVMReadWrite->uiNumBytes)) { + kfree(pReadData); + return -EFAULT; + } + + return STATUS_SUCCESS; +} -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] Staging: bcm: Fixed line lengths
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 76 --- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index ae7490b..e5283dd 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -101,9 +101,11 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, int wait_ret_val = 0; unsigned long ret = 0; - wait_ret_val = wait_event_interruptible(Adapter->process_read_wait_queue, - (pTarang->RxAppControlHead || -Adapter->device_removed)); + wait_ret_val = wait_event_interruptible( + Adapter->process_read_wait_queue, + (pTarang->RxAppControlHead || + Adapter->device_removed)); + if ((wait_ret_val == -ERESTARTSYS)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Exiting as i've been asked to exit!!!\n"); @@ -410,7 +412,8 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp, if (IoBuffer.InputLength > sizeof(gpio_info)) return -EINVAL; - if (copy_from_user(&gpio_info, IoBuffer.InputBuffer, IoBuffer.InputLength)) + if (copy_from_user(&gpio_info, IoBuffer.InputBuffer, + IoBuffer.InputLength)) return -EFAULT; uiBit = gpio_info.uiGpioNumber; @@ -516,7 +519,8 @@ static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp, if (IoBuffer.InputLength > sizeof(threadReq)) return -EINVAL; - if (copy_from_user(&threadReq, IoBuffer.InputBuffer, IoBuffer.InputLength)) + if (copy_from_user(&threadReq, IoBuffer.InputBuffer, + IoBuffer.InputLength)) return -EFAULT; /* if LED thread is running(Actively or Inactively) @@ -594,7 +598,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, INT Status = STATUS_FAILURE; int bytes; - memset(pgpio_multi_info, 0, MAX_IDX * sizeof(struct bcm_gpio_multi_info)); + memset(pgpio_multi_info, 0, + MAX_IDX * sizeof(struct bcm_gpio_multi_info)); if ((Adapter->IdleMode == TRUE) || (Adapter->bShutStatus == TRUE) || @@ -627,7 +632,7 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, if ((pgpio_multi_info[WIMAX_IDX].uiGPIOMask) & (pgpio_multi_info[WIMAX_IDX].uiGPIOCommand)) { /* Set 1's in GPIO OUTPUT REGISTER */ - *(UINT *)ucResetValue = pgpio_multi_info[WIMAX_IDX].uiGPIOMask & + *(UINT *)ucResetValue = pgpio_multi_info[WIMAX_IDX].uiGPIOMask & pgpio_multi_info[WIMAX_IDX].uiGPIOCommand & pgpio_multi_info[WIMAX_IDX].uiGPIOValue; @@ -643,7 +648,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, } /* Clear to 0's in GPIO OUTPUT REGISTER */ - *(UINT *)ucResetValue = (pgpio_multi_info[WIMAX_IDX].uiGPIOMask & + *(UINT *)ucResetValue = + (pgpio_multi_info[WIMAX_IDX].uiGPIOMask & pgpio_multi_info[WIMAX_IDX].uiGPIOCommand & (~(pgpio_multi_info[WIMAX_IDX].uiGPIOValue))); @@ -672,7 +678,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, Status = STATUS_SUCCESS; } - pgpio_multi_info[WIMAX_IDX].uiGPIOValue = (*(UINT *)ucResetValue & + pgpio_multi_info[WIMAX_IDX].uiGPIOValue = + (*(UINT *)ucResetValue & pgpio_multi_info[WIMAX_IDX].uiGPIOMask); } @@ -739,11 +746,13 @@ static int bcm_char_ioctl_gpio_mode_request(void __user *argp, if (pgpio_multi_mode[WIMAX_IDX].uiGPIOMask) { /* write all OUT's (1's) */ - *(UINT *) ucResetValue |= (pgpio_multi_mode[WIMAX_IDX].uiGPIOMode & + *(UINT *) ucResetValue |= + (pgpio_multi_mode[WIMAX_IDX].uiGPIOMode & pgpio_multi_mode[WIMAX_IDX].uiGPIOMask); /* write all IN's (0's) */ - *(UINT *) ucResetValue &= ~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) & + *(UINT *) ucResetValue &= + ~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) & pgpio_multi_mode[WIMAX_IDX].uiGPIOMask); /* Currently implemente
[PATCH v2 1/3] Staging: bcm: Fixed line lengths
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 76 --- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index ae7490b..e5283dd 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -101,9 +101,11 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, int wait_ret_val = 0; unsigned long ret = 0; - wait_ret_val = wait_event_interruptible(Adapter->process_read_wait_queue, - (pTarang->RxAppControlHead || -Adapter->device_removed)); + wait_ret_val = wait_event_interruptible( + Adapter->process_read_wait_queue, + (pTarang->RxAppControlHead || + Adapter->device_removed)); + if ((wait_ret_val == -ERESTARTSYS)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Exiting as i've been asked to exit!!!\n"); @@ -410,7 +412,8 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp, if (IoBuffer.InputLength > sizeof(gpio_info)) return -EINVAL; - if (copy_from_user(&gpio_info, IoBuffer.InputBuffer, IoBuffer.InputLength)) + if (copy_from_user(&gpio_info, IoBuffer.InputBuffer, + IoBuffer.InputLength)) return -EFAULT; uiBit = gpio_info.uiGpioNumber; @@ -516,7 +519,8 @@ static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp, if (IoBuffer.InputLength > sizeof(threadReq)) return -EINVAL; - if (copy_from_user(&threadReq, IoBuffer.InputBuffer, IoBuffer.InputLength)) + if (copy_from_user(&threadReq, IoBuffer.InputBuffer, + IoBuffer.InputLength)) return -EFAULT; /* if LED thread is running(Actively or Inactively) @@ -594,7 +598,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, INT Status = STATUS_FAILURE; int bytes; - memset(pgpio_multi_info, 0, MAX_IDX * sizeof(struct bcm_gpio_multi_info)); + memset(pgpio_multi_info, 0, + MAX_IDX * sizeof(struct bcm_gpio_multi_info)); if ((Adapter->IdleMode == TRUE) || (Adapter->bShutStatus == TRUE) || @@ -627,7 +632,7 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, if ((pgpio_multi_info[WIMAX_IDX].uiGPIOMask) & (pgpio_multi_info[WIMAX_IDX].uiGPIOCommand)) { /* Set 1's in GPIO OUTPUT REGISTER */ - *(UINT *)ucResetValue = pgpio_multi_info[WIMAX_IDX].uiGPIOMask & + *(UINT *)ucResetValue = pgpio_multi_info[WIMAX_IDX].uiGPIOMask & pgpio_multi_info[WIMAX_IDX].uiGPIOCommand & pgpio_multi_info[WIMAX_IDX].uiGPIOValue; @@ -643,7 +648,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, } /* Clear to 0's in GPIO OUTPUT REGISTER */ - *(UINT *)ucResetValue = (pgpio_multi_info[WIMAX_IDX].uiGPIOMask & + *(UINT *)ucResetValue = + (pgpio_multi_info[WIMAX_IDX].uiGPIOMask & pgpio_multi_info[WIMAX_IDX].uiGPIOCommand & (~(pgpio_multi_info[WIMAX_IDX].uiGPIOValue))); @@ -672,7 +678,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, Status = STATUS_SUCCESS; } - pgpio_multi_info[WIMAX_IDX].uiGPIOValue = (*(UINT *)ucResetValue & + pgpio_multi_info[WIMAX_IDX].uiGPIOValue = + (*(UINT *)ucResetValue & pgpio_multi_info[WIMAX_IDX].uiGPIOMask); } @@ -739,11 +746,13 @@ static int bcm_char_ioctl_gpio_mode_request(void __user *argp, if (pgpio_multi_mode[WIMAX_IDX].uiGPIOMask) { /* write all OUT's (1's) */ - *(UINT *) ucResetValue |= (pgpio_multi_mode[WIMAX_IDX].uiGPIOMode & + *(UINT *) ucResetValue |= + (pgpio_multi_mode[WIMAX_IDX].uiGPIOMode & pgpio_multi_mode[WIMAX_IDX].uiGPIOMask); /* write all IN's (0's) */ - *(UINT *) ucResetValue &= ~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) & + *(UINT *) ucResetValue &= + ~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) & pgpio_multi_mode[WIMAX_IDX].uiGPIOMask); /* Currently implemente
[PATCH v2 2/3] Staging: bcm: Outsourced cmd handling to function
This patch outsourced the true-branch for the IOCTL_BCM_NVM_READ command handling to shorten the bcm_char_ioctl_nvm_rw() function. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 72 ++- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index e5283dd..6b1c584 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1,6 +1,10 @@ #include #include "headers.h" + +static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite); + /*** * Function - bcm_char_open() * @@ -1449,34 +1453,10 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, do_gettimeofday(&tv0); if (IOCTL_BCM_NVM_READ == cmd) { - down(&Adapter->NVMRdmWrmLock); - - if ((Adapter->IdleMode == TRUE) || - (Adapter->bShutStatus == TRUE) || - (Adapter->bPreparingForLowPowerMode == TRUE)) { - - BCM_DEBUG_PRINT(Adapter, - DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, - "Device is in Idle/Shutdown Mode\n"); - up(&Adapter->NVMRdmWrmLock); - kfree(pReadData); - return -EACCES; - } - - Status = BeceemNVMRead(Adapter, (PUINT)pReadData, - stNVMReadWrite.uiOffset, stNVMReadWrite.uiNumBytes); - up(&Adapter->NVMRdmWrmLock); - - if (Status != STATUS_SUCCESS) { - kfree(pReadData); - return Status; - } - - if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, - stNVMReadWrite.uiNumBytes)) { - kfree(pReadData); - return -EFAULT; - } + int ret = bcm_handle_nvm_read_cmd(Adapter, pReadData, + &stNVMReadWrite); + if (ret != STATUS_SUCCESS) + return ret; } else { down(&Adapter->NVMRdmWrmLock); @@ -2613,3 +2593,39 @@ void unregister_control_device_interface(struct bcm_mini_adapter *Adapter) } } +static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite) +{ + INT Status = STATUS_FAILURE; + + down(&Adapter->NVMRdmWrmLock); + + if ((Adapter->IdleMode == TRUE) || + (Adapter->bShutStatus == TRUE) || + (Adapter->bPreparingForLowPowerMode == TRUE)) { + + BCM_DEBUG_PRINT(Adapter, + DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, + "Device is in Idle/Shutdown Mode\n"); + up(&Adapter->NVMRdmWrmLock); + kfree(pReadData); + return -EACCES; + } + + Status = BeceemNVMRead(Adapter, (PUINT)pReadData, + stNVMReadWrite->uiOffset, stNVMReadWrite->uiNumBytes); + up(&Adapter->NVMRdmWrmLock); + + if (Status != STATUS_SUCCESS) { + kfree(pReadData); + return Status; + } + + if (copy_to_user(stNVMReadWrite->pBuffer, pReadData, + stNVMReadWrite->uiNumBytes)) { + kfree(pReadData); + return -EFAULT; + } + + return STATUS_SUCCESS; +} -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/3] Staging: bcm: Outsourced IsFlash2x() handling
This patch outsources the code from the IsFlash2x() check in bcm_char_ioctl_nvm_rw() function to shorten it. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 101 -- 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 6b1c584..90d9d03 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -4,6 +4,8 @@ static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite); +static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite); /*** * Function - bcm_char_open() @@ -1403,7 +1405,6 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, struct timeval tv0, tv1; struct bcm_ioctl_buffer IoBuffer; PUCHAR pReadData = NULL; - ULONG ulDSDMagicNumInUsrBuff = 0; INT Status = STATUS_FAILURE; memset(&tv0, 0, sizeof(struct timeval)); @@ -1474,48 +1475,11 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, Adapter->bHeaderChangeAllowed = TRUE; if (IsFlash2x(Adapter)) { - /* -* New Requirement:- -* DSD section updation will be allowed in two case:- -* 1. if DSD sig is present in DSD header means dongle -* is ok and updation is fruitfull -* 2. if point 1 failes then user buff should have -* DSD sig. this point ensures that if dongle is -* corrupted then user space program first modify -* the DSD header with valid DSD sig so that this -* as well as further write may be worthwhile. -* -* This restriction has been put assuming that -* if DSD sig is corrupted, DSD data won't be -* considered valid. -*/ - - Status = BcmFlash2xCorruptSig(Adapter, - Adapter->eActiveDSD); - if (Status != STATUS_SUCCESS) { - if (((stNVMReadWrite.uiOffset + stNVMReadWrite.uiNumBytes) != - Adapter->uiNVMDSDSize) || - (stNVMReadWrite.uiNumBytes < SIGNATURE_SIZE)) { - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, - OSAL_DBG, DBG_LVL_ALL, - "DSD Sig is present neither in Flash nor User provided Input.."); - up(&Adapter->NVMRdmWrmLock); - kfree(pReadData); - return Status; - } - - ulDSDMagicNumInUsrBuff = ntohl(*(PUINT)(pReadData + stNVMReadWrite.uiNumBytes - SIGNATURE_SIZE)); - if (ulDSDMagicNumInUsrBuff != - DSD_IMAGE_MAGIC_NUMBER) { - BCM_DEBUG_PRINT(Adapter, - DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, - "DSD Sig is present neither in Flash nor User provided Input.."); - up(&Adapter->NVMRdmWrmLock); - kfree(pReadData); - return Status; - } - } + int ret = handle_flash2x_adapter(Adapter, + pReadData, + &stNVMReadWrite); + if (ret != STATUS_SUCCESS) + return ret; } Status = BeceemNVMWrite(Adapter, (PUINT)pReadData, @@ -2629,3 +2593,54 @@ static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } + +static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite) +{ + /* +* New Requirement:- +* DSD section updation will be allowed in two case:- +* 1. if DSD sig is present in DSD header means dongle +* is ok and updation is fruitfull +* 2. if point 1 failes then user buff should have +* DSD sig. this point ensures that if dongle is +* corrupted then use
[PATCH v2 0/3] Staging: bcm: Bcmchar.c cleanup patches
Hi, I applied some fixes to my patches as they did not compile before. I guess I'm not able to test these patches without the appropriate hardware, unfortunately. Hope you guys like them anyway. Regards, Matthias Beyer Matthias Beyer (3): Staging: bcm: Fixed line lengths Staging: bcm: Outsourced cmd handling to function Staging: bcm: Outsourced IsFlash2x() handling drivers/staging/bcm/Bcmchar.c | 249 ++ 1 file changed, 152 insertions(+), 97 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 3/3] Staging: bcm: Outsourced IsFlash2x() handling
On 20-05-2014 22:52:41, Dan Carpenter wrote: > On Tue, May 20, 2014 at 05:12:46PM +0200, Matthias Beyer wrote: > > This patch outsources the code from the IsFlash2x() check in > > bcm_char_ioctl_nvm_rw() function to shorten it. > > > > This patch introduces a bug. Please fix and resend. > > Also move the function forward so we don't need a declaration. > > > + > > +static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter, > > + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite) > > +{ > > + /* > > +* New Requirement:- > > +* DSD section updation will be allowed in two case:- > > +* 1. if DSD sig is present in DSD header means dongle > > +* is ok and updation is fruitfull > > +* 2. if point 1 failes then user buff should have > > +* DSD sig. this point ensures that if dongle is > > +* corrupted then user space program first modify > > +* the DSD header with valid DSD sig so that this > > +* as well as further write may be worthwhile. > > +* > > +* This restriction has been put assuming that > > +* if DSD sig is corrupted, DSD data won't be > > +* considered valid. > > +*/ > > + INT Status = STATUS_FAILURE; > > Don't initialize Status here. It's misleading because we overwrite it > immediately. I fixed this (not sent yet). > > > + ULONG ulDSDMagicNumInUsrBuff = 0; > > + > > + Status = BcmFlash2xCorruptSig(Adapter, Adapter->eActiveDSD); > > + if (Status != STATUS_SUCCESS) { > > + if (((stNVMReadWrite->uiOffset + stNVMReadWrite->uiNumBytes) != > > + Adapter->uiNVMDSDSize) || > > + (stNVMReadWrite->uiNumBytes < SIGNATURE_SIZE)) { > > + > > + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, > > + DBG_LVL_ALL, > > + "DSD Sig is present neither in Flash > > nor User provided Input.."); > > + up(&Adapter->NVMRdmWrmLock); > > + kfree(pReadData); > > + return Status; > > + } > > + > > + ulDSDMagicNumInUsrBuff = ntohl(*(PUINT)(pReadData + > > + stNVMReadWrite->uiNumBytes - > > + SIGNATURE_SIZE)); > > + if (ulDSDMagicNumInUsrBuff != DSD_IMAGE_MAGIC_NUMBER) { > > + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, > > + DBG_LVL_ALL, > > + "DSD Sig is present neither in Flash > > nor User provided Input.."); > > + up(&Adapter->NVMRdmWrmLock); > > + kfree(pReadData); > > + return Status; > > + } > > + } > > + > > + return Status; > > This should be return "STATUS_SUCCESS". The comment explains that if > we are able to write a corrupt signature the that is success. Or > alternatively if we are able to get the DSD signature from the user > then that is also success. > > The original code worked as described in the comment but your version > preserves the error code from BcmFlash2xCorruptSig(). What do you mean by "preserves the error code from BcmFlash2xCorruptSig()" ? I check the return value from the function I introduced and if it is not STATUS_SUCCESS, I return it. I cannot see the problem? Is this the bug you mentioned above? Thank you for your comments. -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. pgpU6NarjT0HV.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 0/4] Staging: bcm: Bcmchar.c cleanup patches
Hi, I updated my patches as suggested by Dan Carpenter. Thank you for your suggestions! The patchset grew by one patch which fixes indentations in the whole file as suggested by Dan. I didn't split this patch up as it does _only_ indentation fixes. If you want me to split it up, tell me! Note: I compiled it, but I'm not able to test it as I do not have the appropriate hardware. Regards, Matthias Beyer Matthias Beyer (4): Staging: bcm: Fixed line lengths Staging: bcm: Outsourced cmd handling to function Staging: bcm: Outsourced IsFlash2x() handling Staging: bcm: Indentation fixes in Bcmchar.c drivers/staging/bcm/Bcmchar.c | 444 -- 1 file changed, 253 insertions(+), 191 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/4] Staging: bcm: Fixed line lengths
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 76 --- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index ae7490b..e5283dd 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -101,9 +101,11 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, int wait_ret_val = 0; unsigned long ret = 0; - wait_ret_val = wait_event_interruptible(Adapter->process_read_wait_queue, - (pTarang->RxAppControlHead || -Adapter->device_removed)); + wait_ret_val = wait_event_interruptible( + Adapter->process_read_wait_queue, + (pTarang->RxAppControlHead || + Adapter->device_removed)); + if ((wait_ret_val == -ERESTARTSYS)) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Exiting as i've been asked to exit!!!\n"); @@ -410,7 +412,8 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp, if (IoBuffer.InputLength > sizeof(gpio_info)) return -EINVAL; - if (copy_from_user(&gpio_info, IoBuffer.InputBuffer, IoBuffer.InputLength)) + if (copy_from_user(&gpio_info, IoBuffer.InputBuffer, + IoBuffer.InputLength)) return -EFAULT; uiBit = gpio_info.uiGpioNumber; @@ -516,7 +519,8 @@ static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp, if (IoBuffer.InputLength > sizeof(threadReq)) return -EINVAL; - if (copy_from_user(&threadReq, IoBuffer.InputBuffer, IoBuffer.InputLength)) + if (copy_from_user(&threadReq, IoBuffer.InputBuffer, + IoBuffer.InputLength)) return -EFAULT; /* if LED thread is running(Actively or Inactively) @@ -594,7 +598,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, INT Status = STATUS_FAILURE; int bytes; - memset(pgpio_multi_info, 0, MAX_IDX * sizeof(struct bcm_gpio_multi_info)); + memset(pgpio_multi_info, 0, + MAX_IDX * sizeof(struct bcm_gpio_multi_info)); if ((Adapter->IdleMode == TRUE) || (Adapter->bShutStatus == TRUE) || @@ -627,7 +632,7 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, if ((pgpio_multi_info[WIMAX_IDX].uiGPIOMask) & (pgpio_multi_info[WIMAX_IDX].uiGPIOCommand)) { /* Set 1's in GPIO OUTPUT REGISTER */ - *(UINT *)ucResetValue = pgpio_multi_info[WIMAX_IDX].uiGPIOMask & + *(UINT *)ucResetValue = pgpio_multi_info[WIMAX_IDX].uiGPIOMask & pgpio_multi_info[WIMAX_IDX].uiGPIOCommand & pgpio_multi_info[WIMAX_IDX].uiGPIOValue; @@ -643,7 +648,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, } /* Clear to 0's in GPIO OUTPUT REGISTER */ - *(UINT *)ucResetValue = (pgpio_multi_info[WIMAX_IDX].uiGPIOMask & + *(UINT *)ucResetValue = + (pgpio_multi_info[WIMAX_IDX].uiGPIOMask & pgpio_multi_info[WIMAX_IDX].uiGPIOCommand & (~(pgpio_multi_info[WIMAX_IDX].uiGPIOValue))); @@ -672,7 +678,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, Status = STATUS_SUCCESS; } - pgpio_multi_info[WIMAX_IDX].uiGPIOValue = (*(UINT *)ucResetValue & + pgpio_multi_info[WIMAX_IDX].uiGPIOValue = + (*(UINT *)ucResetValue & pgpio_multi_info[WIMAX_IDX].uiGPIOMask); } @@ -739,11 +746,13 @@ static int bcm_char_ioctl_gpio_mode_request(void __user *argp, if (pgpio_multi_mode[WIMAX_IDX].uiGPIOMask) { /* write all OUT's (1's) */ - *(UINT *) ucResetValue |= (pgpio_multi_mode[WIMAX_IDX].uiGPIOMode & + *(UINT *) ucResetValue |= + (pgpio_multi_mode[WIMAX_IDX].uiGPIOMode & pgpio_multi_mode[WIMAX_IDX].uiGPIOMask); /* write all IN's (0's) */ - *(UINT *) ucResetValue &= ~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) & + *(UINT *) ucResetValue &= + ~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) & pgpio_multi_mode[WIMAX_IDX].uiGPIOMask); /* Currently implemente
[PATCH v3 3/4] Staging: bcm: Outsourced IsFlash2x() handling
This patch outsources the code from the IsFlash2x() check in bcm_char_ioctl_nvm_rw() function to shorten it. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 98 --- 1 file changed, 55 insertions(+), 43 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 89ecdac..93b94b4 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -39,6 +39,56 @@ static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } +static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite) +{ + /* +* New Requirement:- +* DSD section updation will be allowed in two case:- +* 1. if DSD sig is present in DSD header means dongle +* is ok and updation is fruitfull +* 2. if point 1 failes then user buff should have +* DSD sig. this point ensures that if dongle is +* corrupted then user space program first modify +* the DSD header with valid DSD sig so that this +* as well as further write may be worthwhile. +* +* This restriction has been put assuming that +* if DSD sig is corrupted, DSD data won't be +* considered valid. +*/ + INT Status; + ULONG ulDSDMagicNumInUsrBuff = 0; + + Status = BcmFlash2xCorruptSig(Adapter, Adapter->eActiveDSD); + if (Status == STATUS_SUCCESS) + return STATUS_SUCCESS; + + if (((stNVMReadWrite->uiOffset + stNVMReadWrite->uiNumBytes) != + Adapter->uiNVMDSDSize) || + (stNVMReadWrite->uiNumBytes < SIGNATURE_SIZE)) { + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, + "DSD Sig is present neither in Flash nor User provided Input.."); + up(&Adapter->NVMRdmWrmLock); + kfree(pReadData); + return Status; + } + + ulDSDMagicNumInUsrBuff = + ntohl(*(PUINT)(pReadData + stNVMReadWrite->uiNumBytes - + SIGNATURE_SIZE)); + if (ulDSDMagicNumInUsrBuff != DSD_IMAGE_MAGIC_NUMBER) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, + "DSD Sig is present neither in Flash nor User provided Input.."); + up(&Adapter->NVMRdmWrmLock); + kfree(pReadData); + return Status; + } + + return STATUS_SUCCESS; +} + /*** * Function - bcm_char_open() * @@ -1437,7 +1487,6 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, struct timeval tv0, tv1; struct bcm_ioctl_buffer IoBuffer; PUCHAR pReadData = NULL; - ULONG ulDSDMagicNumInUsrBuff = 0; INT Status = STATUS_FAILURE; memset(&tv0, 0, sizeof(struct timeval)); @@ -1508,48 +1557,11 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, Adapter->bHeaderChangeAllowed = TRUE; if (IsFlash2x(Adapter)) { - /* -* New Requirement:- -* DSD section updation will be allowed in two case:- -* 1. if DSD sig is present in DSD header means dongle -* is ok and updation is fruitfull -* 2. if point 1 failes then user buff should have -* DSD sig. this point ensures that if dongle is -* corrupted then user space program first modify -* the DSD header with valid DSD sig so that this -* as well as further write may be worthwhile. -* -* This restriction has been put assuming that -* if DSD sig is corrupted, DSD data won't be -* considered valid. -*/ - - Status = BcmFlash2xCorruptSig(Adapter, - Adapter->eActiveDSD); - if (Status != STATUS_SUCCESS) { - if (((stNVMReadWrite.uiOffset + stNVMReadWrite.uiNumBytes) != - Adapter->uiNVMDSDSize) || - (stNVMReadWrite.uiNumBytes < SIGNATURE_SIZE)) { - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, - OSAL_DBG, DBG_LVL_ALL, - "DSD Sig is present neither in Flash nor User provided Input.."); - up(&Adapter->NVMRdmWrmLock); -
[PATCH v3 2/4] Staging: bcm: Outsourced cmd handling to function
This patch outsourced the true-branch for the IOCTL_BCM_NVM_READ command handling to shorten the bcm_char_ioctl_nvm_rw() function. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 70 ++- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index e5283dd..89ecdac 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1,6 +1,44 @@ #include #include "headers.h" + +static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter, + PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite) +{ + INT Status = STATUS_FAILURE; + + down(&Adapter->NVMRdmWrmLock); + + if ((Adapter->IdleMode == TRUE) || (Adapter->bShutStatus == TRUE) || + (Adapter->bPreparingForLowPowerMode == TRUE)) { + + BCM_DEBUG_PRINT(Adapter, + DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, + "Device is in Idle/Shutdown Mode\n"); + up(&Adapter->NVMRdmWrmLock); + kfree(pReadData); + return -EACCES; + } + + Status = BeceemNVMRead(Adapter, (PUINT)pReadData, + stNVMReadWrite->uiOffset, + stNVMReadWrite->uiNumBytes); + up(&Adapter->NVMRdmWrmLock); + + if (Status != STATUS_SUCCESS) { + kfree(pReadData); + return Status; + } + + if (copy_to_user(stNVMReadWrite->pBuffer, pReadData, + stNVMReadWrite->uiNumBytes)) { + kfree(pReadData); + return -EFAULT; + } + + return STATUS_SUCCESS; +} + /*** * Function - bcm_char_open() * @@ -1449,34 +1487,10 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp, do_gettimeofday(&tv0); if (IOCTL_BCM_NVM_READ == cmd) { - down(&Adapter->NVMRdmWrmLock); - - if ((Adapter->IdleMode == TRUE) || - (Adapter->bShutStatus == TRUE) || - (Adapter->bPreparingForLowPowerMode == TRUE)) { - - BCM_DEBUG_PRINT(Adapter, - DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, - "Device is in Idle/Shutdown Mode\n"); - up(&Adapter->NVMRdmWrmLock); - kfree(pReadData); - return -EACCES; - } - - Status = BeceemNVMRead(Adapter, (PUINT)pReadData, - stNVMReadWrite.uiOffset, stNVMReadWrite.uiNumBytes); - up(&Adapter->NVMRdmWrmLock); - - if (Status != STATUS_SUCCESS) { - kfree(pReadData); - return Status; - } - - if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, - stNVMReadWrite.uiNumBytes)) { - kfree(pReadData); - return -EFAULT; - } + int ret = bcm_handle_nvm_read_cmd(Adapter, pReadData, + &stNVMReadWrite); + if (ret != STATUS_SUCCESS) + return ret; } else { down(&Adapter->NVMRdmWrmLock); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 4/4] Staging: bcm: Indentation fixes in Bcmchar.c
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/Bcmchar.c | 218 ++ 1 file changed, 115 insertions(+), 103 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 93b94b4..52809dc 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -241,7 +241,7 @@ static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, } static int bcm_char_ioctl_reg_read_private(void __user *argp, - struct bcm_mini_adapter *Adapter) + struct bcm_mini_adapter *Adapter) { struct bcm_rdm_buffer sRdmBuffer = {0}; struct bcm_ioctl_buffer IoBuffer; @@ -292,7 +292,7 @@ static int bcm_char_ioctl_reg_read_private(void __user *argp, } static int bcm_char_ioctl_reg_write_private(void __user *argp, - struct bcm_mini_adapter *Adapter) + struct bcm_mini_adapter *Adapter) { struct bcm_wrm_buffer sWrmBuffer = {0}; struct bcm_ioctl_buffer IoBuffer; @@ -339,7 +339,7 @@ static int bcm_char_ioctl_reg_write_private(void __user *argp, } static int bcm_char_ioctl_eeprom_reg_read(void __user *argp, - struct bcm_mini_adapter *Adapter) + struct bcm_mini_adapter *Adapter) { struct bcm_rdm_buffer sRdmBuffer = {0}; struct bcm_ioctl_buffer IoBuffer; @@ -407,7 +407,8 @@ static int bcm_char_ioctl_eeprom_reg_read(void __user *argp, } static int bcm_char_ioctl_eeprom_reg_write(void __user *argp, - struct bcm_mini_adapter *Adapter, UINT cmd) + struct bcm_mini_adapter *Adapter, + UINT cmd) { struct bcm_wrm_buffer sWrmBuffer = {0}; struct bcm_ioctl_buffer IoBuffer; @@ -473,7 +474,7 @@ static int bcm_char_ioctl_eeprom_reg_write(void __user *argp, } static int bcm_char_ioctl_gpio_set_request(void __user *argp, - struct bcm_mini_adapter *Adapter) + struct bcm_mini_adapter *Adapter) { struct bcm_gpio_info gpio_info = {0}; struct bcm_ioctl_buffer IoBuffer; @@ -501,7 +502,7 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp, return -EINVAL; if (copy_from_user(&gpio_info, IoBuffer.InputBuffer, - IoBuffer.InputLength)) + IoBuffer.InputLength)) return -EFAULT; uiBit = gpio_info.uiGpioNumber; @@ -583,7 +584,7 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp, } static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp, - struct bcm_mini_adapter *Adapter) + struct bcm_mini_adapter *Adapter) { struct bcm_user_thread_req threadReq = {0}; struct bcm_ioctl_buffer IoBuffer; @@ -608,7 +609,7 @@ static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp, return -EINVAL; if (copy_from_user(&threadReq, IoBuffer.InputBuffer, - IoBuffer.InputLength)) + IoBuffer.InputLength)) return -EFAULT; /* if LED thread is running(Actively or Inactively) @@ -634,7 +635,7 @@ static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp, } static int bcm_char_ioctl_gpio_status_request(void __user *argp, - struct bcm_mini_adapter *Adapter) + struct bcm_mini_adapter *Adapter) { struct bcm_gpio_info gpio_info = {0}; struct bcm_ioctl_buffer IoBuffer; @@ -676,7 +677,7 @@ static int bcm_char_ioctl_gpio_status_request(void __user *argp, } static int bcm_char_ioctl_gpio_multi_request(void __user *argp, - struct bcm_mini_adapter *Adapter) + struct bcm_mini_adapter *Adapter) { struct bcm_gpio_multi_info gpio_multi_info[MAX_IDX]; struct bcm_gpio_multi_info *pgpio_multi_info = @@ -687,7 +688,7 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, int bytes; memset(pgpio_multi_info, 0, - MAX_IDX * sizeof(struct bcm_gpio_multi_info)); + MAX_IDX * sizeof(struct bcm_gpio_multi_info)); if ((Adapter->IdleMode == TRUE) || (Adapter->bShutStatus == TRUE) || @@ -703,11 +704,11 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, IoBuffer.OutputLength = sizeof(gpio_multi_info); if (copy_from_user(&gpio_multi_info, IoBuffer.InputBuffer, - IoBuffer.InputLength)) + IoBuffer.InputLength)) return -EFAULT; - if (IsReqGpioIsLedInNVM(Adapter, - pgpio_multi_info[WIMAX_IDX].uiGPIOMask) == false) { + if (IsReqGpioIsLedInNVM(Adapter, pgpio_multi_info[WIMAX_IDX].uiGPIOMask) +
[PATCH 00/27] Cleanup for drivers/staging/bcm/CmHost.c
Hi, I have some cleanup patches for the drivers/staging/bcm/CmHost.c file. I hope you like them. I compiled every single one of them, but I'm not able to test them as I do not have the appropriate hardware. If you want me to squash/split single patches, let me know. Regards, Matthias Beyer Matthias Beyer (27): Staging: bcm: Shortened code by using variable Staging: bcm: Shortened lines in OverrideServiceFlowParams() Staging: bcm: Shortened lines in get_dsx_sf_data_to_application() Staging: bcm: Outsourced restoring of endianess for ip adresses Staging: bcm: Simplified by using variables Staging: bcm: Shortened line Staging: bcm: Shortenend lines in GetNextTargetBufferLocation() Staging: bcm: Shortened lines in SetupTargetDsxBuffers() Staging: bcm: Shortened lines in RestoreCmControlResponseMessage() Staging: bcm: Shortened lines in StoreCmControlResponseMessage() Staging: bcm: Shortened lines in StoreSFParam() Staging: bcm: Shortened lines in RestoreSFParam() Staging: bcm: Replaced long member-accessing Staging: bcm: Shortened some lines in DumpCmControlPacker() Staging: bcm: Outsourced PHS rule applying Staging: bcm: Replaced struct member accessing with variable Staging: bcm: Shortened lines in CopyToAdapter() Staging: bcm: Shortened line in DeleteAllClassifiersForSF() Staging: bcm: Shortened lines in DeleteClassifierRuleFromSF() Staging: bcm: Replaced member accessing with variable Staging: bcm: Shortened lines in CopyClassifierRuleToSF() Staging: bcm: Shortened lines and replaced member accessing in CopyIpAddrToClassifier() Staging: bcm: Replaced member accessing by variable Staging: bcm: Shortened lines in CopyIpAddrToClassifier() Staging: bcm: Shortened lines in deleteSFBySfid() Staging: bcm: Shortened lines in SearchClsid() Staging: bcm: Shortened prototype for GetNextTargetBufferLocation() drivers/staging/bcm/CmHost.c | 1181 +++--- 1 file changed, 767 insertions(+), 414 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/27] Staging: bcm: Shortened code by using variable
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 4564c63..6793e25 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1881,19 +1881,22 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Going to Delete SF"); deleteSFBySfid(Adapter, uiSearchRuleIndex); } else { - Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pHostInfo->VCID); - Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pHostInfo->newCID); - Adapter->PackInfo[uiSearchRuleIndex].bActive = false; + struct bcm_packet_info *packinfo = + &Adapter->PackInfo[uiSearchRuleIndex]; + + packinfo->usVCID_Value = ntohs(pHostInfo->VCID); + packinfo->usCID = ntohs(pHostInfo->newCID); + packinfo->bActive = false; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "pHostInfo->QoSParamSet: 0x%x\n", pHostInfo->QoSParamSet); if (pHostInfo->QoSParamSet & 0x1) - Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet = TRUE; + packinfo->bAuthorizedSet = TRUE; if (pHostInfo->QoSParamSet & 0x2) - Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE; + packinfo->bAdmittedSet = TRUE; if (pHostInfo->QoSParamSet & 0x4) { - Adapter->PackInfo[uiSearchRuleIndex].bActiveSet = TRUE; - Adapter->PackInfo[uiSearchRuleIndex].bActive = TRUE; + packinfo->bActiveSet = TRUE; + packinfo->bActive = TRUE; } } } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/27] Staging: bcm: Shortened line
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 181c4e9..3f29dea 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1571,7 +1571,8 @@ int AllocAdapterDsxBuffer(struct bcm_mini_adapter *Adapter) * Need to Allocate memory to contain the SUPER Large structures * Our driver can't create these structures on Stack */ - Adapter->caDsxReqResp = kmalloc(sizeof(struct bcm_add_indication_alt)+LEADER_SIZE, GFP_KERNEL); + Adapter->caDsxReqResp = kmalloc(sizeof(struct bcm_add_indication_alt) + + LEADER_SIZE, GFP_KERNEL); if (!Adapter->caDsxReqResp) return -ENOMEM; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/27] Staging: bcm: Shortened lines in get_dsx_sf_data_to_application()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 16262bb..3d8c049 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1831,22 +1831,29 @@ bool CmControlResponseMessage(struct bcm_mini_adapter *Adapter, /* = NO_OF_QUEUES) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID %d not present in queue !!!", uiSFId); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "SFID %d not present in queue !!!", uiSFId); return -EINVAL; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d", status); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "status =%d", status); psSfInfo = &Adapter->PackInfo[status]; - if (psSfInfo->pstSFIndication && copy_to_user(user_buffer, - psSfInfo->pstSFIndication, sizeof(struct bcm_add_indication_alt))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy to user failed SFID %d, present in queue !!!", uiSFId); + if (psSfInfo->pstSFIndication + && copy_to_user(user_buffer, psSfInfo->pstSFIndication, + sizeof(struct bcm_add_indication_alt))) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "copy to user failed SFID %d, present in queue !!!", + uiSFId); status = -EFAULT; return status; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/27] Staging: bcm: Shortened lines in OverrideServiceFlowParams()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 27 +++ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 6793e25..16262bb 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1853,7 +1853,8 @@ int get_dsx_sf_data_to_application(struct bcm_mini_adapter *Adapter, UINT uiSFId return STATUS_SUCCESS; } -VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer) +VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, + PUINT puiBuffer) { B_UINT32 u32NumofSFsinMsg = ntohl(*(puiBuffer + 1)); struct bcm_stim_sfhostnotify *pHostInfo = NULL; @@ -1861,7 +1862,8 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer ULONG ulSFID = 0; puiBuffer += 2; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "u32NumofSFsinMsg: 0x%x\n", u32NumofSFsinMsg); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "u32NumofSFsinMsg: 0x%x\n", u32NumofSFsinMsg); while (u32NumofSFsinMsg != 0 && u32NumofSFsinMsg < NO_OF_QUEUES) { u32NumofSFsinMsg--; @@ -1870,15 +1872,21 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer ulSFID = ntohl(pHostInfo->SFID); uiSearchRuleIndex = SearchSfid(Adapter, ulSFID); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID: 0x%lx\n", ulSFID); - - if (uiSearchRuleIndex >= NO_OF_QUEUES || uiSearchRuleIndex == HiPriority) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "The SFID <%lx> doesn't exist in host entry or is Invalid\n", ulSFID); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "SFID: 0x%lx\n", ulSFID); + + if (uiSearchRuleIndex >= NO_OF_QUEUES + || uiSearchRuleIndex == HiPriority) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "The SFID <%lx> doesn't exist in host entry or is Invalid\n", + ulSFID); continue; } if (pHostInfo->RetainSF == false) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Going to Delete SF"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, "Going to Delete SF"); deleteSFBySfid(Adapter, uiSearchRuleIndex); } else { struct bcm_packet_info *packinfo = @@ -1888,7 +1896,10 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, PUINT puiBuffer packinfo->usCID = ntohs(pHostInfo->newCID); packinfo->bActive = false; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "pHostInfo->QoSParamSet: 0x%x\n", pHostInfo->QoSParamSet); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "pHostInfo->QoSParamSet: 0x%x\n", + pHostInfo->QoSParamSet); if (pHostInfo->QoSParamSet & 0x1) packinfo->bAuthorizedSet = TRUE; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/27] Staging: bcm: Simplified by using variables
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 59a3eb9..181c4e9 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1923,13 +1923,16 @@ static void restore_endianess_of_pstClassifierEntry( enum bcm_ipaddr_context eIpAddrContext) { int i; + union u_ip_address *stSrc = &pstClassifierEntry->stSrcIpAddress; + union u_ip_address *stDest = &pstClassifierEntry->stDestIpAddress; + for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) { if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i]); - pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i]); + stSrc->ulIpv6Addr[i] = ntohl(stSrc->ulIpv6Addr[i]); + stSrc->ulIpv6Mask[i] = ntohl(stSrc->ulIpv6Mask[i]); } else if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i]); - pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i]); + stDest->ulIpv6Addr[i] = ntohl(stDest->ulIpv6Addr[i]); + stDest->ulIpv6Mask[i] = ntohl(stDest->ulIpv6Mask[i]); } } } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/27] Staging: bcm: Shortened lines in RestoreCmControlResponseMessage()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 102 +++ 1 file changed, 73 insertions(+), 29 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 2743d16..3b65990 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1406,40 +1406,63 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu } static inline struct bcm_add_indication_alt -*RestoreCmControlResponseMessage(register struct bcm_mini_adapter *Adapter, register PVOID pvBuffer) +*RestoreCmControlResponseMessage(register struct bcm_mini_adapter *Adapter, + register PVOID pvBuffer) { ULONG ulStatus = 0; struct bcm_add_indication *pstAddIndication = NULL; struct bcm_add_indication_alt *pstAddIndicationDest = NULL; pstAddIndication = pvBuffer; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "=>"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "=>"); if ((pstAddIndication->u8Type == DSD_REQ) || (pstAddIndication->u8Type == DSD_RSP) || (pstAddIndication->u8Type == DSD_ACK)) return pvBuffer; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Inside RestoreCmControlResponseMessage "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Inside RestoreCmControlResponseMessage "); /* * Need to Allocate memory to contain the SUPER Large structures * Our driver can't create these structures on Stack :( */ - pstAddIndicationDest = kmalloc(sizeof(struct bcm_add_indication_alt), GFP_KERNEL); + pstAddIndicationDest = kmalloc(sizeof(struct bcm_add_indication_alt), + GFP_KERNEL); if (pstAddIndicationDest) { - memset(pstAddIndicationDest, 0, sizeof(struct bcm_add_indication_alt)); + memset(pstAddIndicationDest, 0, + sizeof(struct bcm_add_indication_alt)); } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Failed to allocate memory for SF Add Indication Structure "); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, + DBG_LVL_ALL, + "Failed to allocate memory for SF Add Indication Structure "); return NULL; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8Type : 0x%X", pstAddIndication->u8Type); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8Direction : 0x%X", pstAddIndication->eConnectionDir); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8TID : 0x%X", ntohs(pstAddIndication->u16TID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u8CID : 0x%X", ntohs(pstAddIndication->u16CID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-u16VCID : 0x%X", ntohs(pstAddIndication->u16VCID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-autorized set loc : %p", pstAddIndication->psfAuthorizedSet); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-admitted set loc : %p", pstAddIndication->psfAdmittedSet); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "AddIndication-Active set loc : %p", pstAddIndication->psfActiveSet); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8Type : 0x%X", + pstAddIndication->u8Type); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8Direction : 0x%X", + pstAddIndication->eConnectionDir); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8TID : 0x%X", + ntohs(pstAddIndication->u16TID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u8CID : 0x%X", + ntohs(pstAddIndication->u16CID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "AddIndication-u16VCID : 0x%X", + ntohs(pstAddIndication->u16VCID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, +
[PATCH 04/27] Staging: bcm: Outsourced restoring of endianess for ip adresses
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 3d8c049..59a3eb9 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -14,6 +14,9 @@ enum E_CLASSIFIER_ACTION { }; static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid); +static void restore_endianess_of_pstClassifierEntry( + struct bcm_classifier_rule *pstClassifierEntry, + enum bcm_ipaddr_context eIpAddrContext); / * Function - SearchSfid @@ -200,15 +203,10 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, } if (bIpVersion6) { /* Restore EndianNess of Struct */ - for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) { - if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i]); - pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i]); - } else if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i]); - pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i]); - } - } + restore_endianess_of_pstClassifierEntry( + pstClassifierEntry, + eIpAddrContext + ); } } } @@ -1919,3 +1917,19 @@ VOID OverrideServiceFlowParams(struct bcm_mini_adapter *Adapter, } } } + +static void restore_endianess_of_pstClassifierEntry( + struct bcm_classifier_rule *pstClassifierEntry, + enum bcm_ipaddr_context eIpAddrContext) +{ + int i; + for (i = 0; i < MAX_IP_RANGE_LENGTH * 4; i++) { + if (eIpAddrContext == eSrcIpAddress) { + pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[i]); + pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[i]); + } else if (eIpAddrContext == eDestIpAddress) { + pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Addr[i]); + pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv6Mask[i]); + } + } +} -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/27] Staging: bcm: Shortenend lines in GetNextTargetBufferLocation()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 3f29dea..9fea9a8 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1531,12 +1531,14 @@ ULONG SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter) return 1; } -static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid) +static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, + B_UINT16 tid) { ULONG dsx_buf; ULONG idx, max_try; - if ((Adapter->ulTotalTargetBuffersAvailable == 0) || (Adapter->ulFreeTargetBufferCnt == 0)) { + if ((Adapter->ulTotalTargetBuffersAvailable == 0) + || (Adapter->ulFreeTargetBufferCnt == 0)) { ClearTargetDSXBuffer(Adapter, tid, false); return 0; } @@ -1549,7 +1551,9 @@ static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UIN } if (max_try == 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "\n GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx ", Adapter->ulFreeTargetBufferCnt); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "\n GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx ", + Adapter->ulFreeTargetBufferCnt); ClearTargetDSXBuffer(Adapter, tid, false); return 0; } @@ -1560,7 +1564,9 @@ static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UIN Adapter->ulFreeTargetBufferCnt--; idx = (idx+1)%Adapter->ulTotalTargetBuffersAvailable; Adapter->ulCurrentTargetBuffer = idx; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "GetNextTargetBufferLocation :Returning address %lx tid %d\n", dsx_buf, tid); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "GetNextTargetBufferLocation :Returning address %lx tid %d\n", + dsx_buf, tid); return dsx_buf; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 24/27] Staging: bcm: Shortened lines in CopyIpAddrToClassifier()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 72 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 7fb8568..5bd6e1c 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -136,7 +136,8 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES; /* Destination Ip Address */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Address Range Length:0x%X ", u8IpAddressLen); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Ip Address Range Length:0x%X ", u8IpAddressLen); if ((bIpVersion6 ? (IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2) : (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) { @@ -152,39 +153,61 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, * (nSizeOfIPAddressInBytes for address and nSizeOfIPAddressInBytes for mask) */ if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->ucIPDestinationAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); + pstClassifierEntry->ucIPDestinationAddressLength = + u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); if (bIpVersion6) { - ptrClassifierIpAddress = st_dest_ip->ucIpv6Address; - ptrClassifierIpMask = st_dest_ip->ucIpv6Mask; + ptrClassifierIpAddress = + st_dest_ip->ucIpv6Address; + ptrClassifierIpMask = + st_dest_ip->ucIpv6Mask; } else { - ptrClassifierIpAddress = st_dest_ip->ucIpv4Address; - ptrClassifierIpMask = st_dest_ip->ucIpv4Mask; + ptrClassifierIpAddress = + st_dest_ip->ucIpv4Address; + ptrClassifierIpMask = + st_dest_ip->ucIpv4Mask; } } else if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->ucIPSourceAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); + pstClassifierEntry->ucIPSourceAddressLength = + u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); if (bIpVersion6) { - ptrClassifierIpAddress = st_src_ip->ucIpv6Address; + ptrClassifierIpAddress = + st_src_ip->ucIpv6Address; ptrClassifierIpMask = st_src_ip->ucIpv6Mask; } else { - ptrClassifierIpAddress = st_src_ip->ucIpv4Address; + ptrClassifierIpAddress = + st_src_ip->ucIpv4Address; ptrClassifierIpMask = st_src_ip->ucIpv4Mask; } } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Address Length:0x%X\n", pstClassifierEntry->ucIPDestinationAddressLength); - while ((u8IpAddressLen >= nSizeOfIPAddressInBytes) && (i < MAX_IP_RANGE_LENGTH)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Address Length:0x%X\n", + pstClassifierEntry->ucIPDestinationAddressLength); + while ((u8IpAddressLen >= nSizeOfIPAddressInBytes) + && (i < MAX_IP_RANGE_LENGTH)) { memcpy(ptrClassifierIpAddress + (i * nSizeOfIPAddressInBytes), - (pu8IpAddressMaskSrc+(i*nSizeOfIPAddressInBytes*2)), + (pu8IpAddressMaskSrc + + (i * nSizeOfIPAddressInBytes * 2)), nSizeOfIPAddressInBytes); if (!bIpVersion6) { if (eIpAddrContext == eSrcIpAddress) { - st_src_ip->ulIpv4Addr[i] = ntohl(st_src_ip->ulIpv4Addr[i]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Address:0x%luX "
[PATCH 26/27] Staging: bcm: Shortened lines in SearchClsid()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 6dfa361..182efccd 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -78,13 +78,16 @@ static int SearchFreeSfid(struct bcm_mini_adapter *Adapter) * B_UINT16 uiClassifierID - The classifier ID to be searched * Return: int :Classifier table index of matching entry */ -static int SearchClsid(struct bcm_mini_adapter *Adapter, ULONG ulSFID, B_UINT16 uiClassifierID) +static int SearchClsid(struct bcm_mini_adapter *Adapter, + ULONG ulSFID, + B_UINT16 uiClassifierID) { int i; for (i = 0; i < MAX_CLASSIFIERS; i++) { if ((Adapter->astClassifierTable[i].bUsed) && - (Adapter->astClassifierTable[i].uiClassifierRuleIndex == uiClassifierID) && + (Adapter->astClassifierTable[i].uiClassifierRuleIndex + == uiClassifierID) && (Adapter->astClassifierTable[i].ulSFID == ulSFID)) return i; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/27] Staging: bcm: Shortened lines in SetupTargetDsxBuffers()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 31 ++- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 9fea9a8..2743d16 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1492,31 +1492,44 @@ ULONG SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter) int Status; if (!Adapter) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Adapter was NULL!!!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Adapter was NULL!!!"); return 0; } if (Adapter->astTargetDsxBuffer[0].ulTargetDsxBuffer) return 1; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Size of Each DSX Buffer(Also size of connection manager parameters): %zx ", sizeof(struct bcm_connect_mgr_params)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Reading DSX buffer From Target location %x ", DSX_MESSAGE_EXCHANGE_BUFFER); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Size of Each DSX Buffer(Also size of connection manager parameters): %zx ", + sizeof(struct bcm_connect_mgr_params)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Reading DSX buffer From Target location %x ", + DSX_MESSAGE_EXCHANGE_BUFFER); - Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER, (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT)); + Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER, + (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT)); if (Status < 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "RDM failed!!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "RDM failed!!"); return 0; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Base Address Of DSX Target Buffer : 0x%lx", ulTargetDsxBuffersBase); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Tgt Buffer is Now %lx :", ulTargetDsxBuffersBase); - ulCntTargetBuffers = DSX_MESSAGE_EXCHANGE_BUFFER_SIZE / sizeof(struct bcm_connect_mgr_params); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Base Address Of DSX Target Buffer : 0x%lx", + ulTargetDsxBuffersBase); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Tgt Buffer is Now %lx :", ulTargetDsxBuffersBase); + ulCntTargetBuffers = DSX_MESSAGE_EXCHANGE_BUFFER_SIZE / + sizeof(struct bcm_connect_mgr_params); Adapter->ulTotalTargetBuffersAvailable = ulCntTargetBuffers > MAX_TARGET_DSX_BUFFERS ? MAX_TARGET_DSX_BUFFERS : ulCntTargetBuffers; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, " Total Target DSX Buffer setup %lx ", Adapter->ulTotalTargetBuffersAvailable); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + " Total Target DSX Buffer setup %lx ", + Adapter->ulTotalTargetBuffersAvailable); for (i = 0; i < Adapter->ulTotalTargetBuffersAvailable; i++) { Adapter->astTargetDsxBuffer[i].ulTargetDsxBuffer = ulTargetDsxBuffersBase; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 25/27] Staging: bcm: Shortened lines in deleteSFBySfid()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 5bd6e1c..6dfa361 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -109,7 +109,8 @@ static int SearchFreeClsid(struct bcm_mini_adapter *Adapter /**Adapter Context*/ return MAX_CLASSIFIERS+1; } -static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex) +static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, + UINT uiSearchRuleIndex) { /* deleting all the packet held in the SF */ flush_queue(Adapter, uiSearchRuleIndex); @@ -118,7 +119,8 @@ static VOID deleteSFBySfid(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIn DeleteAllClassifiersForSF(Adapter, uiSearchRuleIndex); /* Resetting only MIBS related entries in the SF */ - memset((PVOID)&Adapter->PackInfo[uiSearchRuleIndex], 0, sizeof(struct bcm_mibs_table)); + memset((PVOID)&Adapter->PackInfo[uiSearchRuleIndex], 0, + sizeof(struct bcm_mibs_table)); } static inline VOID -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 27/27] Staging: bcm: Shortened prototype for GetNextTargetBufferLocation()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 182efccd..fb1d932 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -13,7 +13,8 @@ enum E_CLASSIFIER_ACTION { eDeleteClassifier }; -static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, B_UINT16 tid); +static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, + B_UINT16 tid); static void restore_endianess_of_pstClassifierEntry( struct bcm_classifier_rule *pstClassifierEntry, enum bcm_ipaddr_context eIpAddrContext); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/27] Staging: bcm: Shortened lines in StoreCmControlResponseMessage()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 33 +++-- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 3b65990..f54b177 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1291,7 +1291,8 @@ static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, return 1; } -ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBuffer, UINT *puBufferLength) +ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, + PVOID pvBuffer, UINT *puBufferLength) { struct bcm_add_indication_alt *pstAddIndicationAlt = NULL; struct bcm_add_indication *pstAddIndication = NULL; @@ -1325,13 +1326,15 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu } /* For DSA_REQ, only up to "psfAuthorizedSet" parameter should be accessed by driver! */ - pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), GFP_KERNEL); + pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), + GFP_KERNEL); if (pstAddIndication == NULL) return 0; /* AUTHORIZED SET */ pstAddIndication->psfAuthorizedSet = (struct bcm_connect_mgr_params *) - GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); + GetNextTargetBufferLocation(Adapter, + pstAddIndicationAlt->u16TID); if (!pstAddIndication->psfAuthorizedSet) { kfree(pstAddIndication); return 0; @@ -1344,7 +1347,9 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu } /* this can't possibly be right */ - pstAddIndication->psfAuthorizedSet = (struct bcm_connect_mgr_params *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet); + pstAddIndication->psfAuthorizedSet = + (struct bcm_connect_mgr_params *) ntohl( + (ULONG)pstAddIndication->psfAuthorizedSet); if (pstAddIndicationAlt->u8Type == DSA_REQ) { struct bcm_add_request AddRequest; @@ -1373,31 +1378,39 @@ ULONG StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, PVOID pvBu /* ADMITTED SET */ pstAddIndication->psfAdmittedSet = (struct bcm_connect_mgr_params *) - GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); + GetNextTargetBufferLocation(Adapter, + pstAddIndicationAlt->u16TID); if (!pstAddIndication->psfAdmittedSet) { kfree(pstAddIndication); return 0; } - if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAdmittedSet, (ULONG)pstAddIndication->psfAdmittedSet) != 1) { + if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfAdmittedSet, + (ULONG)pstAddIndication->psfAdmittedSet) != 1) { kfree(pstAddIndication); return 0; } - pstAddIndication->psfAdmittedSet = (struct bcm_connect_mgr_params *)ntohl((ULONG)pstAddIndication->psfAdmittedSet); + pstAddIndication->psfAdmittedSet = + (struct bcm_connect_mgr_params *) ntohl( + (ULONG) pstAddIndication->psfAdmittedSet); /* ACTIVE SET */ pstAddIndication->psfActiveSet = (struct bcm_connect_mgr_params *) - GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); + GetNextTargetBufferLocation(Adapter, + pstAddIndicationAlt->u16TID); if (!pstAddIndication->psfActiveSet) { kfree(pstAddIndication); return 0; } - if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfActiveSet, (ULONG)pstAddIndication->psfActiveSet) != 1) { + if (StoreSFParam(Adapter, (PUCHAR)&pstAddIndicationAlt->sfActiveSet, + (ULONG)pstAddIndication->psfActiveSet) != 1) { kfree(pstAddIndication); return 0; } - pstAddIndication->psfActiveSet = (struct bcm_connect_mgr_params *)ntohl((ULONG)pstAddIndication->psfActiveSet); + pstAddIndication->psfActiveSet = + (struct bcm_connect_mgr_params *) ntohl( + (ULONG)pstAddIndication->psfActiveSet); (*puBufferLength) = sizeof(struct bcm_add_indication); *(struct bcm_add_indication *)pvBuffer = *pstAddIndication; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/27] Staging: bcm: Shortened lines in RestoreSFParam()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index ea73c52..377e681 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1258,18 +1258,20 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " bValid: 0x%X", pstAddIndication->sfActiveSet.bValid); } -static inline ULONG RestoreSFParam(struct bcm_mini_adapter *Adapter, ULONG ulAddrSFParamSet, PUCHAR pucDestBuffer) +static inline ULONG RestoreSFParam(struct bcm_mini_adapter *Adapter, + ULONG ulAddrSFParamSet, PUCHAR pucDestBuffer) { UINT nBytesToRead = sizeof(struct bcm_connect_mgr_params); if (ulAddrSFParamSet == 0 || NULL == pucDestBuffer) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Got Param address as 0!!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Got Param address as 0!!"); return 0; } ulAddrSFParamSet = ntohl(ulAddrSFParamSet); /* Read out the SF Param Set At the indicated Location */ - if (rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) < 0) + if (rdm(Adapter, ulAddrSFParamSet,(PUCHAR)pucDestBuffer, nBytesToRead) < 0) return STATUS_FAILURE; return 1; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/27] Staging: bcm: Replaced long member-accessing
This patch replaces long object->member.member foo by variable useage. Increases the reading experience a lot by introducing only one variable (as it decreases the whoa-wall-of-text experience). Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 107 ++- 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 377e681..644087c 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1159,99 +1159,102 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) for (nIndex = 0; nIndex < nCurClassifierCnt; nIndex++) { struct bcm_convergence_types *psfCSType = NULL; + struct bcm_packet_class_rules *clsRule = NULL; + + psfCSType = &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex]; + clsRule = &psfCSType->cCPacketClassificationRule; - psfCSType = &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex]; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " CCPacketClassificationRuleSI>"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ClassifierRulePriority: 0x%X ", - psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority); + clsRule->u8ClassifierRulePriority); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfServiceLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength); + clsRule->u8IPTypeOfServiceLength); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfService[3]: 0x%X ,0x%X ,0x%X ", - psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0], - psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1], - psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]); + clsRule->u8IPTypeOfService[0], + clsRule->u8IPTypeOfService[1], + clsRule->u8IPTypeOfService[2]); for (uiLoopIndex = 0; uiLoopIndex < 1; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8Protocol: 0x%X ", psfCSType->cCPacketClassificationRule.u8Protocol); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8Protocol: 0x%X ", clsRule->u8Protocol); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddressLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength); + clsRule->u8IPMaskedSourceAddressLength); for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddress[32]: 0x%X ", - psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]); + clsRule->u8IPMaskedSourceAddress[uiLoopIndex]); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddressLength: 0x%02X ", - psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength); + clsRule->u8IPDestinationAddressLength); for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPDestinationAddress[32]:0x%X ", - psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]); + clsRule->u8IPDestinationAddress[uiLoopIndex]); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolSourcePortRangeLength: 0x%X ", - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength); + clsRule->u8ProtocolSourcePortRangeLength); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolSourcePortRange[4]: 0x%X ,0x%X ,0x%X ,0x%X ", - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRange[0], -
[PATCH 15/27] Staging: bcm: Outsourced PHS rule applying
This patch outsources the big PHS-rule-applying code chunk into a function. It also replaces member accessing by using variables. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 170 +-- 1 file changed, 99 insertions(+), 71 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 89030cc..21074ae 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -18,6 +18,14 @@ static void restore_endianess_of_pstClassifierEntry( struct bcm_classifier_rule *pstClassifierEntry, enum bcm_ipaddr_context eIpAddrContext); +static void apply_phs_rule_to_all_classifiers( + register struct bcm_mini_adapter *Adapter, + register UINT uiSearchRuleIndex, + USHORT uVCID, + struct bcm_phs_rule *sPhsRule, + struct bcm_phs_rules *cPhsRule, + struct bcm_add_indication_alt *pstAddIndication); + / * Function - SearchSfid * @@ -627,79 +635,12 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* cPhsRule.u8PHSI) { /* Apply This PHS Rule to all classifiers whose Associated PHSI Match */ - unsigned int uiClassifierIndex = 0; - if (pstAddIndication->u8Direction == UPLINK_DIR) { - for (uiClassifierIndex = 0; uiClassifierIndex < MAX_CLASSIFIERS; uiClassifierIndex++) { - if ((Adapter->astClassifierTable[uiClassifierIndex].bUsed) && - (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == Adapter->PackInfo[uiSearchRuleIndex].ulSFID) && - (Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI == psfCSType->cPhsRule.u8PHSI)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, - "Adding PHS Rule For Classifier: 0x%x cPhsRule.u8PHSI: 0x%x\n", - Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex, - psfCSType->cPhsRule.u8PHSI); - /* Update The PHS Rule for this classifier as Associated PHSI id defined */ - - /* Copy the PHS Rule */ - sPhsRule.u8PHSI = psfCSType->cPhsRule.u8PHSI; - sPhsRule.u8PHSFLength = psfCSType->cPhsRule.u8PHSFLength; - sPhsRule.u8PHSMLength = psfCSType->cPhsRule.u8PHSMLength; - sPhsRule.u8PHSS = psfCSType->cPhsRule.u8PHSS; - sPhsRule.u8PHSV = psfCSType->cPhsRule.u8PHSV; - memcpy(sPhsRule.u8PHSF, psfCSType->cPhsRule.u8PHSF, MAX_PHS_LENGTHS); - memcpy(sPhsRule.u8PHSM, psfCSType->cPhsRule.u8PHSM, MAX_PHS_LENGTHS); - sPhsRule.u8RefCnt = 0; - sPhsRule.bUnclassifiedPHSRule = false; - sPhsRule.PHSModifiedBytes = 0; - sPhsRule.PHSModifiedNumPackets = 0; - sPhsRule.PHSErrorNumPackets = 0; - - /* bPHSRuleAssociated = TRUE; */ - /* Store The PHS Rule for this classifier */ - - PhsUpdateClassifierRule( - &Adapter->stBCMPhsContext, - uVCID, - Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex, - &sPhsRule, - Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI); - - /* Update PHS Rule For th
[PATCH 14/27] Staging: bcm: Shortened some lines in DumpCmControlPacker()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 106 +++ 1 file changed, 78 insertions(+), 28 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 644087c..89030cc 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1164,53 +1164,81 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) psfCSType = &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex]; clsRule = &psfCSType->cCPacketClassificationRule; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " CCPacketClassificationRuleSI>"); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ClassifierRulePriority: 0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " CCPacketClassificationRuleSI>"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u8ClassifierRulePriority: 0x%X ", clsRule->u8ClassifierRulePriority); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfServiceLength: 0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, " u8IPTypeOfServiceLength: 0x%X ", clsRule->u8IPTypeOfServiceLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPTypeOfService[3]: 0x%X ,0x%X ,0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8IPTypeOfService[3]: 0x%X ,0x%X ,0x%X ", clsRule->u8IPTypeOfService[0], clsRule->u8IPTypeOfService[1], clsRule->u8IPTypeOfService[2]); for (uiLoopIndex = 0; uiLoopIndex < 1; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8Protocol: 0x%X ", clsRule->u8Protocol); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8Protocol: 0x%X ", + clsRule->u8Protocol); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddressLength: 0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + "u8IPMaskedSourceAddressLength: 0x%X ", clsRule->u8IPMaskedSourceAddressLength); for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPMaskedSourceAddress[32]: 0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + "u8IPMaskedSourceAddress[32]: 0x%X ", clsRule->u8IPMaskedSourceAddress[uiLoopIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8IPDestinationAddressLength: 0x%02X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + "u8IPDestinationAddressLength: 0x%02X ", clsRule->u8IPDestinationAddressLength); for (uiLoopIndex = 0; uiLoopIndex < 32; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8IPDestinationAddress[32]:0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8IPDestinationAddress[32]:0x%X ", clsRule->u8IPDestinationAddress[uiLoopIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8ProtocolSourcePortRangeLength: 0x%X ", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_CONTROL, + DBG_LVL_ALL, + " u8ProtocolSourcePortRangeLength: 0x%X ", clsRule->u8ProtocolSourcePortRangeLengt
[PATCH 16/27] Staging: bcm: Replaced struct member accessing with variable
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 96 ++-- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 21074ae..d5e2ac2 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -447,10 +447,12 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* PackInfo[uiSearchRuleIndex].usVCID_Value; + struct bcm_packet_info *curr_packinfo = + &Adapter->PackInfo[uiSearchRuleIndex]; + USHORT uVCID = curr_packinfo->usVCID_Value; UINT UGIValue = 0; - Adapter->PackInfo[uiSearchRuleIndex].bValid = TRUE; + curr_packinfo->bValid = TRUE; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Rule Index = %d\n", uiSearchRuleIndex); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s: SFID= %x ", __func__, ntohl(psfLocalSet->u32SFID)); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Updating Queue %d", uiSearchRuleIndex); @@ -459,65 +461,65 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* PackInfo[uiSearchRuleIndex].bIPCSSupport = 0; - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0; + curr_packinfo->bIPCSSupport = 0; + curr_packinfo->bEthCSSupport = 0; /* Enable IP/ETh CS Support As Required */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : u8CSSpecification : %X\n", psfLocalSet->u8CSSpecification); switch (psfLocalSet->u8CSSpecification) { case eCSPacketIPV4: - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; + curr_packinfo->bIPCSSupport = IPV4_CS; break; case eCSPacketIPV6: - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; + curr_packinfo->bIPCSSupport = IPV6_CS; break; case eCS802_3PacketEthernet: case eCS802_1QPacketVLAN: - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; + curr_packinfo->bEthCSSupport = ETH_CS_802_3; break; case eCSPacketIPV4Over802_1QVLAN: case eCSPacketIPV4Over802_3Ethernet: - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; + curr_packinfo->bIPCSSupport = IPV4_CS; + curr_packinfo->bEthCSSupport = ETH_CS_802_3; break; case eCSPacketIPV6Over802_1QVLAN: case eCSPacketIPV6Over802_3Ethernet: - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; + curr_packinfo->bIPCSSupport = IPV6_CS; + curr_packinfo->bEthCSSupport = ETH_CS_802_3; break; default: BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error in value of CS Classification.. setting default to IP CS\n"); - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; + curr_packinfo->bIPCSSupport = IPV4_CS; break; } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : Queue No : %X ETH CS Support : %X , IP CS Support : %X\n", uiSearchRuleIndex, - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport, - Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport); + curr_packinfo->bEthCSSupport, + curr_packinfo->bIPCSSupport); /* Store IP Version used */ /* Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF */ - if (Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport == IPV6_CS) - Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV6; + if (curr_packinfo->bIPCSSupport == IPV6_CS) + curr_packinfo->ucIpVersion = IPV6; else - Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV4; + curr_packinfo->ucIpVersion = IPV4; /* To ensure that the ETH CS code doesn't gets executed if the BS doesn't supports ETH CS */ if (!Adapter->bETHCSEnabled) - Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0; + curr_packinfo->bEthCSSupport = 0; if (psfLocalSet->u8ServiceClassNameLength > 0 && psfLocalSet->u8ServiceClassNameLength < 32) - memcpy(Adapter->PackInfo[uiSearch
[PATCH 11/27] Staging: bcm: Shortened lines in StoreSFParam()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index f54b177..ea73c52 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -1275,7 +1275,8 @@ static inline ULONG RestoreSFParam(struct bcm_mini_adapter *Adapter, ULONG ulAdd return 1; } -static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, ULONG ulAddrSFParamSet) +static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, + ULONG ulAddrSFParamSet) { UINT nBytesToWrite = sizeof(struct bcm_connect_mgr_params); int ret = 0; @@ -1285,7 +1286,8 @@ static ULONG StoreSFParam(struct bcm_mini_adapter *Adapter, PUCHAR pucSrcBuffer, ret = wrm(Adapter, ulAddrSFParamSet, (u8 *)pucSrcBuffer, nBytesToWrite); if (ret < 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s:%d WRM failed", __func__, __LINE__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "%s:%d WRM failed", __func__, __LINE__); return ret; } return 1; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/27] Staging: bcm: Shortened line in DeleteAllClassifiersForSF()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index a13f2ad..aa121b7 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -401,7 +401,8 @@ static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, /* * @ingroup ctrl_pkt_functions */ -VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex) +VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, + UINT uiSearchRuleIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; int i; @@ -420,7 +421,8 @@ VOID DeleteAllClassifiersForSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRu pstClassifierEntry = &Adapter->astClassifierTable[i]; if (pstClassifierEntry->bUsed) - DeleteClassifierRuleFromSF(Adapter, uiSearchRuleIndex, i); + DeleteClassifierRuleFromSF(Adapter, + uiSearchRuleIndex, i); } } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/27] Staging: bcm: Shortened lines in DeleteClassifierRuleFromSF()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index aa121b7..9186619 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -370,7 +370,8 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru /* * @ingroup ctrl_pkt_functions */ -static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, UINT uiSearchRuleIndex, UINT nClassifierIndex) +static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, + UINT uiSearchRuleIndex, UINT nClassifierIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; B_UINT16 u16PacketClassificationRuleIndex; @@ -386,15 +387,18 @@ static inline VOID DeleteClassifierRuleFromSF(struct bcm_mini_adapter *Adapter, if (usVCID == 0) return; - u16PacketClassificationRuleIndex = Adapter->astClassifierTable[nClassifierIndex].uiClassifierRuleIndex; + u16PacketClassificationRuleIndex = + Adapter->astClassifierTable[nClassifierIndex].uiClassifierRuleIndex; pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; if (pstClassifierEntry) { pstClassifierEntry->bUsed = false; pstClassifierEntry->uiClassifierRuleIndex = 0; - memset(pstClassifierEntry, 0, sizeof(struct bcm_classifier_rule)); + memset(pstClassifierEntry, 0, + sizeof(struct bcm_classifier_rule)); /* Delete the PHS Rule for this classifier */ - PhsDeleteClassifierRule(&Adapter->stBCMPhsContext, usVCID, u16PacketClassificationRuleIndex); + PhsDeleteClassifierRule(&Adapter->stBCMPhsContext, usVCID, + u16PacketClassificationRuleIndex); } } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/27] Staging: bcm: Shortened lines in CopyToAdapter()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 97 1 file changed, 70 insertions(+), 27 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index d5e2ac2..a13f2ad 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -453,9 +453,12 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* bValid = TRUE; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Search Rule Index = %d\n", uiSearchRuleIndex); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "%s: SFID= %x ", __func__, ntohl(psfLocalSet->u32SFID)); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Updating Queue %d", uiSearchRuleIndex); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Search Rule Index = %d\n", uiSearchRuleIndex); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "%s: SFID= %x ", __func__, ntohl(psfLocalSet->u32SFID)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Updating Queue %d", uiSearchRuleIndex); ulSFID = ntohl(psfLocalSet->u32SFID); /* Store IP Version used */ @@ -465,7 +468,9 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* bEthCSSupport = 0; /* Enable IP/ETh CS Support As Required */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : u8CSSpecification : %X\n", psfLocalSet->u8CSSpecification); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "CopyToAdapter : u8CSSpecification : %X\n", + psfLocalSet->u8CSSpecification); switch (psfLocalSet->u8CSSpecification) { case eCSPacketIPV4: curr_packinfo->bIPCSSupport = IPV4_CS; @@ -488,12 +493,14 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* bEthCSSupport = ETH_CS_802_3; break; default: - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Error in value of CS Classification.. setting default to IP CS\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Error in value of CS Classification.. setting default to IP CS\n"); curr_packinfo->bIPCSSupport = IPV4_CS; break; } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "CopyToAdapter : Queue No : %X ETH CS Support : %X , IP CS Support : %X\n", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "CopyToAdapter : Queue No : %X ETH CS Support : %X , IP CS Support : %X\n", uiSearchRuleIndex, curr_packinfo->bEthCSSupport, curr_packinfo->bIPCSSupport); @@ -510,7 +517,9 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* bEthCSSupport = 0; if (psfLocalSet->u8ServiceClassNameLength > 0 && psfLocalSet->u8ServiceClassNameLength < 32) - memcpy(curr_packinfo->ucServiceClassName, psfLocalSet->u8ServiceClassName, psfLocalSet->u8ServiceClassNameLength); + memcpy(curr_packinfo->ucServiceClassName, + psfLocalSet->u8ServiceClassName, + psfLocalSet->u8ServiceClassNameLength); curr_packinfo->u8QueueType = psfLocalSet->u8ServiceFlowSchedulingType; @@ -523,9 +532,11 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* u8TotalClassifiers; i++) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Classifier index =%d", i); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Classifier index =%d", i); psfCSType = &psfLocalSet->cConvergenceSLTypes[i]; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Classifier index =%d", i); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Classifier index =%d", i); if (psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority) curr_packinfo->bClassifierPriority = TRUE; @@ -557,20 +568,30 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* MAX_CLASSIFIERS) { nClassifierIndex = SearchFreeClsid(Adapter);
[PATCH 20/27] Staging: bcm: Replaced member accessing with variable
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 77 +++- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 9186619..20e4174 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -249,12 +249,15 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru /* UCHAR ucProtocolLength=0; */ /* ULONG ulPhsStatus; */ + struct bcm_packet_class_rules *pack_class_rule = + &psfCSType->cCPacketClassificationRule; + if (Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value == 0 || nClassifierIndex > (MAX_CLASSIFIERS-1)) return; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Storing Classifier Rule Index : %X", - ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex)); + ntohs(pack_class_rule->u16PacketClassificationRuleIndex)); if (nClassifierIndex > MAX_CLASSIFIERS-1) return; @@ -265,14 +268,14 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru pstClassifierEntry->bIpv6Protocol = (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : false; /* Destinaiton Port */ - pstClassifierEntry->ucDestPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength / 4; + pstClassifierEntry->ucDestPortRangeLength = pack_class_rule->u8ProtocolDestPortRangeLength / 4; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Length:0x%X ", pstClassifierEntry->ucDestPortRangeLength); - if (psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength <= MAX_PORT_RANGE) { + if (pack_class_rule->u8ProtocolDestPortRangeLength <= MAX_PORT_RANGE) { for (i = 0; i < (pstClassifierEntry->ucDestPortRangeLength); i++) { - pstClassifierEntry->usDestPortRangeLo[i] = *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+i)); + pstClassifierEntry->usDestPortRangeLo[i] = *((PUSHORT)(pack_class_rule->u8ProtocolDestPortRange+i)); pstClassifierEntry->usDestPortRangeHi[i] = - *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+2+i)); + *((PUSHORT)(pack_class_rule->u8ProtocolDestPortRange+2+i)); pstClassifierEntry->usDestPortRangeLo[i] = ntohs(pstClassifierEntry->usDestPortRangeLo[i]); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Lo:0x%X ", pstClassifierEntry->usDestPortRangeLo[i]); @@ -284,15 +287,15 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru /* Source Port */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Length:0x%X ", - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength); - if (psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength <= MAX_PORT_RANGE) { - pstClassifierEntry->ucSrcPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength/4; + pack_class_rule->u8ProtocolSourcePortRangeLength); + if (pack_class_rule->u8ProtocolSourcePortRangeLength <= MAX_PORT_RANGE) { + pstClassifierEntry->ucSrcPortRangeLength = pack_class_rule->u8ProtocolSourcePortRangeLength/4; for (i = 0; i < (pstClassifierEntry->ucSrcPortRangeLength); i++) { pstClassifierEntry->usSrcPortRangeLo[i] = - *((PUSHORT)(psfCSType->cCPacketClassificationRule. + *((PUSHORT)(pack_class_rule-> u8ProtocolSourcePortRange+i)); pstClassifierEntry->usSrcPortRangeHi[i] = - *((PUSHORT)(psfCSType->cCPacketClassificationRule. + *((PUSHORT)(pack_class_rule-> u8ProtocolSourcePortRange+2+i)); pstClassifierEntry->usSrcPortRangeLo[i] =
[PATCH 23/27] Staging: bcm: Replaced member accessing by variable
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 43 +-- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index d5d5a9f..7fb8568 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -139,6 +139,13 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Ip Address Range Length:0x%X ", u8IpAddressLen); if ((bIpVersion6 ? (IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2) : (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) { + + union u_ip_address *st_dest_ip = + &pstClassifierEntry->stDestIpAddress; + + union u_ip_address *st_src_ip = + &pstClassifierEntry->stSrcIpAddress; + /* * checking both the mask and address togethor in Classification. * So length will be : TotalLengthInBytes/nSizeOfIPAddressInBytes * 2 @@ -147,20 +154,20 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, if (eIpAddrContext == eDestIpAddress) { pstClassifierEntry->ucIPDestinationAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); if (bIpVersion6) { - ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv6Address; - ptrClassifierIpMask = pstClassifierEntry->stDestIpAddress.ucIpv6Mask; + ptrClassifierIpAddress = st_dest_ip->ucIpv6Address; + ptrClassifierIpMask = st_dest_ip->ucIpv6Mask; } else { - ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv4Address; - ptrClassifierIpMask = pstClassifierEntry->stDestIpAddress.ucIpv4Mask; + ptrClassifierIpAddress = st_dest_ip->ucIpv4Address; + ptrClassifierIpMask = st_dest_ip->ucIpv4Mask; } } else if (eIpAddrContext == eSrcIpAddress) { pstClassifierEntry->ucIPSourceAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); if (bIpVersion6) { - ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv6Address; - ptrClassifierIpMask = pstClassifierEntry->stSrcIpAddress.ucIpv6Mask; + ptrClassifierIpAddress = st_src_ip->ucIpv6Address; + ptrClassifierIpMask = st_src_ip->ucIpv6Mask; } else { - ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv4Address; - ptrClassifierIpMask = pstClassifierEntry->stSrcIpAddress.ucIpv4Mask; + ptrClassifierIpAddress = st_src_ip->ucIpv4Address; + ptrClassifierIpMask = st_src_ip->ucIpv4Mask; } } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Address Length:0x%X\n", pstClassifierEntry->ucIPDestinationAddressLength); @@ -172,13 +179,13 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, if (!bIpVersion6) { if (eIpAddrContext == eSrcIpAddress) { - pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i] = ntohl(pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i]); + st_src_ip->ulIpv4Addr[i] = ntohl(st_src_ip->ulIpv4Addr[i]); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Src Ip Address:0x%luX ", - pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[i]); + st_src_ip->ulIpv4Addr[i]); } else if (eIpAddrContext == eDestIpAddress) { - pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i] = ntohl(pstClassifierEntry->stDestIpAddress.ulIpv4Addr[i]); + st_dest_ip->ulIpv4Addr[i] = ntohl(st_dest_ip->ulIpv4Addr[i]); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Dest Ip Address:0x%luX ", -
[PATCH 21/27] Staging: bcm: Shortened lines in CopyClassifierRuleToSF()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 128 ++- 1 file changed, 89 insertions(+), 39 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 20e4174..94f3f15 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -241,7 +241,10 @@ void ClearTargetDSXBuffer(struct bcm_mini_adapter *Adapter, B_UINT16 TID, bool b * @ingroup ctrl_pkt_functions * copy classifier rule into the specified SF index */ -static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, struct bcm_convergence_types *psfCSType, UINT uiSearchRuleIndex, UINT nClassifierIndex) +static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, + struct bcm_convergence_types *psfCSType, + UINT uiSearchRuleIndex, + UINT nClassifierIndex) { struct bcm_classifier_rule *pstClassifierEntry = NULL; /* VOID *pvPhsContext = NULL; */ @@ -256,7 +259,8 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru nClassifierIndex > (MAX_CLASSIFIERS-1)) return; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Storing Classifier Rule Index : %X", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Storing Classifier Rule Index : %X", ntohs(pack_class_rule->u16PacketClassificationRuleIndex)); if (nClassifierIndex > MAX_CLASSIFIERS-1) @@ -265,31 +269,42 @@ static inline VOID CopyClassifierRuleToSF(struct bcm_mini_adapter *Adapter, stru pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; if (pstClassifierEntry) { /* Store if Ipv6 */ - pstClassifierEntry->bIpv6Protocol = (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : false; + pstClassifierEntry->bIpv6Protocol = + (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6) ? TRUE : false; /* Destinaiton Port */ - pstClassifierEntry->ucDestPortRangeLength = pack_class_rule->u8ProtocolDestPortRangeLength / 4; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Length:0x%X ", pstClassifierEntry->ucDestPortRangeLength); + pstClassifierEntry->ucDestPortRangeLength = + pack_class_rule->u8ProtocolDestPortRangeLength / 4; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, + "Destination Port Range Length:0x%X ", + pstClassifierEntry->ucDestPortRangeLength); if (pack_class_rule->u8ProtocolDestPortRangeLength <= MAX_PORT_RANGE) { for (i = 0; i < (pstClassifierEntry->ucDestPortRangeLength); i++) { - pstClassifierEntry->usDestPortRangeLo[i] = *((PUSHORT)(pack_class_rule->u8ProtocolDestPortRange+i)); + pstClassifierEntry->usDestPortRangeLo[i] = + *((PUSHORT)(pack_class_rule->u8ProtocolDestPortRange+i)); pstClassifierEntry->usDestPortRangeHi[i] = *((PUSHORT)(pack_class_rule->u8ProtocolDestPortRange+2+i)); - pstClassifierEntry->usDestPortRangeLo[i] = ntohs(pstClassifierEntry->usDestPortRangeLo[i]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Lo:0x%X ", + pstClassifierEntry->usDestPortRangeLo[i] = + ntohs(pstClassifierEntry->usDestPortRangeLo[i]); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + CONN_MSG, DBG_LVL_ALL, + "Destination Port Range Lo:0x%X ", pstClassifierEntry->usDestPortRangeLo[i]); - pstClassifierEntry->usDestPortRangeHi[i] = ntohs(pstClassifierEntry->usDestPortRangeHi[i]); + pstClassifierEntry->usDestPortRangeHi[i] = + ntohs(pstClassifierEntry->usDestPortRangeHi[i]); } } else { pstClassifierEntry->ucDestPortRangeLength = 0; } /* Source Port */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Length:0x%X ", + BCM
[PATCH 22/27] Staging: bcm: Shortened lines and replaced member accessing in CopyIpAddrToClassifier()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/CmHost.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 94f3f15..d5d5a9f 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -222,16 +222,20 @@ CopyIpAddrToClassifier(struct bcm_classifier_rule *pstClassifierEntry, void ClearTargetDSXBuffer(struct bcm_mini_adapter *Adapter, B_UINT16 TID, bool bFreeAll) { int i; + struct bcm_targetdsx_buffer *curr_buf; for (i = 0; i < Adapter->ulTotalTargetBuffersAvailable; i++) { - if (Adapter->astTargetDsxBuffer[i].valid) + curr_buf = &Adapter->astTargetDsxBuffer[i]; + + if (curr_buf->valid) continue; - if ((bFreeAll) || (Adapter->astTargetDsxBuffer[i].tid == TID)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "ClearTargetDSXBuffer: found tid %d buffer cleared %lx\n", - TID, Adapter->astTargetDsxBuffer[i].ulTargetDsxBuffer); - Adapter->astTargetDsxBuffer[i].valid = 1; - Adapter->astTargetDsxBuffer[i].tid = 0; + if ((bFreeAll) || (curr_buf->tid == TID)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "ClearTargetDSXBuffer: found tid %d buffer cleared %lx\n", + TID, curr_buf->ulTargetDsxBuffer); + curr_buf->valid = 1; + curr_buf->tid = 0; Adapter->ulFreeTargetBufferCnt++; } } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 07/27] Staging: bcm: Shortenend lines in GetNextTargetBufferLocation()
On 26-05-2014 11:38:25, Dan Carpenter wrote: > On Fri, May 23, 2014 at 10:23:45PM +0200, Matthias Beyer wrote: > > Signed-off-by: Matthias Beyer > > --- > > drivers/staging/bcm/CmHost.c | 14 ++ > > 1 file changed, 10 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c > > index 3f29dea..9fea9a8 100644 > > --- a/drivers/staging/bcm/CmHost.c > > +++ b/drivers/staging/bcm/CmHost.c > > @@ -1531,12 +1531,14 @@ ULONG SetUpTargetDsxBuffers(struct bcm_mini_adapter > > *Adapter) > > return 1; > > } > > > > -static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, > > B_UINT16 tid) > > +static ULONG GetNextTargetBufferLocation(struct bcm_mini_adapter *Adapter, > > + B_UINT16 tid) > > { > > ULONG dsx_buf; > > ULONG idx, max_try; > > > > - if ((Adapter->ulTotalTargetBuffersAvailable == 0) || > > (Adapter->ulFreeTargetBufferCnt == 0)) { > > + if ((Adapter->ulTotalTargetBuffersAvailable == 0) > > + || (Adapter->ulFreeTargetBufferCnt == 0)) { > > Haven't we had this discussion? The "||" goes on the first line and the > indenting needs to be lined up. I think no, we had not. But thanks, I will fix stuff like this in my next iterations and will remember your notes for the next few patchsets I want to send! -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. pgpgb9pWoxZiV.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 10/27] Staging: bcm: Shortened lines in StoreCmControlResponseMessage()
On 26-05-2014 16:08:42, Dan Carpenter wrote: > On Fri, May 23, 2014 at 10:23:48PM +0200, Matthias Beyer wrote: > > - pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), > > GFP_KERNEL); > > + pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), > > + GFP_KERNEL); > > > Line these up like this: > > pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), > GFP_KERNEL); The patchset is already committed upstream,... I will do this in my next iteration, okay? -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. pgpkO0UiJ0PZa.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/1] Staging: bcm: Line length fixes
Hi, this is a patch which fixes the line length in the drivers/staging/bcm/InterfaceMisc.c file. Regards, Matthias Beyer Matthias Beyer (1): Staging: bcm: Shortened lines drivers/staging/bcm/InterfaceMisc.c | 98 + 1 file changed, 67 insertions(+), 31 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] Staging: bcm: Shortened lines
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceMisc.c | 98 + 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index 4173fd7..e001f2a 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -11,17 +11,24 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) + && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus"); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE + || psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Bus is in suspended states hence RDM not allowed.."); return -EACCES; } psIntfAdapter->psAdapter->DeviceAccess = TRUE; @@ -40,9 +47,11 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, psIntfAdapter->psAdapter->device_removed = TRUE; if (bytes < 0) - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM failed status :%d", bytes); else - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM sent %d", bytes); psIntfAdapter->psAdapter->DeviceAccess = false; return bytes; @@ -59,17 +68,24 @@ int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus..."); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) + && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus..."); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE + || psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, + "Bus is in suspended st
[PATCH v2] Staging: bcm: Shortened lines
This patch fixes line lengths in the drivers/staging/bcm/InterfaceMisc.c file. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceMisc.c | 98 + 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index 4173fd7..e001f2a 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -11,17 +11,24 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) + && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus"); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE + || psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Bus is in suspended states hence RDM not allowed.."); return -EACCES; } psIntfAdapter->psAdapter->DeviceAccess = TRUE; @@ -40,9 +47,11 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, psIntfAdapter->psAdapter->device_removed = TRUE; if (bytes < 0) - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM failed status :%d", bytes); else - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM sent %d", bytes); psIntfAdapter->psAdapter->DeviceAccess = false; return bytes; @@ -59,17 +68,24 @@ int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus..."); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) + && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus..."); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE + || psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, +
[PATCH v2] Staging: bcm: Shortened lines
This patch fixes line lengths in the drivers/staging/bcm/InterfaceMisc.c file. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceMisc.c | 98 + 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index 4173fd7..e001f2a 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -11,17 +11,24 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) + && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus"); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE + || psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Bus is in suspended states hence RDM not allowed.."); return -EACCES; } psIntfAdapter->psAdapter->DeviceAccess = TRUE; @@ -40,9 +47,11 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, psIntfAdapter->psAdapter->device_removed = TRUE; if (bytes < 0) - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM failed status :%d", bytes); else - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM sent %d", bytes); psIntfAdapter->psAdapter->DeviceAccess = false; return bytes; @@ -59,17 +68,24 @@ int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus..."); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) + && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus..."); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE + || psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, +
[PATCH 5/7] Staging: bcm: Merged some lines which got shorter by the latest patch
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 43 +++-- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index e334ca7..19e0f17 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -396,9 +396,8 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psAd->interface_rdm = BcmRDM; psAd->interface_wrm = BcmWRM; - bytes = rdmalt(psAd, CHIP_ID_REG, - (u32 *) &(psAd->chip_id), - sizeof(u32)); + bytes = rdmalt(psAd, CHIP_ID_REG, (u32 *) &(psAd->chip_id), + sizeof(u32)); if (bytes < 0) { retval = bytes; BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0, @@ -410,7 +409,7 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psAd->chip_id &= ~0xF0; dev_info(&psIntfAdapter->udev->dev, "RDM Chip ID 0x%lx\n", - psAd->chip_id); +psAd->chip_id); iface_desc = psIntfAdapter->interface->cur_altsetting; @@ -422,26 +421,24 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) bBcm16 = TRUE; dev_info(&psIntfAdapter->udev->dev, - "number of alternate setting %d\n", - psIntfAdapter->interface->num_altsetting); +"number of alternate setting %d\n", +psIntfAdapter->interface->num_altsetting); if (bBcm16 == TRUE) { /* selecting alternate setting one as a default setting * for High Speed modem. */ if (psIntfAdapter->bHighSpeedDevice) retval = usb_set_interface(psIntfAdapter->udev, - DEFAULT_SETTING_0, - ALTERNATE_SETTING_1); - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, DRV_ENTRY, + DEFAULT_SETTING_0, + ALTERNATE_SETTING_1); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is applicable on this dongle\n"); if (retval || !psIntfAdapter->bHighSpeedDevice) { usedIntOutForBulkTransfer = EP2; endpoint = &iface_desc->endpoint[EP2].desc; - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); /* * If Modem is high speed device EP2 should be @@ -454,8 +451,7 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) !usb_endpoint_is_int_out(endpoint)) || (!psIntfAdapter->bHighSpeedDevice && !usb_endpoint_is_bulk_out(endpoint))) { - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Configuring the EEPROM\n"); /* change the EP2, EP4 to INT OUT end point */ @@ -484,25 +480,21 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) usb_endpoint_is_bulk_out(endpoint)) { /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ UINT _uiData = ntohl(EP2_CFG_INT); - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT
[PATCH 6/7] Staging: bcm: Outsourced selecting of alternate setting
This patch outsources a chunk of code which is for selecting an alternate setting for highspeed modem into a new function. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 207 +++- 1 file changed, 112 insertions(+), 95 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 19e0f17..a1fa3d5 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -374,6 +374,113 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) return 0; } +static int select_alternate_setting_for_highspeed_modem( + struct bcm_interface_adapter *psIntfAdapter, + struct usb_endpoint_descriptor **endpoint, + const struct usb_host_interface *iface_desc, + int *usedIntOutForBulkTransfer) +{ + int retval = 0; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; + + /* selecting alternate setting one as a default setting +* for High Speed modem. */ + if (psIntfAdapter->bHighSpeedDevice) + retval = usb_set_interface(psIntfAdapter->udev, + DEFAULT_SETTING_0, + ALTERNATE_SETTING_1); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, + "BCM16 is applicable on this dongle\n"); + if (retval || !psIntfAdapter->bHighSpeedDevice) { + *usedIntOutForBulkTransfer = EP2; + *endpoint = &iface_desc->endpoint[EP2].desc; + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); + /* +* If Modem is high speed device EP2 should be +* INT OUT End point +* +* If Mode is FS then EP2 should be bulk end +* point +*/ + if ((psIntfAdapter->bHighSpeedDevice && + !usb_endpoint_is_int_out(*endpoint)) || + (!psIntfAdapter->bHighSpeedDevice && +!usb_endpoint_is_bulk_out(*endpoint))) { + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Configuring the EEPROM\n"); + /* change the EP2, EP4 to INT OUT end point */ + ConfigureEndPointTypesThroughEEPROM( + psAd); + + /* +* It resets the device and if any thing +* gets changed in USB descriptor it +* will show fail and re-enumerate the +* device +*/ + retval = usb_reset_device( + psIntfAdapter->udev); + if (retval) { + BCM_DEBUG_PRINT(psAd, + DBG_TYPE_INITEXIT, + DRV_ENTRY, + DBG_LVL_ALL, + "reset failed. Re-enumerating the device.\n"); + return retval; + } + + } + if (!psIntfAdapter->bHighSpeedDevice && + usb_endpoint_is_bulk_out(*endpoint)) { + /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ + UINT _uiData = ntohl(EP2_CFG_INT); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Reverting Bulk to INT as it is in Full Speed mode.\n"); + BeceemEEPROMBulkWrite(psAd, + (PUCHAR) & _uiData, + 0x136, 4, TRUE); + } + } else { + *usedIntOutForBulkTransfer = EP4; + *endpoint = &iface_desc->endpoint[EP4].desc; + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Choosing AltSetting as a default setting.\n"); + if (!usb_endpoint_is_int_out(*endpoint)) { + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DB
[PATCH 1/7] Staging: bcm: Shortened some lines
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 7c04c73..d61a688 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -70,7 +70,8 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) AdapterFree(psIntfAdapter->psAdapter); } -static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter *Adapter) +static void ConfigureEndPointTypesThroughEEPROM( + struct bcm_mini_adapter *Adapter) { u32 ulReg; int bytes; @@ -147,7 +148,8 @@ static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter *Adapter BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C2, 4, TRUE); } -static int usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id) +static int usbbcm_device_probe(struct usb_interface *intf, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); int retval; -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/7] Staging: bcm: Shortened some lines in select_alternate_setting_for_highspeed_modem()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 47 ++--- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index a1fa3d5..ea19436 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -389,14 +389,12 @@ static int select_alternate_setting_for_highspeed_modem( retval = usb_set_interface(psIntfAdapter->udev, DEFAULT_SETTING_0, ALTERNATE_SETTING_1); - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is applicable on this dongle\n"); if (retval || !psIntfAdapter->bHighSpeedDevice) { *usedIntOutForBulkTransfer = EP2; *endpoint = &iface_desc->endpoint[EP2].desc; - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); /* * If Modem is high speed device EP2 should be @@ -409,8 +407,8 @@ static int select_alternate_setting_for_highspeed_modem( !usb_endpoint_is_int_out(*endpoint)) || (!psIntfAdapter->bHighSpeedDevice && !usb_endpoint_is_bulk_out(*endpoint))) { - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, "Configuring the EEPROM\n"); /* change the EP2, EP4 to INT OUT end point */ ConfigureEndPointTypesThroughEEPROM( @@ -422,13 +420,10 @@ static int select_alternate_setting_for_highspeed_modem( * will show fail and re-enumerate the * device */ - retval = usb_reset_device( - psIntfAdapter->udev); + retval = usb_reset_device(psIntfAdapter->udev); if (retval) { - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, - DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, "reset failed. Re-enumerating the device.\n"); return retval; } @@ -438,26 +433,23 @@ static int select_alternate_setting_for_highspeed_modem( usb_endpoint_is_bulk_out(*endpoint)) { /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ UINT _uiData = ntohl(EP2_CFG_INT); - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, "Reverting Bulk to INT as it is in Full Speed mode.\n"); - BeceemEEPROMBulkWrite(psAd, - (PUCHAR) & _uiData, - 0x136, 4, TRUE); + BeceemEEPROMBulkWrite(psAd, (PUCHAR) & _uiData, 0x136, + 4, TRUE); } } else { *usedIntOutForBulkTransfer = EP4; *endpoint = &iface_desc->endpoint[EP4].desc; - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Choosing AltSetting as a default setting.\n"); if (!usb_endpoint_is_int_out(*endpoint)) { - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, +
[PATCH 2/7] Staging: bcm: replaced member accessing by variable
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index d61a688..539f830 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -28,28 +28,28 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *Adapter); static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) { int i = 0; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; /* Wake up the wait_queue... */ - if (psIntfAdapter->psAdapter->LEDInfo.led_thread_running & + if (psAd->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) { - psIntfAdapter->psAdapter->DriverState = DRIVER_HALT; - wake_up(&psIntfAdapter->psAdapter->LEDInfo.notify_led_event); + psAd->DriverState = DRIVER_HALT; + wake_up(&psAd->LEDInfo.notify_led_event); } - reset_card_proc(psIntfAdapter->psAdapter); + reset_card_proc(psAd); /* * worst case time taken by the RDM/WRM will be 5 sec. will check after * every 100 ms to accertain the device is not being accessed. After * this No RDM/WRM should be made. */ - while (psIntfAdapter->psAdapter->DeviceAccess) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + while (psAd->DeviceAccess) { + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Device is being accessed.\n"); msleep(100); } /* Free interrupt URB */ - /* psIntfAdapter->psAdapter->device_removed = TRUE; */ + /* psAd->device_removed = TRUE; */ usb_free_urb(psIntfAdapter->psInterruptUrb); /* Free transmit URBs */ @@ -67,7 +67,7 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) psIntfAdapter->asUsbRcb[i].urb = NULL; } } - AdapterFree(psIntfAdapter->psAdapter); + AdapterFree(psAd); } static void ConfigureEndPointTypesThroughEEPROM( -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/7] Cleanup patches for bcm staging driver
Hi, I did some cleanup patches on the drivers/staging/bcm/InterfaceInit.c file. I hope you like them. The cleanup contains: * Line shortenings * Merging of multi-line statements which fit in one line * Replacing member-accessing with variables * Outsourcing a code junk into a seperate function Please notice: I cannot test these patches. I compiled them successfully, but for testing I do not have the appropriate hardware. Kind regards, Matthias Beyer Matthias Beyer (7): Staging: bcm: Shortened some lines Staging: bcm: replaced member accessing by variable Staging: bcm: Replaced member accessing with variable in device_run() Staging: bcm: Replaced member accessing with variable in InterfaceAdapterInit() Staging: bcm: Merged some lines which got shorter by the latest patch Staging: bcm: Outsourced selecting of alternate setting Staging: bcm: Shortened some lines in select_alternate_setting_for_highspeed_modem() drivers/staging/bcm/InterfaceInit.c | 284 ++-- 1 file changed, 141 insertions(+), 143 deletions(-) -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/7] Staging: bcm: Replaced member accessing with variable in device_run()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 539f830..ab4c65a 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -340,16 +340,16 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) { int value = 0; UINT status = STATUS_SUCCESS; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; - status = InitCardAndDownloadFirmware(psIntfAdapter->psAdapter); + status = InitCardAndDownloadFirmware(psAd); if (status != STATUS_SUCCESS) { pr_err(DRV_NAME "InitCardAndDownloadFirmware failed.\n"); return status; } - if (psIntfAdapter->psAdapter->fw_download_done) { + if (psAd->fw_download_done) { if (StartInterruptUrb(psIntfAdapter)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, - DBG_TYPE_INITEXIT, DRV_ENTRY, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Cannot send interrupt in URB\n"); } @@ -358,17 +358,15 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) * now register the cntrl interface. after downloading the f/w * waiting for 5 sec to get the mailbox interrupt. */ - psIntfAdapter->psAdapter->waiting_to_fw_download_done = false; - value = wait_event_timeout( - psIntfAdapter->psAdapter->ioctl_fw_dnld_wait_queue, - psIntfAdapter->psAdapter->waiting_to_fw_download_done, - 5 * HZ); + psAd->waiting_to_fw_download_done = false; + value = wait_event_timeout(psAd->ioctl_fw_dnld_wait_queue, + psAd->waiting_to_fw_download_done, + 5 * HZ); if (value == 0) pr_err(DRV_NAME ": Timeout waiting for mailbox interrupt.\n"); - if (register_control_device_interface( - psIntfAdapter->psAdapter) < 0) { + if (register_control_device_interface(psAd) < 0) { pr_err(DRV_NAME ": Register Control Device failed.\n"); return -EIO; } -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/7] Staging: bcm: Replaced member accessing with variable in InterfaceAdapterInit()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 53 +++-- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index ab4c65a..e334ca7 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -385,6 +385,7 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) bool bBcm16 = false; UINT uiData = 0; int bytes; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; /* Store the usb dev into interface adapter */ psIntfAdapter->udev = @@ -392,31 +393,31 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psIntfAdapter->bHighSpeedDevice = (psIntfAdapter->udev->speed == USB_SPEED_HIGH); - psIntfAdapter->psAdapter->interface_rdm = BcmRDM; - psIntfAdapter->psAdapter->interface_wrm = BcmWRM; + psAd->interface_rdm = BcmRDM; + psAd->interface_wrm = BcmWRM; - bytes = rdmalt(psIntfAdapter->psAdapter, CHIP_ID_REG, - (u32 *) &(psIntfAdapter->psAdapter->chip_id), + bytes = rdmalt(psAd, CHIP_ID_REG, + (u32 *) &(psAd->chip_id), sizeof(u32)); if (bytes < 0) { retval = bytes; - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0, "CHIP ID Read Failed\n"); return retval; } - if (0xbece3200 == (psIntfAdapter->psAdapter->chip_id & ~(0xF0))) - psIntfAdapter->psAdapter->chip_id &= ~0xF0; + if (0xbece3200 == (psAd->chip_id & ~(0xF0))) + psAd->chip_id &= ~0xF0; dev_info(&psIntfAdapter->udev->dev, "RDM Chip ID 0x%lx\n", - psIntfAdapter->psAdapter->chip_id); + psAd->chip_id); iface_desc = psIntfAdapter->interface->cur_altsetting; - if (psIntfAdapter->psAdapter->chip_id == T3B) { + if (psAd->chip_id == T3B) { /* T3B device will have EEPROM, check if EEPROM is proper and * BCM16 can be done or not. */ - BeceemEEPROMBulkRead(psIntfAdapter->psAdapter, &uiData, 0x0, 4); + BeceemEEPROMBulkRead(psAd, &uiData, 0x0, 4); if (uiData == BECM) bBcm16 = TRUE; @@ -431,14 +432,14 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) retval = usb_set_interface(psIntfAdapter->udev, DEFAULT_SETTING_0, ALTERNATE_SETTING_1); - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is applicable on this dongle\n"); if (retval || !psIntfAdapter->bHighSpeedDevice) { usedIntOutForBulkTransfer = EP2; endpoint = &iface_desc->endpoint[EP2].desc; - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); @@ -453,13 +454,13 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) !usb_endpoint_is_int_out(endpoint)) || (!psIntfAdapter->bHighSpeedDevice && !usb_endpoint_is_bulk_out(endpoint))) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Configuring the EEPROM\n"); /* change the EP2, EP4 to INT OUT end point */ ConfigureEndPointTypesThroughEEPROM( -
[PATCH 3/6] Staging: bcm: Lines shortened in ddr_init()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/DDRInit.c | 176 -- 1 file changed, 134 insertions(+), 42 deletions(-) diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index 4c7f518..cfaa2c1 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -818,15 +818,21 @@ int ddr_init(struct bcm_mini_adapter *Adapter) if ((Adapter->chip_id != BCS220_2) && (Adapter->chip_id != BCS220_2BC) && (Adapter->chip_id != BCS220_3)) { - retval = rdmalt(Adapter, (UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); + retval = rdmalt(Adapter, (UINT)0x0f000830, &uiResetValue, + sizeof(uiResetValue)); if (retval < 0) { - BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); + BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, + "%s:%d RDM failed\n", + __func__, __LINE__); return retval; } uiResetValue |= 0x44; - retval = wrmalt(Adapter, (UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); + retval = wrmalt(Adapter, (UINT)0x0f000830, &uiResetValue, + sizeof(uiResetValue)); if (retval < 0) { - BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); + BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, + "%s:%d RDM failed\n", + __func__, __LINE__); return retval; } } @@ -857,7 +863,8 @@ int ddr_init(struct bcm_mini_adapter *Adapter) case DDR_160_MHZ: psDDRSetting = asT3LPB_DDRSetting160MHz; - RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(struct bcm_ddr_setting); + RegCount = sizeof(asT3LPB_DDRSetting160MHz) / + sizeof(struct bcm_ddr_setting); if (Adapter->bMipsConfig == MIPS_200_MHZ) uiClockSetting = 0x03F137D2; @@ -871,7 +878,8 @@ int ddr_init(struct bcm_mini_adapter *Adapter) case 0xbece0121: case 0xbece0130: case 0xbece0300: - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "DDR Setting: %x\n", Adapter->DDRSetting); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, + "DDR Setting: %x\n", Adapter->DDRSetting); switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3_DDRSetting80MHz; @@ -933,15 +941,19 @@ int ddr_init(struct bcm_mini_adapter *Adapter) } value = 0; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Register Count is =%lu\n", RegCount); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, + "Register Count is =%lu\n", RegCount); while (RegCount && !retval) { - if (uiClockSetting && psDDRSetting->ulRegAddress == MIPS_CLOCK_REG) + if (uiClockSetting + && psDDRSetting->ulRegAddress == MIPS_CLOCK_REG) value = uiClockSetting; else value = psDDRSetting->ulRegValue; - retval = wrmalt(Adapter, psDDRSetting->ulRegAddress, &value, sizeof(value)); + retval = wrmalt(Adapter, psDDRSetting->ulRegAddress, &value, + sizeof(value)); if (STATUS_SUCCESS != retval) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "%s:%d\n", __func__, __LINE__); break; } @@ -957,27 +969,47 @@ int ddr_init(struct bcm_mini_adapter *Adapter) (Adapter->chip_id != BCS220_3)) { /* drive MDDR to half in case of UMA-B: */ uiResetValue = 0x01010001; - retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue)); + retval = wrmalt(Adapter, (UINT)0x0F007018, + &uiResetValue, sizeof(uiResetValue));
[PATCH 6/6] Staging: bcm: Lines shortened in download_ddr_settings()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/DDRInit.c | 31 +-- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index 423bfd9..4564f40 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -1159,7 +1159,8 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) { struct bcm_ddr_setting *psDDRSetting = NULL; ULONG RegCount = 0; - unsigned long ul_ddr_setting_load_addr = DDR_DUMP_INTERNAL_DEVICE_MEMORY; + unsigned long ul_ddr_setting_load_addr = + DDR_DUMP_INTERNAL_DEVICE_MEMORY; UINT value = 0; int retval = STATUS_SUCCESS; bool bOverrideSelfRefresh = false; @@ -1283,18 +1284,22 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) } /* total number of Register that has to be dumped */ value = RegCount; - retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); + retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, + sizeof(value)); if (retval) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "%s:%d\n", __func__, __LINE__); return retval; } ul_ddr_setting_load_addr += sizeof(ULONG); /* signature */ value = (0x1d1e0dd0); - retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); + retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, + sizeof(value)); if (retval) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "%s:%d\n", __func__, __LINE__); return retval; } @@ -1303,17 +1308,23 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) while (RegCount && !retval) { value = psDDRSetting->ulRegAddress; - retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); + retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, + sizeof(value)); ul_ddr_setting_load_addr += sizeof(ULONG); if (!retval) { - if (bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) + if (bOverrideSelfRefresh + && (psDDRSetting->ulRegAddress + == 0x0F007018)) value = (psDDRSetting->ulRegValue | (1<<8)); else value = psDDRSetting->ulRegValue; - if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, - &value, sizeof(value))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); + if (STATUS_SUCCESS != wrmalt(Adapter, +ul_ddr_setting_load_addr, +&value, +sizeof(value))) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "%s:%d\n", __func__, __LINE__); break; } } -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/6] Staging: bcm: Misc whitespace fixes
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/DDRInit.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index f1d7cb8..b4f0ea3 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -776,7 +776,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter) struct bcm_ddr_setting *psDDRSetting = NULL; ULONG RegCount = 0; UINT value = 0; - UINT uiResetValue = 0; + UINT uiResetValue = 0; UINT uiClockSetting = 0; int retval = STATUS_SUCCESS; @@ -1068,7 +1068,7 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) struct bcm_ddr_setting *psDDRSetting = NULL; ULONG RegCount = 0; unsigned long ul_ddr_setting_load_addr = DDR_DUMP_INTERNAL_DEVICE_MEMORY; - UINT value = 0; + UINT value = 0; int retval = STATUS_SUCCESS; bool bOverrideSelfRefresh = false; @@ -1222,9 +1222,9 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) break; } } else { - value = psDDRSetting->ulRegValue; + value = psDDRSetting->ulRegValue; - if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr , + if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value))) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); break; @@ -1235,5 +1235,5 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) RegCount--; psDDRSetting++; } - return retval; + return retval; } -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/6] Staging: bcm: Fixed indention for inner if-block
The inner if-statement was aligned just like the outer one. Why? This indention was introduced by f34c488c3894968e8cdbdc3b1ed617d78315cace which is a indention-fix patch itself. That's why I'm curious about it. I did not merge these nested if-statements, as I don't know if I'm destroying logical seperated checks with it. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/DDRInit.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index cfaa2c1..d13cb49 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -1308,11 +1308,11 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) if (!retval) { if (bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) { value = (psDDRSetting->ulRegValue | (1<<8)); - if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, - &value, sizeof(value))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); - break; - } + if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, + &value, sizeof(value))) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); + break; + } } else { value = psDDRSetting->ulRegValue; -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/6] Staging: bcm: Moved doubled if-block
This patch moves the doubled if block inside the retval-checking one level up. As the if-else-block it was in is now a one-statement if-else block, I removed the braces from it. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/DDRInit.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index d13cb49..423bfd9 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -1306,21 +1306,15 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); ul_ddr_setting_load_addr += sizeof(ULONG); if (!retval) { - if (bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) { + if (bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) value = (psDDRSetting->ulRegValue | (1<<8)); - if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, - &value, sizeof(value))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); - break; - } - } else { + else value = psDDRSetting->ulRegValue; - if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, + if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); - break; - } + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); + break; } } ul_ddr_setting_load_addr += sizeof(ULONG); -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/6] Cleanup patches for bcm staging driver, DDRInit.c file
Hi, These are some patches for the drivers/staging/bcm/DDRInit.c file. The patchset contains: * Indention/Whitespace fixes * Line length fixes * Simplifying of logic Please notice: I'm not able to test these patches, as I do not have the appropriate hardware. I compiled them, at least. Kind regards, Matthias Beyer Matthias Beyer (6): Staging: bcm: Misc whitespace fixes Staging: bcm: Indentation fixes Staging: bcm: Lines shortened in ddr_init() Staging: bcm: Fixed indention for inner if-block Staging: bcm: Moved doubled if-block Staging: bcm: Lines shortened in download_ddr_settings() drivers/staging/bcm/DDRInit.c | 279 -- 1 file changed, 188 insertions(+), 91 deletions(-) -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/6] Staging: bcm: Indentation fixes
This patch fixes some indentation errors, where multi-line statements where not indented. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/DDRInit.c | 56 +-- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index b4f0ea3..4c7f518 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -785,18 +785,18 @@ int ddr_init(struct bcm_mini_adapter *Adapter) switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3LP_DDRSetting80MHz; - RegCount = (sizeof(asT3LP_DDRSetting80MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3LP_DDRSetting80MHz) / + sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: psDDRSetting = asT3LP_DDRSetting100MHz; - RegCount = (sizeof(asT3LP_DDRSetting100MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3LP_DDRSetting100MHz) / + sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: psDDRSetting = asT3LP_DDRSetting133MHz; - RegCount = (sizeof(asT3LP_DDRSetting133MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3LP_DDRSetting133MHz) / + sizeof(struct bcm_ddr_setting)); if (Adapter->bMipsConfig == MIPS_200_MHZ) uiClockSetting = 0x03F13652; else @@ -836,18 +836,18 @@ int ddr_init(struct bcm_mini_adapter *Adapter) case DDR_80_MHZ: psDDRSetting = asT3LPB_DDRSetting80MHz; - RegCount = (sizeof(asT3B_DDRSetting80MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3B_DDRSetting80MHz) / + sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: psDDRSetting = asT3LPB_DDRSetting100MHz; - RegCount = (sizeof(asT3B_DDRSetting100MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3B_DDRSetting100MHz) / + sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: psDDRSetting = asT3LPB_DDRSetting133MHz; - RegCount = (sizeof(asT3B_DDRSetting133MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3B_DDRSetting133MHz) / + sizeof(struct bcm_ddr_setting)); if (Adapter->bMipsConfig == MIPS_200_MHZ) uiClockSetting = 0x03F13652; @@ -875,18 +875,18 @@ int ddr_init(struct bcm_mini_adapter *Adapter) switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3_DDRSetting80MHz; - RegCount = (sizeof(asT3_DDRSetting80MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3_DDRSetting80MHz) / + sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: psDDRSetting = asT3_DDRSetting100MHz; - RegCount = (sizeof(asT3_DDRSetting100MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3_DDRSetting100MHz) / + sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: psDDRSetting = asT3_DDRSetting133MHz; - RegCount = (sizeof(asT3_DDRSetting133MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3_DDRSetting133MHz) / + sizeof(struct bcm_ddr_setting)); break; default: return -EINVAL; @@ -896,26 +896,26 @@ int ddr_init(struct bcm_mini_adapter *Adapter) switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3B_DDRSetting80MHz; - RegCount = (sizeof(asT3B_DDRSetting80MHz)/ - sizeof(struct bcm_ddr_setting)); + RegCount = (sizeof(asT3B_DDRSetting80MHz) / +
[PATCH v3 0/2] Staging: bcm: InterfaceMisc.c file cleanup
Hi, I reworked what Dan suggested. I also added another patch which outsources a chunk of code from the InterfaceRDM() and InterfaceRWM() functions, which was doubled. I missed that one in the first place. I hope you like the changes. Kind regards, Matthias Beyer Matthias Beyer (2): Staging: bcm: Shortened lines Staging: bcm: InterfaceMisc.c: Outsourced doubled error checking drivers/staging/bcm/InterfaceMisc.c | 124 +++- 1 file changed, 78 insertions(+), 46 deletions(-) -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/2] Staging: bcm: Shortened lines
This patch fixes line lengths in the drivers/staging/bcm/InterfaceMisc.c file. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceMisc.c | 98 + 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index 4173fd7..fff7d68 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -11,17 +11,24 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && + (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus"); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE || + psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Bus is in suspended states hence RDM not allowed.."); return -EACCES; } psIntfAdapter->psAdapter->DeviceAccess = TRUE; @@ -40,9 +47,11 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, psIntfAdapter->psAdapter->device_removed = TRUE; if (bytes < 0) - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM failed status :%d", bytes); else - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM sent %d", bytes); psIntfAdapter->psAdapter->DeviceAccess = false; return bytes; @@ -59,17 +68,24 @@ int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus..."); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && + (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus..."); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE || + psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, +
[PATCH v3 2/2] Staging: bcm: InterfaceMisc.c: Outsourced doubled error checking
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceMisc.c | 74 ++--- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index fff7d68..51f6e1f 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -1,36 +1,49 @@ #include "headers.h" +static int adapter_err_check(const struct bcm_interface_adapter *ad, int *err) +{ + if (ad->psAdapter->device_removed == TRUE) { + BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); + *err = -ENODEV; + return 1; + } + + if ((ad->psAdapter->StopAllXaction == TRUE) && + (ad->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus"); + *err = -EACCES; + return 1; + } + + if (ad->bSuspended == TRUE || ad->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Bus is in suspended states hence RDM not allowed.."); + *err = -EACCES; + return 1; + } + + return 0; +} + int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, unsigned int addr, void *buff, int len) { int bytes; + int err = 0; if (!psIntfAdapter) return -EINVAL; - if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, - "Device got removed"); - return -ENODEV; - } - - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && - (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, - DBG_LVL_ALL, - "Currently Xaction is not allowed on the bus"); - return -EACCES; + if (adapter_err_check(psIntfAdapter, &err)) { + return err; } - if (psIntfAdapter->bSuspended == TRUE || - psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, - DBG_LVL_ALL, - "Bus is in suspended states hence RDM not allowed.."); - return -EACCES; - } psIntfAdapter->psAdapter->DeviceAccess = TRUE; bytes = usb_control_msg(psIntfAdapter->udev, @@ -63,30 +76,13 @@ int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter, int len) { int retval = 0; + int err = 0; if (!psIntfAdapter) return -EINVAL; - if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, - "Device got removed"); - return -ENODEV; - } - - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && - (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, - DBG_LVL_ALL, - "Currently Xaction is not allowed on the bus..."); - return -EACCES; - } - - if (psIntfAdapter->bSuspended == TRUE || - psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, - DBG_LVL_ALL, - "Bus is in suspended states hence RDM not allowed.."); - return -EACCES; + if (adapter_err_check(psIntfAdapter, &err)) { + return err; } psIntfAdapter->psAdapter->DeviceAccess = TRUE; -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 6/7] Staging: bcm: Outsourced selecting of alternate setting
This patch outsources a chunk of code which is for selecting an alternate setting for highspeed modem into a new function. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 207 +++- 1 file changed, 112 insertions(+), 95 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 3fb8f4a..c7a2afe 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -374,6 +374,113 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) return 0; } +static int select_alternate_setting_for_highspeed_modem( + struct bcm_interface_adapter *psIntfAdapter, + struct usb_endpoint_descriptor **endpoint, + const struct usb_host_interface *iface_desc, + int *usedIntOutForBulkTransfer) +{ + int retval = 0; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; + + /* selecting alternate setting one as a default setting +* for High Speed modem. */ + if (psIntfAdapter->bHighSpeedDevice) + retval = usb_set_interface(psIntfAdapter->udev, + DEFAULT_SETTING_0, + ALTERNATE_SETTING_1); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, + "BCM16 is applicable on this dongle\n"); + if (retval || !psIntfAdapter->bHighSpeedDevice) { + *usedIntOutForBulkTransfer = EP2; + *endpoint = &iface_desc->endpoint[EP2].desc; + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); + /* +* If Modem is high speed device EP2 should be +* INT OUT End point +* +* If Mode is FS then EP2 should be bulk end +* point +*/ + if ((psIntfAdapter->bHighSpeedDevice && + !usb_endpoint_is_int_out(*endpoint)) || + (!psIntfAdapter->bHighSpeedDevice && +!usb_endpoint_is_bulk_out(*endpoint))) { + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Configuring the EEPROM\n"); + /* change the EP2, EP4 to INT OUT end point */ + ConfigureEndPointTypesThroughEEPROM( + psAd); + + /* +* It resets the device and if any thing +* gets changed in USB descriptor it +* will show fail and re-enumerate the +* device +*/ + retval = usb_reset_device( + psIntfAdapter->udev); + if (retval) { + BCM_DEBUG_PRINT(psAd, + DBG_TYPE_INITEXIT, + DRV_ENTRY, + DBG_LVL_ALL, + "reset failed. Re-enumerating the device.\n"); + return retval; + } + + } + if (!psIntfAdapter->bHighSpeedDevice && + usb_endpoint_is_bulk_out(*endpoint)) { + /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ + UINT _uiData = ntohl(EP2_CFG_INT); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Reverting Bulk to INT as it is in Full Speed mode.\n"); + BeceemEEPROMBulkWrite(psAd, + (PUCHAR) & _uiData, + 0x136, 4, TRUE); + } + } else { + *usedIntOutForBulkTransfer = EP4; + *endpoint = &iface_desc->endpoint[EP4].desc; + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Choosing AltSetting as a default setting.\n"); + if (!usb_endpoint_is_int_out(*endpoint)) { + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DB
[PATCH v2 1/7] Staging: bcm: Shortened some lines
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 7c04c73..d61a688 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -70,7 +70,8 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) AdapterFree(psIntfAdapter->psAdapter); } -static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter *Adapter) +static void ConfigureEndPointTypesThroughEEPROM( + struct bcm_mini_adapter *Adapter) { u32 ulReg; int bytes; @@ -147,7 +148,8 @@ static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter *Adapter BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C2, 4, TRUE); } -static int usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id) +static int usbbcm_device_probe(struct usb_interface *intf, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); int retval; -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 5/7] Staging: bcm: Merged some lines which got shorter by the latest patch
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 43 +++-- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 4c26de1..3fb8f4a 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -396,9 +396,8 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psAd->interface_rdm = BcmRDM; psAd->interface_wrm = BcmWRM; - bytes = rdmalt(psAd, CHIP_ID_REG, - (u32 *) &(psAd->chip_id), - sizeof(u32)); + bytes = rdmalt(psAd, CHIP_ID_REG, (u32 *) &(psAd->chip_id), + sizeof(u32)); if (bytes < 0) { retval = bytes; BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0, @@ -410,7 +409,7 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psAd->chip_id &= ~0xF0; dev_info(&psIntfAdapter->udev->dev, "RDM Chip ID 0x%lx\n", - psAd->chip_id); +psAd->chip_id); iface_desc = psIntfAdapter->interface->cur_altsetting; @@ -422,26 +421,24 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) bBcm16 = TRUE; dev_info(&psIntfAdapter->udev->dev, - "number of alternate setting %d\n", - psIntfAdapter->interface->num_altsetting); +"number of alternate setting %d\n", +psIntfAdapter->interface->num_altsetting); if (bBcm16 == TRUE) { /* selecting alternate setting one as a default setting * for High Speed modem. */ if (psIntfAdapter->bHighSpeedDevice) retval = usb_set_interface(psIntfAdapter->udev, - DEFAULT_SETTING_0, - ALTERNATE_SETTING_1); - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, DRV_ENTRY, + DEFAULT_SETTING_0, + ALTERNATE_SETTING_1); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is applicable on this dongle\n"); if (retval || !psIntfAdapter->bHighSpeedDevice) { usedIntOutForBulkTransfer = EP2; endpoint = &iface_desc->endpoint[EP2].desc; - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); /* * If Modem is high speed device EP2 should be @@ -454,8 +451,7 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) !usb_endpoint_is_int_out(endpoint)) || (!psIntfAdapter->bHighSpeedDevice && !usb_endpoint_is_bulk_out(endpoint))) { - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Configuring the EEPROM\n"); /* change the EP2, EP4 to INT OUT end point */ @@ -484,25 +480,21 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) usb_endpoint_is_bulk_out(endpoint)) { /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ UINT _uiData = ntohl(EP2_CFG_INT); - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT
[PATCH v2 4/7] Staging: bcm: Replaced member accessing with variable in InterfaceAdapterInit()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 53 +++-- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index b6238f0..4c26de1 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -385,6 +385,7 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) bool bBcm16 = false; UINT uiData = 0; int bytes; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; /* Store the usb dev into interface adapter */ psIntfAdapter->udev = @@ -392,31 +393,31 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) psIntfAdapter->bHighSpeedDevice = (psIntfAdapter->udev->speed == USB_SPEED_HIGH); - psIntfAdapter->psAdapter->interface_rdm = BcmRDM; - psIntfAdapter->psAdapter->interface_wrm = BcmWRM; + psAd->interface_rdm = BcmRDM; + psAd->interface_wrm = BcmWRM; - bytes = rdmalt(psIntfAdapter->psAdapter, CHIP_ID_REG, - (u32 *) &(psIntfAdapter->psAdapter->chip_id), + bytes = rdmalt(psAd, CHIP_ID_REG, + (u32 *) &(psAd->chip_id), sizeof(u32)); if (bytes < 0) { retval = bytes; - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0, "CHIP ID Read Failed\n"); return retval; } - if (0xbece3200 == (psIntfAdapter->psAdapter->chip_id & ~(0xF0))) - psIntfAdapter->psAdapter->chip_id &= ~0xF0; + if (0xbece3200 == (psAd->chip_id & ~(0xF0))) + psAd->chip_id &= ~0xF0; dev_info(&psIntfAdapter->udev->dev, "RDM Chip ID 0x%lx\n", - psIntfAdapter->psAdapter->chip_id); + psAd->chip_id); iface_desc = psIntfAdapter->interface->cur_altsetting; - if (psIntfAdapter->psAdapter->chip_id == T3B) { + if (psAd->chip_id == T3B) { /* T3B device will have EEPROM, check if EEPROM is proper and * BCM16 can be done or not. */ - BeceemEEPROMBulkRead(psIntfAdapter->psAdapter, &uiData, 0x0, 4); + BeceemEEPROMBulkRead(psAd, &uiData, 0x0, 4); if (uiData == BECM) bBcm16 = TRUE; @@ -431,14 +432,14 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) retval = usb_set_interface(psIntfAdapter->udev, DEFAULT_SETTING_0, ALTERNATE_SETTING_1); - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is applicable on this dongle\n"); if (retval || !psIntfAdapter->bHighSpeedDevice) { usedIntOutForBulkTransfer = EP2; endpoint = &iface_desc->endpoint[EP2].desc; - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); @@ -453,13 +454,13 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *psIntfAdapter) !usb_endpoint_is_int_out(endpoint)) || (!psIntfAdapter->bHighSpeedDevice && !usb_endpoint_is_bulk_out(endpoint))) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Configuring the EEPROM\n"); /* change the EP2, EP4 to INT OUT end point */ ConfigureEndPointTypesThroughEEPROM( -
[PATCH v2 7/7] Staging: bcm: Shortened some lines in select_alternate_setting_for_highspeed_modem()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 47 ++--- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index c7a2afe..b51f4e8 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -389,14 +389,12 @@ static int select_alternate_setting_for_highspeed_modem( retval = usb_set_interface(psIntfAdapter->udev, DEFAULT_SETTING_0, ALTERNATE_SETTING_1); - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is applicable on this dongle\n"); if (retval || !psIntfAdapter->bHighSpeedDevice) { *usedIntOutForBulkTransfer = EP2; *endpoint = &iface_desc->endpoint[EP2].desc; - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); /* * If Modem is high speed device EP2 should be @@ -409,8 +407,8 @@ static int select_alternate_setting_for_highspeed_modem( !usb_endpoint_is_int_out(*endpoint)) || (!psIntfAdapter->bHighSpeedDevice && !usb_endpoint_is_bulk_out(*endpoint))) { - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, "Configuring the EEPROM\n"); /* change the EP2, EP4 to INT OUT end point */ ConfigureEndPointTypesThroughEEPROM( @@ -422,13 +420,10 @@ static int select_alternate_setting_for_highspeed_modem( * will show fail and re-enumerate the * device */ - retval = usb_reset_device( - psIntfAdapter->udev); + retval = usb_reset_device(psIntfAdapter->udev); if (retval) { - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, - DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, "reset failed. Re-enumerating the device.\n"); return retval; } @@ -438,26 +433,23 @@ static int select_alternate_setting_for_highspeed_modem( usb_endpoint_is_bulk_out(*endpoint)) { /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ UINT _uiData = ntohl(EP2_CFG_INT); - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, "Reverting Bulk to INT as it is in Full Speed mode.\n"); - BeceemEEPROMBulkWrite(psAd, - (PUCHAR) & _uiData, - 0x136, 4, TRUE); + BeceemEEPROMBulkWrite(psAd, (PUCHAR) & _uiData, 0x136, + 4, TRUE); } } else { *usedIntOutForBulkTransfer = EP4; *endpoint = &iface_desc->endpoint[EP4].desc; - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Choosing AltSetting as a default setting.\n"); if (!usb_endpoint_is_int_out(*endpoint)) { - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, +
[PATCH v2 0/7] Cleanup patches for bcm staging driver
Hi, I fixed what Dan suggested. Please notice: I cannot test these patches. I compiled them successfully, but for testing I do not have the appropriate hardware. Kind regards, Matthias Beyer Matthias Beyer (7): Staging: bcm: Shortened some lines Staging: bcm: replaced member accessing by variable Staging: bcm: Replaced member accessing with variable in device_run() Staging: bcm: Replaced member accessing with variable in InterfaceAdapterInit() Staging: bcm: Merged some lines which got shorter by the latest patch Staging: bcm: Outsourced selecting of alternate setting Staging: bcm: Shortened some lines in select_alternate_setting_for_highspeed_modem() drivers/staging/bcm/InterfaceInit.c | 284 ++-- 1 file changed, 141 insertions(+), 143 deletions(-) -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/7] Staging: bcm: replaced member accessing by variable
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index d61a688..039408d 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -28,28 +28,28 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *Adapter); static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) { int i = 0; + struct bcm_mini_adapter *ps_ad = psIntfAdapter->ps_adapter; /* Wake up the wait_queue... */ - if (psIntfAdapter->psAdapter->LEDInfo.led_thread_running & + if (ps_ad->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) { - psIntfAdapter->psAdapter->DriverState = DRIVER_HALT; - wake_up(&psIntfAdapter->psAdapter->LEDInfo.notify_led_event); + ps_ad->DriverState = DRIVER_HALT; + wake_up(&ps_ad->LEDInfo.notify_led_event); } - reset_card_proc(psIntfAdapter->psAdapter); + reset_card_proc(ps_ad); /* * worst case time taken by the RDM/WRM will be 5 sec. will check after * every 100 ms to accertain the device is not being accessed. After * this No RDM/WRM should be made. */ - while (psIntfAdapter->psAdapter->DeviceAccess) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + while (ps_ad->DeviceAccess) { + BCM_DEBUG_PRINT(ps_ad, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Device is being accessed.\n"); msleep(100); } /* Free interrupt URB */ - /* psIntfAdapter->psAdapter->device_removed = TRUE; */ + /* ps_ad->device_removed = TRUE; */ usb_free_urb(psIntfAdapter->psInterruptUrb); /* Free transmit URBs */ @@ -67,7 +67,7 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) psIntfAdapter->asUsbRcb[i].urb = NULL; } } - AdapterFree(psIntfAdapter->psAdapter); + AdapterFree(ps_ad); } static void ConfigureEndPointTypesThroughEEPROM( -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/7] Staging: bcm: Replaced member accessing with variable in device_run()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 039408d..b6238f0 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -340,16 +340,16 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) { int value = 0; UINT status = STATUS_SUCCESS; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; - status = InitCardAndDownloadFirmware(psIntfAdapter->psAdapter); + status = InitCardAndDownloadFirmware(psAd); if (status != STATUS_SUCCESS) { pr_err(DRV_NAME "InitCardAndDownloadFirmware failed.\n"); return status; } - if (psIntfAdapter->psAdapter->fw_download_done) { + if (psAd->fw_download_done) { if (StartInterruptUrb(psIntfAdapter)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, - DBG_TYPE_INITEXIT, DRV_ENTRY, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Cannot send interrupt in URB\n"); } @@ -358,17 +358,15 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) * now register the cntrl interface. after downloading the f/w * waiting for 5 sec to get the mailbox interrupt. */ - psIntfAdapter->psAdapter->waiting_to_fw_download_done = false; - value = wait_event_timeout( - psIntfAdapter->psAdapter->ioctl_fw_dnld_wait_queue, - psIntfAdapter->psAdapter->waiting_to_fw_download_done, - 5 * HZ); + psAd->waiting_to_fw_download_done = false; + value = wait_event_timeout(psAd->ioctl_fw_dnld_wait_queue, + psAd->waiting_to_fw_download_done, + 5 * HZ); if (value == 0) pr_err(DRV_NAME ": Timeout waiting for mailbox interrupt.\n"); - if (register_control_device_interface( - psIntfAdapter->psAdapter) < 0) { + if (register_control_device_interface(psAd) < 0) { pr_err(DRV_NAME ": Register Control Device failed.\n"); return -EIO; } -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 0/7] Cleanup patches for bcm staging driver
Hi, I'm so sorry, I forgot the "--in-reply-to" flag for this patchset. Do you want me to resend with the appropriate flag? On 11-06-2014 09:50:16, Matthias Beyer wrote: > Hi, > > I fixed what Dan suggested. > > Please notice: I cannot test these patches. I compiled them successfully, but > for testing I do not have the appropriate hardware. > > Kind regards, > Matthias Beyer > > Matthias Beyer (7): > Staging: bcm: Shortened some lines > Staging: bcm: replaced member accessing by variable > Staging: bcm: Replaced member accessing with variable in device_run() > Staging: bcm: Replaced member accessing with variable in > InterfaceAdapterInit() > Staging: bcm: Merged some lines which got shorter by the latest patch > Staging: bcm: Outsourced selecting of alternate setting > Staging: bcm: Shortened some lines in > select_alternate_setting_for_highspeed_modem() > > drivers/staging/bcm/InterfaceInit.c | 284 > ++-- > 1 file changed, 141 insertions(+), 143 deletions(-) > > -- > 2.0.0 > -- Mit freundlichen Grüßen, Kind regards, Matthias Beyer Proudly sent with mutt. Happily signed with gnupg. pgp_9t5IQjQgz.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 0/2] Staging: bcm: InterfaceMisc. file cleanup
Hi, I fixed what Dan suggested. Kind regards, Matthias Beyer Matthias Beyer (2): Staging: bcm: Shortened lines Staging: bcm: InterfaceMisc.c: Outsourced doubled error checking drivers/staging/bcm/InterfaceMisc.c | 125 ++-- 1 file changed, 77 insertions(+), 48 deletions(-) -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 2/2] Staging: bcm: InterfaceMisc.c: Outsourced doubled error checking
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceMisc.c | 69 + 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index fff7d68..a0f159e 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -1,36 +1,46 @@ #include "headers.h" -int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, - unsigned int addr, - void *buff, - int len) +static int adapter_err_occurred(const struct bcm_interface_adapter *ad) { - int bytes; - - if (!psIntfAdapter) - return -EINVAL; - - if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + if (ad->psAdapter->device_removed == TRUE) { + BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && - (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + if ((ad->psAdapter->StopAllXaction == TRUE) && + (ad->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || - psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + if (ad->bSuspended == TRUE || ad->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(ad->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); return -EACCES; } + + return 0; +} + +int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, + unsigned int addr, + void *buff, + int len) +{ + int bytes; + int err = 0; + + if (!psIntfAdapter) + return -EINVAL; + + err = adapter_err_occurred(psIntfAdapter); + if (err) + return err; + psIntfAdapter->psAdapter->DeviceAccess = TRUE; bytes = usb_control_msg(psIntfAdapter->udev, @@ -63,31 +73,14 @@ int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter, int len) { int retval = 0; + int err = 0; if (!psIntfAdapter) return -EINVAL; - if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, - "Device got removed"); - return -ENODEV; - } - - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && - (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, - DBG_LVL_ALL, - "Currently Xaction is not allowed on the bus..."); - return -EACCES; - } - - if (psIntfAdapter->bSuspended == TRUE || - psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, - DBG_LVL_ALL, - "Bus is in suspended states hence RDM not allowed.."); - return -EACCES; - } + err = adapter_err_occurred(psIntfAdapter); + if (err) + return err; psIntfAdapter->psAdapter->DeviceAccess = TRUE; -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/2] Staging: bcm: Shortened lines
This patch fixes line lengths in the drivers/staging/bcm/InterfaceMisc.c file. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceMisc.c | 98 + 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/drivers/staging/bcm/InterfaceMisc.c b/drivers/staging/bcm/InterfaceMisc.c index 4173fd7..fff7d68 100644 --- a/drivers/staging/bcm/InterfaceMisc.c +++ b/drivers/staging/bcm/InterfaceMisc.c @@ -11,17 +11,24 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus"); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && + (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus"); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE || + psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, + "Bus is in suspended states hence RDM not allowed.."); return -EACCES; } psIntfAdapter->psAdapter->DeviceAccess = TRUE; @@ -40,9 +47,11 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter, psIntfAdapter->psAdapter->device_removed = TRUE; if (bytes < 0) - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM failed status :%d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM failed status :%d", bytes); else - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, DBG_LVL_ALL, "RDM sent %d", bytes); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, RDM, + DBG_LVL_ALL, "RDM sent %d", bytes); psIntfAdapter->psAdapter->DeviceAccess = false; return bytes; @@ -59,17 +68,24 @@ int InterfaceWRM(struct bcm_interface_adapter *psIntfAdapter, return -EINVAL; if (psIntfAdapter->psAdapter->device_removed == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Device got removed"); + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, + "Device got removed"); return -ENODEV; } - if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Currently Xaction is not allowed on the bus..."); + if ((psIntfAdapter->psAdapter->StopAllXaction == TRUE) && + (psIntfAdapter->psAdapter->chip_id >= T3LPB)) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, + "Currently Xaction is not allowed on the bus..."); return -EACCES; } - if (psIntfAdapter->bSuspended == TRUE || psIntfAdapter->bPreparingForBusSuspend == TRUE) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, DBG_LVL_ALL, "Bus is in suspended states hence RDM not allowed.."); + if (psIntfAdapter->bSuspended == TRUE || + psIntfAdapter->bPreparingForBusSuspend == TRUE) { + BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_OTHERS, WRM, + DBG_LVL_ALL, +
[PATCH v3 6/8] Staging: bcm: Outsourced selecting of alternate setting
This patch outsources a chunk of code which is for selecting an alternate setting for highspeed modem into a new function. Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 207 +++- 1 file changed, 112 insertions(+), 95 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index bda33c8..9f9045d 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -374,6 +374,113 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) return 0; } +static int select_alternate_setting_for_highspeed_modem( + struct bcm_interface_adapter *psIntfAdapter, + struct usb_endpoint_descriptor **endpoint, + const struct usb_host_interface *iface_desc, + int *usedIntOutForBulkTransfer) +{ + int retval = 0; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; + + /* selecting alternate setting one as a default setting +* for High Speed modem. */ + if (psIntfAdapter->bHighSpeedDevice) + retval = usb_set_interface(psIntfAdapter->udev, + DEFAULT_SETTING_0, + ALTERNATE_SETTING_1); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, + "BCM16 is applicable on this dongle\n"); + if (retval || !psIntfAdapter->bHighSpeedDevice) { + *usedIntOutForBulkTransfer = EP2; + *endpoint = &iface_desc->endpoint[EP2].desc; + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); + /* +* If Modem is high speed device EP2 should be +* INT OUT End point +* +* If Mode is FS then EP2 should be bulk end +* point +*/ + if ((psIntfAdapter->bHighSpeedDevice && + !usb_endpoint_is_int_out(*endpoint)) || + (!psIntfAdapter->bHighSpeedDevice && +!usb_endpoint_is_bulk_out(*endpoint))) { + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Configuring the EEPROM\n"); + /* change the EP2, EP4 to INT OUT end point */ + ConfigureEndPointTypesThroughEEPROM( + psAd); + + /* +* It resets the device and if any thing +* gets changed in USB descriptor it +* will show fail and re-enumerate the +* device +*/ + retval = usb_reset_device( + psIntfAdapter->udev); + if (retval) { + BCM_DEBUG_PRINT(psAd, + DBG_TYPE_INITEXIT, + DRV_ENTRY, + DBG_LVL_ALL, + "reset failed. Re-enumerating the device.\n"); + return retval; + } + + } + if (!psIntfAdapter->bHighSpeedDevice && + usb_endpoint_is_bulk_out(*endpoint)) { + /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ + UINT _uiData = ntohl(EP2_CFG_INT); + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Reverting Bulk to INT as it is in Full Speed mode.\n"); + BeceemEEPROMBulkWrite(psAd, + (PUCHAR) & _uiData, + 0x136, 4, TRUE); + } + } else { + *usedIntOutForBulkTransfer = EP4; + *endpoint = &iface_desc->endpoint[EP4].desc; + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, + "Choosing AltSetting as a default setting.\n"); + if (!usb_endpoint_is_int_out(*endpoint)) { + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DB
[PATCH v3 3/8] Staging: bcm: Replaced member accessing with variable in device_run()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index dd7b4a5..e1a3e6d 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -340,16 +340,16 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) { int value = 0; UINT status = STATUS_SUCCESS; + struct bcm_mini_adapter *psAd = psIntfAdapter->psAdapter; - status = InitCardAndDownloadFirmware(psIntfAdapter->psAdapter); + status = InitCardAndDownloadFirmware(psAd); if (status != STATUS_SUCCESS) { pr_err(DRV_NAME "InitCardAndDownloadFirmware failed.\n"); return status; } - if (psIntfAdapter->psAdapter->fw_download_done) { + if (psAd->fw_download_done) { if (StartInterruptUrb(psIntfAdapter)) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, - DBG_TYPE_INITEXIT, DRV_ENTRY, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Cannot send interrupt in URB\n"); } @@ -358,17 +358,15 @@ static int device_run(struct bcm_interface_adapter *psIntfAdapter) * now register the cntrl interface. after downloading the f/w * waiting for 5 sec to get the mailbox interrupt. */ - psIntfAdapter->psAdapter->waiting_to_fw_download_done = false; - value = wait_event_timeout( - psIntfAdapter->psAdapter->ioctl_fw_dnld_wait_queue, - psIntfAdapter->psAdapter->waiting_to_fw_download_done, - 5 * HZ); + psAd->waiting_to_fw_download_done = false; + value = wait_event_timeout(psAd->ioctl_fw_dnld_wait_queue, + psAd->waiting_to_fw_download_done, + 5 * HZ); if (value == 0) pr_err(DRV_NAME ": Timeout waiting for mailbox interrupt.\n"); - if (register_control_device_interface( - psIntfAdapter->psAdapter) < 0) { + if (register_control_device_interface(psAd) < 0) { pr_err(DRV_NAME ": Register Control Device failed.\n"); return -EIO; } -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 7/8] Staging: bcm: Shortened some lines in select_alternate_setting_for_highspeed_modem()
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 47 ++--- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 9f9045d..276825f 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -389,14 +389,12 @@ static int select_alternate_setting_for_highspeed_modem( retval = usb_set_interface(psIntfAdapter->udev, DEFAULT_SETTING_0, ALTERNATE_SETTING_1); - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM16 is applicable on this dongle\n"); if (retval || !psIntfAdapter->bHighSpeedDevice) { *usedIntOutForBulkTransfer = EP2; *endpoint = &iface_desc->endpoint[EP2].desc; - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Interface altsetting failed or modem is configured to Full Speed, hence will work on default setting 0\n"); /* * If Modem is high speed device EP2 should be @@ -409,8 +407,8 @@ static int select_alternate_setting_for_highspeed_modem( !usb_endpoint_is_int_out(*endpoint)) || (!psIntfAdapter->bHighSpeedDevice && !usb_endpoint_is_bulk_out(*endpoint))) { - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, "Configuring the EEPROM\n"); /* change the EP2, EP4 to INT OUT end point */ ConfigureEndPointTypesThroughEEPROM( @@ -422,13 +420,10 @@ static int select_alternate_setting_for_highspeed_modem( * will show fail and re-enumerate the * device */ - retval = usb_reset_device( - psIntfAdapter->udev); + retval = usb_reset_device(psIntfAdapter->udev); if (retval) { - BCM_DEBUG_PRINT(psAd, - DBG_TYPE_INITEXIT, - DRV_ENTRY, - DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, + DRV_ENTRY, DBG_LVL_ALL, "reset failed. Re-enumerating the device.\n"); return retval; } @@ -438,26 +433,23 @@ static int select_alternate_setting_for_highspeed_modem( usb_endpoint_is_bulk_out(*endpoint)) { /* Once BULK is selected in FS mode. Revert it back to INT. Else USB_IF will fail. */ UINT _uiData = ntohl(EP2_CFG_INT); - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, + DBG_LVL_ALL, "Reverting Bulk to INT as it is in Full Speed mode.\n"); - BeceemEEPROMBulkWrite(psAd, - (PUCHAR) & _uiData, - 0x136, 4, TRUE); + BeceemEEPROMBulkWrite(psAd, (PUCHAR) & _uiData, 0x136, + 4, TRUE); } } else { *usedIntOutForBulkTransfer = EP4; *endpoint = &iface_desc->endpoint[EP4].desc; - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Choosing AltSetting as a default setting.\n"); if (!usb_endpoint_is_int_out(*endpoint)) { - BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, +
[PATCH v3 2/8] Staging: bcm: replaced member accessing by variable
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index d61a688..dd7b4a5 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -28,28 +28,28 @@ static int InterfaceAdapterInit(struct bcm_interface_adapter *Adapter); static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) { int i = 0; + struct bcm_mini_adapter *ps_ad = psIntfAdapter->psAdapter; /* Wake up the wait_queue... */ - if (psIntfAdapter->psAdapter->LEDInfo.led_thread_running & + if (ps_ad->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) { - psIntfAdapter->psAdapter->DriverState = DRIVER_HALT; - wake_up(&psIntfAdapter->psAdapter->LEDInfo.notify_led_event); + ps_ad->DriverState = DRIVER_HALT; + wake_up(&ps_ad->LEDInfo.notify_led_event); } - reset_card_proc(psIntfAdapter->psAdapter); + reset_card_proc(ps_ad); /* * worst case time taken by the RDM/WRM will be 5 sec. will check after * every 100 ms to accertain the device is not being accessed. After * this No RDM/WRM should be made. */ - while (psIntfAdapter->psAdapter->DeviceAccess) { - BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_INITEXIT, - DRV_ENTRY, DBG_LVL_ALL, + while (ps_ad->DeviceAccess) { + BCM_DEBUG_PRINT(ps_ad, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Device is being accessed.\n"); msleep(100); } /* Free interrupt URB */ - /* psIntfAdapter->psAdapter->device_removed = TRUE; */ + /* ps_ad->device_removed = TRUE; */ usb_free_urb(psIntfAdapter->psInterruptUrb); /* Free transmit URBs */ @@ -67,7 +67,7 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) psIntfAdapter->asUsbRcb[i].urb = NULL; } } - AdapterFree(psIntfAdapter->psAdapter); + AdapterFree(ps_ad); } static void ConfigureEndPointTypesThroughEEPROM( -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/8] Staging: bcm: Shortened some lines
Signed-off-by: Matthias Beyer --- drivers/staging/bcm/InterfaceInit.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 7c04c73..d61a688 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -70,7 +70,8 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter) AdapterFree(psIntfAdapter->psAdapter); } -static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter *Adapter) +static void ConfigureEndPointTypesThroughEEPROM( + struct bcm_mini_adapter *Adapter) { u32 ulReg; int bytes; @@ -147,7 +148,8 @@ static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter *Adapter BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&ulReg, 0x1C2, 4, TRUE); } -static int usbbcm_device_probe(struct usb_interface *intf, const struct usb_device_id *id) +static int usbbcm_device_probe(struct usb_interface *intf, + const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); int retval; -- 2.0.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel