* [PATCH 2/2] net: wireless: fix to uses struct
@ 2016-12-21 22:23 Ozgur Karatas
2016-12-21 22:33 ` Paul Bolle
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Ozgur Karatas @ 2016-12-21 22:23 UTC (permalink / raw)
To: johannes, David Miller; +Cc: linux-wireless, netdev, linux-kernel
The patch fixed to struct uses in reg.c, I think doesn't need to be use to "struct".
There is dataype not have to logical link and each is different definitons.
I'm undecided on this patch. I compiled and didn't to errors.
Signed-off-by: Ozgur Karatas <okaratas@member.fsf.org>
---
net/wireless/reg.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5dbac37..5b70970 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -490,7 +490,7 @@ static int reg_query_builtin(const char *alpha2)
if (!regdom)
return -ENODATA;
- request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*reg_regdb_apply_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2291,7 +2291,7 @@ static int regulatory_hint_core(const char *alpha2)
{
struct regulatory_request *request;
- request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2313,7 +2313,7 @@ int regulatory_hint_user(const char *alpha2,
if (WARN_ON(!alpha2))
return -EINVAL;
- request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2385,7 +2385,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2)
wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG;
- request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2661,7 +2661,7 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
if (processing)
return 0;
- reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp);
+ reg_beacon = kzalloc(sizeof(*reg_beacon), gfp);
if (!reg_beacon)
return -ENOMEM;
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 22:23 [PATCH 2/2] net: wireless: fix to uses struct Ozgur Karatas
@ 2016-12-21 22:33 ` Paul Bolle
2016-12-21 22:50 ` Ozgur Karatas
2016-12-22 5:18 ` kbuild test robot
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Paul Bolle @ 2016-12-21 22:33 UTC (permalink / raw)
To: Ozgur Karatas, johannes, David Miller
Cc: Thomas Gleixner, linux-wireless, netdev, linux-kernel
On Thu, 2016-12-22 at 00:23 +0200, Ozgur Karatas wrote:
> I compiled and didn't to errors.
Really?
$ make net/wireless/reg.o
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CC net/wireless/reg.o
net/wireless/reg.c: In function ‘regulatory_hint_core’:
net/wireless/reg.c:2294:28: error: ‘regulatory_request’ undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
net/wireless/reg.c:2294:28: note: each undeclared identifier is reported only once for each function it appears in
net/wireless/reg.c: In function ‘regulatory_hint_user’:
net/wireless/reg.c:2316:28: error: ‘regulatory_request’ undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
net/wireless/reg.c: In function ‘regulatory_hint’:
net/wireless/reg.c:2388:28: error: ‘regulatory_request’ undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
scripts/Makefile.build:293: recipe for target 'net/wireless/reg.o' failed
make[1]: *** [net/wireless/reg.o] Error 1
Makefile:1640: recipe for target 'net/wireless/reg.o' failed
make: *** [net/wireless/reg.o] Error 2
Didn't Thomas Gleixner suggest that you do a basic C course just yesterday?
Paul Bolle
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 22:33 ` Paul Bolle
@ 2016-12-21 22:50 ` Ozgur Karatas
2016-12-21 23:01 ` Ozgur Karatas
2016-12-21 23:06 ` Paul Bolle
0 siblings, 2 replies; 9+ messages in thread
From: Ozgur Karatas @ 2016-12-21 22:50 UTC (permalink / raw)
To: Paul Bolle, johannes, David Miller
Cc: Thomas Gleixner, linux-wireless, netdev, linux-kernel
22.12.2016, 00:34, "Paul Bolle" <pebolle@tiscali.nl>:
> On Thu, 2016-12-22 at 00:23 +0200, Ozgur Karatas wrote:
>> I compiled and didn't to errors.
>
> Really?
I'm very sorry. The "regulatory_request" is defined a static struct. I missed.
line: static struct regulatory_request core_request_world = {
I send to wrong line please can ignore last message and should be fix to as follows:
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5dbac37..5b70970 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -490,7 +490,7 @@ static int reg_query_builtin(const char *alpha2)
if (!regdom)
return -ENODATA;
- request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*reg_regdb_apply_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2291,7 +2291,7 @@ static int regulatory_hint_core(const char *alpha2)
{
struct regulatory_request *request;
- request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2313,7 +2313,7 @@ int regulatory_hint_user(const char *alpha2,
if (WARN_ON(!alpha2))
return -EINVAL;
- request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2385,7 +2385,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2)
wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG;
- request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2661,7 +2661,7 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
if (processing)
return 0;
- reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp);
+ reg_beacon = kzalloc(sizeof(*reg_beacon), gfp);
if (!reg_beacon)
return -ENOMEM;
--
2.1.4
> $ make net/wireless/reg.o
> CHK include/config/kernel.release
> CHK include/generated/uapi/linux/version.h
> CHK include/generated/utsrelease.h
> CHK include/generated/bounds.h
> CHK include/generated/timeconst.h
> CHK include/generated/asm-offsets.h
> CALL scripts/checksyscalls.sh
> CC net/wireless/reg.o
> net/wireless/reg.c: In function ‘regulatory_hint_core’:
> net/wireless/reg.c:2294:28: error: ‘regulatory_request’ undeclared (first use in this function)
> request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
> ^~~~~~~~~~~~~~~~~~
> net/wireless/reg.c:2294:28: note: each undeclared identifier is reported only once for each function it appears in
> net/wireless/reg.c: In function ‘regulatory_hint_user’:
> net/wireless/reg.c:2316:28: error: ‘regulatory_request’ undeclared (first use in this function)
> request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
> ^~~~~~~~~~~~~~~~~~
> net/wireless/reg.c: In function ‘regulatory_hint’:
> net/wireless/reg.c:2388:28: error: ‘regulatory_request’ undeclared (first use in this function)
> request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
> ^~~~~~~~~~~~~~~~~~
> scripts/Makefile.build:293: recipe for target 'net/wireless/reg.o' failed
> make[1]: *** [net/wireless/reg.o] Error 1
> Makefile:1640: recipe for target 'net/wireless/reg.o' failed
> make: *** [net/wireless/reg.o] Error 2
$ make M=net/wireless/
CC net/wireless//core.o
CC net/wireless//sysfs.o
CC net/wireless//radiotap.o
CC net/wireless//util.o
CC net/wireless//reg.o
CC net/wireless//scan.o
CC net/wireless//nl80211.o
CC net/wireless//mlme.o
CC net/wireless//ibss.o
CC net/wireless//sme.o
CC net/wireless//chan.o
CC net/wireless//ethtool.o
CC net/wireless//mesh.o
CC net/wireless//ap.o
CC net/wireless//trace.o
CC net/wireless//ocb.o
LD net/wireless//cfg80211.o
LD net/wireless//built-in.o
Building modules, stage 2.
MODPOST 0 modules
$ make net/wireless/reg.o
scripts/kconfig/conf --silentoldconfig Kconfig
*
* Restart config...
*
*
* Memory power savings
*
> Didn't Thomas Gleixner suggest that you do a basic C course just yesterday?
I don't have a problem with C programming, So only I'm learning the kernel.
Also, this is a lie if say "I'm expert to C".
I think be re-learned every day. wrong?
> Paul Bolle
Regards,
~ Ozgur
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 22:50 ` Ozgur Karatas
@ 2016-12-21 23:01 ` Ozgur Karatas
2016-12-21 23:06 ` Paul Bolle
1 sibling, 0 replies; 9+ messages in thread
From: Ozgur Karatas @ 2016-12-21 23:01 UTC (permalink / raw)
To: Paul Bolle, johannes, David Miller
Cc: Thomas Gleixner, linux-wireless, netdev, linux-kernel
My previous patch is invalid, I'm sorry.
The last patc will be fellow because "regulatory_request" is defined as a "static struct".
Signed-off-by: Ozgur Karatas <okaratas@member.fsf.org>
---
net/wireless/reg.c | 10 +++++-----
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5dbac37..5b70970 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -490,7 +490,7 @@ static int reg_query_builtin(const char *alpha2)
if (!regdom)
return -ENODATA;
- request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*reg_regdb_apply_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
@@ -2661,7 +2661,7 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
if (processing)
return 0;
- reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp);
+ reg_beacon = kzalloc(sizeof(*reg_beacon), gfp);
if (!reg_beacon)
return -ENOMEM;
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 22:50 ` Ozgur Karatas
2016-12-21 23:01 ` Ozgur Karatas
@ 2016-12-21 23:06 ` Paul Bolle
2016-12-21 23:16 ` Ozgur Karatas
1 sibling, 1 reply; 9+ messages in thread
From: Paul Bolle @ 2016-12-21 23:06 UTC (permalink / raw)
To: Ozgur Karatas, johannes, David Miller
Cc: Thomas Gleixner, linux-wireless, netdev, linux-kernel
On Thu, 2016-12-22 at 01:50 +0300, Ozgur Karatas wrote:
> I don't have a problem with C programming
I'm sorry, but you do need to learn C, at a basic level, first.
Paul Bolle
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 23:06 ` Paul Bolle
@ 2016-12-21 23:16 ` Ozgur Karatas
0 siblings, 0 replies; 9+ messages in thread
From: Ozgur Karatas @ 2016-12-21 23:16 UTC (permalink / raw)
To: Paul Bolle, johannes, David Miller
Cc: Thomas Gleixner, linux-wireless, netdev, linux-kernel
22.12.2016, 01:06, "Paul Bolle" <pebolle@tiscali.nl>:
> On Thu, 2016-12-22 at 01:50 +0300, Ozgur Karatas wrote:
>> I don't have a problem with C programming
>
> I'm sorry, but you do need to learn C, at a basic level, first.
Hmm, I don't like to discussion but I'm an assertive on C/C++.
So, I'm not into the Linux kernel, I writing code with C/C++ for many years.
I'm having trouble using Linux tools and trying to learn git/diff/format-patch/etc.
Also, I'm reading over 600 e-mails per day and I'm reading to Documentation (kernel). I learn :)
I don't have to problem with C, you can see my early codes and software (github).
I need to get a good sense of the coding style and Documentation.
And thank you.
Regards
> Paul Bolle
~Ozgur
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 22:23 [PATCH 2/2] net: wireless: fix to uses struct Ozgur Karatas
2016-12-21 22:33 ` Paul Bolle
@ 2016-12-22 5:18 ` kbuild test robot
2016-12-22 7:05 ` kbuild test robot
2016-12-22 9:37 ` Arend Van Spriel
3 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2016-12-22 5:18 UTC (permalink / raw)
To: Ozgur Karatas
Cc: kbuild-all, johannes, David Miller, linux-wireless, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2098 bytes --]
Hi Ozgur,
[auto build test ERROR on mac80211-next/master]
[also build test ERROR on v4.9 next-20161221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ozgur-Karatas/net-wireless-fixed-to-checkpatch-errors/20161222-125128
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-randconfig-x006-201651 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
net/wireless/reg.c: In function 'regulatory_hint_core':
>> net/wireless/reg.c:2294:28: error: 'regulatory_request' undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
net/wireless/reg.c:2294:28: note: each undeclared identifier is reported only once for each function it appears in
net/wireless/reg.c: In function 'regulatory_hint_user':
net/wireless/reg.c:2316:28: error: 'regulatory_request' undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
net/wireless/reg.c: In function 'regulatory_hint':
net/wireless/reg.c:2388:28: error: 'regulatory_request' undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
vim +/regulatory_request +2294 net/wireless/reg.c
2288 * and when we restore regulatory settings.
2289 */
2290 static int regulatory_hint_core(const char *alpha2)
2291 {
2292 struct regulatory_request *request;
2293
> 2294 request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
2295 if (!request)
2296 return -ENOMEM;
2297
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 23376 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 22:23 [PATCH 2/2] net: wireless: fix to uses struct Ozgur Karatas
2016-12-21 22:33 ` Paul Bolle
2016-12-22 5:18 ` kbuild test robot
@ 2016-12-22 7:05 ` kbuild test robot
2016-12-22 9:37 ` Arend Van Spriel
3 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2016-12-22 7:05 UTC (permalink / raw)
To: Ozgur Karatas
Cc: kbuild-all, johannes, David Miller, linux-wireless, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]
Hi Ozgur,
[auto build test ERROR on mac80211-next/master]
[also build test ERROR on v4.9 next-20161221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ozgur-Karatas/net-wireless-fixed-to-checkpatch-errors/20161222-125128
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
net/wireless/reg.c: In function 'reg_query_builtin':
>> net/wireless/reg.c:493:28: error: 'reg_regdb_apply_request' undeclared (first use in this function)
request = kzalloc(sizeof(*reg_regdb_apply_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~~~~~~
net/wireless/reg.c:493:28: note: each undeclared identifier is reported only once for each function it appears in
net/wireless/reg.c: In function 'regulatory_hint_core':
net/wireless/reg.c:2294:28: error: 'regulatory_request' undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
net/wireless/reg.c: In function 'regulatory_hint_user':
net/wireless/reg.c:2316:28: error: 'regulatory_request' undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
net/wireless/reg.c: In function 'regulatory_hint':
net/wireless/reg.c:2388:28: error: 'regulatory_request' undeclared (first use in this function)
request = kzalloc(sizeof(*regulatory_request), GFP_KERNEL);
^~~~~~~~~~~~~~~~~~
vim +/reg_regdb_apply_request +493 net/wireless/reg.c
487 }
488 }
489
490 if (!regdom)
491 return -ENODATA;
492
> 493 request = kzalloc(sizeof(*reg_regdb_apply_request), GFP_KERNEL);
494 if (!request)
495 return -ENOMEM;
496
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 57000 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] net: wireless: fix to uses struct
2016-12-21 22:23 [PATCH 2/2] net: wireless: fix to uses struct Ozgur Karatas
` (2 preceding siblings ...)
2016-12-22 7:05 ` kbuild test robot
@ 2016-12-22 9:37 ` Arend Van Spriel
3 siblings, 0 replies; 9+ messages in thread
From: Arend Van Spriel @ 2016-12-22 9:37 UTC (permalink / raw)
To: Ozgur Karatas, johannes, David Miller
Cc: linux-wireless, netdev, linux-kernel
On 21-12-2016 23:23, Ozgur Karatas wrote:
>
> The patch fixed to struct uses in reg.c, I think doesn't need to be use to "struct".
> There is dataype not have to logical link and each is different definitons.
>
> I'm undecided on this patch. I compiled and didn't to errors.
There must be something wrong in the way you build stuff, but still just
looking at your patch it is fundamentally wrong, which is what makes
people say "do a basic C course". Let me try and explain below.
> Signed-off-by: Ozgur Karatas <okaratas@member.fsf.org>
> ---
> net/wireless/reg.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 5dbac37..5b70970 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -490,7 +490,7 @@ static int reg_query_builtin(const char *alpha2)
> if (!regdom)
> return -ENODATA;
>
> - request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL);
> + request = kzalloc(sizeof(*reg_regdb_apply_request), GFP_KERNEL);
Making it more abstract to explain what you are doing:
x = foo(sizeof(T), GFP_KERNEL); where T is "struct Y".
which you change to:
x = foo(sizeof(*Y), GFP_KERNEL);
Y has no meaning for the sizeof operator and the compiler will yell at
it being an unknown identifier. In a lot of kernel code you will find:
x = foo(sizeof(*x), GFP_KERNEL);
which is probably the coding style fix you are attempting to make, but
miserably fail to do so. There is nothing linux kernel specific about
this. It is really fundamental knowledge of the C language. The correct
change for this instance is:
- request = kzalloc(sizeof(struct reg_regdb_apply_request), GFP_KERNEL);
+ request = kzalloc(sizeof(*request), GFP_KERNEL);
Hope this helps to come up with a working V2 of this patch.
Regards,
Arend
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-12-22 9:37 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 22:23 [PATCH 2/2] net: wireless: fix to uses struct Ozgur Karatas
2016-12-21 22:33 ` Paul Bolle
2016-12-21 22:50 ` Ozgur Karatas
2016-12-21 23:01 ` Ozgur Karatas
2016-12-21 23:06 ` Paul Bolle
2016-12-21 23:16 ` Ozgur Karatas
2016-12-22 5:18 ` kbuild test robot
2016-12-22 7:05 ` kbuild test robot
2016-12-22 9:37 ` Arend Van Spriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).