2017-08-25 17:53:44

by Harsha Sharma

[permalink] [raw]
Subject: [PATCH] staging:rtl8712:xmit_linux.c: Avoid CamelCase

Signed-off-by: harsha <[email protected]>
---
drivers/staging/rtl8712/xmit_linux.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c
index 5d915c9..fd3380d 100644
--- a/drivers/staging/rtl8712/xmit_linux.c
+++ b/drivers/staging/rtl8712/xmit_linux.c
@@ -79,7 +79,7 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
{
struct ethhdr etherhdr;
struct iphdr ip_hdr;
- u16 UserPriority = 0;
+ u16 user_priority = 0;

_r8712_open_pktfile(ppktfile->pkt, ppktfile);
_r8712_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
@@ -88,7 +88,7 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
if (pattrib->ether_type == 0x0800) {
_r8712_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
/*UserPriority = (ntohs(ip_hdr.tos) >> 5) & 0x3 ;*/
- UserPriority = ip_hdr.tos >> 5;
+ user_priority = ip_hdr.tos >> 5;
} else {
/* "When priority processing of data frames is supported,
* a STA's SME should send EAPOL-Key frames at the highest
@@ -96,17 +96,17 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
*/

if (pattrib->ether_type == 0x888e)
- UserPriority = 7;
+ user_priority = 7;
}
- pattrib->priority = UserPriority;
+ pattrib->priority = user_priority;
pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN;
pattrib->subtype = WIFI_QOS_DATA_TYPE;
}

-void r8712_SetFilter(struct work_struct *work)
+void r8712_set_filter(struct work_struct *work)
{
struct _adapter *padapter = container_of(work, struct _adapter,
- wkFilterRxFF0);
+ wk_filterRxFF0);
u8 oldvalue = 0x00, newvalue = 0x00;
unsigned long irqL;

@@ -175,7 +175,7 @@ int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev)
if ((!r8712_update_attrib(padapter, pkt, &pxmitframe->attrib)))
goto _xmit_entry_drop;

- padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX);
+ padapter->ledpriv.led_control_handler(padapter, LED_CTL_TX);
pxmitframe->pkt = pkt;
if (r8712_pre_xmit(padapter, pxmitframe)) {
/*dump xmitframe directly or drop xframe*/
--
1.9.1


2017-08-25 19:03:35

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] staging:rtl8712:xmit_linux.c: Avoid CamelCase

On Fri, 2017-08-25 at 23:21 +0530, harsha wrote:
> Signed-off-by: harsha <[email protected]>

Hello Harsha.

It seems you are pretty new at this.

Please try to send one patch and have that accepted
before sending more.

There are many details that need to be known by you
before you get the process down and it takes some
process learning time before you get good at it.

2017-08-26 01:05:37

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] staging:rtl8712:xmit_linux.c: Avoid CamelCase

On Sat, 2017-08-26 at 01:21 +0530, Harsha Sharma wrote:
> Hello,
>
> Sorry, this was my first contribution in linux-kernel. I will take care
> about this from next time.
> Do I need to send these patches once again one by one?

No, just pick the "best" one of what you sent
without any of the "style" modifications like
the 80 column adjustments and see what happens.

Read the code outside of staging for awhile
to get a feel for what style seems appropriate
before you send style-only patches.

For instance, this proposed change:

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
> index 0b39676..57fc65f 100644
> --- a/drivers/staging/unisys/visornic/visornic_main.c
> +++ b/drivers/staging/unisys/visornic/visornic_main.c
> @@ -253,10 +253,9 @@ static int visor_copy_fragsinfo_from_skb(struct sk_buff *skb,
> for (frag = 0; frag < numfrags; frag++) {
> count = add_physinfo_entries(page_to_pfn(
> skb_frag_page(&skb_shinfo(skb)->frags[frag])),
> - skb_shinfo(skb)->frags[frag].
> - page_offset,
> - skb_shinfo(skb)->frags[frag].
> - size, count, frags_max, frags);
> + skb_shinfo(skb)->frags[frag].page_offset,
> + skb_shinfo(skb)->frags[frag].size,
> + count, frags_max, frags);
> /* add_physinfo_entries only returns
> * zero if the frags array is out of room
> * That should never happen because we

while it's nice that you put the multi-line dereferences
together, it's not nice that you change the indentation.

Sometimes it's simply better to exceed 80 columns.
But here, it'd probably be nicer to use temporaries.

Something like:
---
drivers/staging/unisys/visornic/visornic_main.c | 26 +++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 2891622eef18..aafd849dc1e8 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -195,7 +195,7 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen,
unsigned int frags_max,
struct phys_info frags[])
{
- unsigned int count = 0, frag, size, offset = 0, numfrags;
+ unsigned int count = 0, size, offset = 0, numfrags;
unsigned int total_count;

numfrags = skb_shinfo(skb)->nr_frags;
@@ -234,21 +234,23 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen,
count++;
}
if (numfrags) {
+ int i;
+
if ((count + numfrags) > frags_max)
return -EINVAL;

- for (frag = 0; frag < numfrags; frag++) {
- count = add_physinfo_entries(page_to_pfn(
- skb_frag_page(&skb_shinfo(skb)->frags[frag])),
- skb_shinfo(skb)->frags[frag].
- page_offset,
- skb_shinfo(skb)->frags[frag].
- size, count, frags_max, frags);
- /* add_physinfo_entries only returns
- * zero if the frags array is out of room
- * That should never happen because we
- * fail above, if count+numfrags > frags_max.
+ for (i = 0; i < numfrags; i++) {
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
+ unsigned long pfn = page_to_pfn(skb_frag_page(frag));
+
+ /* add_physinfo_entries only returns zero if the
+ * frags array is out of room.
+ * That should never happen because we fail above,
+ * if count+numfrags > frags_max.
*/
+ count = add_physinfo_entries(pfn, frag->page_offset,
+ frag->size, count,
+ frags_max, frags);
if (!count)
return -EINVAL;
}