On Mon, 18 Jun 2001, Roman Zippel wrote:
> > I wouldn't call it "rather popular".
>
> You should also grep for '__typeof__'. :-)
Yeeeccchhh. OK, there is more of that. However, the main user of that
beast is, AFAICS, get_user()/put_user() and their ilk in include/asm-*
The rest looks very
Hi,
On Sun, 17 Jun 2001, Alexander Viro wrote:
> > typeof? It's rather popular in the kernel already. Besides, who is going to
>
> Really? 5 instances in PPC arch-specific code, 1 (absolutely gratitious)
> in drivers/mtd, 2 - in m68k (also useless), 4 - in drivers/video, 2 -
> in AFFS and 1 -
Hi,
On Sun, 17 Jun 2001, Alexander Viro wrote:
typeof? It's rather popular in the kernel already. Besides, who is going to
Really? 5 instances in PPC arch-specific code, 1 (absolutely gratitious)
in drivers/mtd, 2 - in m68k (also useless), 4 - in drivers/video, 2 -
in AFFS and 1 - in
On Mon, 18 Jun 2001, Roman Zippel wrote:
I wouldn't call it rather popular.
You should also grep for '__typeof__'. :-)
Yeeeccchhh. OK, there is more of that. However, the main user of that
beast is, AFAICS, get_user()/put_user() and their ilk in include/asm-*
The rest looks very bogus...
On Sun, 17 Jun 2001, Daniel Phillips wrote:
> typeof? It's rather popular in the kernel already. Besides, who is going to
Really? 5 instances in PPC arch-specific code, 1 (absolutely gratitious)
in drivers/mtd, 2 - in m68k (also useless), 4 - in drivers/video, 2 -
in AFFS and 1 - in
On Sunday 17 June 2001 22:37, Alexander Viro wrote:
> On Sun, 17 Jun 2001, Daniel Phillips wrote:
> > Well, since we are still beating this one to death, I'd written a "knew"
> > macro as well, and put it aside. It does the assignment for you too:
> >
> >#define knew(p) ((p) = (typeof(p))
> "Jeff" == Jeff Garzik <[EMAIL PROTECTED]> writes:
[snip]
Jeff> It's the preference of the maintainer. It's a tossup: using
Jeff> the type in the kmalloc makes the type being allocated obvious.
Jeff> But using sizeof(*var) is a tiny bit more resistant to change.
Ok, thanks. I was
On Sun, 17 Jun 2001, Daniel Phillips wrote:
> > macro that behaves like `new' in C++:
> > | #define knew(type, flags) (type *)kmalloc(sizeof(type), (flags))
> >
> > If the types in the assignment don't match, gcc will tell you.
>
> Well, since we are still beating this one to death, I'd
On Sunday 17 June 2001 21:18, Geert Uytterhoeven wrote:
> On Sun, 17 Jun 2001, Jeff Garzik wrote:
> > David Flynn wrote:
> > > > Daniel Phillips wrote:
> > > > > - if ((card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
GFP_KERNEL))
> > >
> > > > > + if ((card->mpuout =
On Sun, 17 Jun 2001, Jeff Garzik wrote:
> David Flynn wrote:
> > > Daniel Phillips wrote:
> > > > Yep, the only thing left to resolve is whether Jeff had coffee or not.
> > ;-)
> > > >
> > > > - if ((card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
> > GFP_KERNEL))
> > > > + if
David Flynn wrote:
>
> > Daniel Phillips wrote:
> > > Yep, the only thing left to resolve is whether Jeff had coffee or not.
> ;-)
> > >
> > > - if ((card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
> GFP_KERNEL))
> > > + if ((card->mpuout = kmalloc(sizeof(*card->mpuout),
> Daniel Phillips wrote:
> > Yep, the only thing left to resolve is whether Jeff had coffee or not.
;-)
> >
> > - if ((card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
GFP_KERNEL))
> > + if ((card->mpuout = kmalloc(sizeof(*card->mpuout), GFP_KERNEL))
>
> Yeah, this is fine.
Daniel Phillips wrote:
> Yep, the only thing left to resolve is whether Jeff had coffee or not. ;-)
>
> - if ((card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL))
> + if ((card->mpuout = kmalloc(sizeof(*card->mpuout), GFP_KERNEL))
Yeah, this is fine. The original
On Sunday 17 June 2001 14:27, [EMAIL PROTECTED] wrote:
> Daniel Phillips wrote:
> > > because then you would be allocating the size of a pointer, not the
> > > size of a structure
> >
> > Whoops Jeff, you didn't have your coffee yet:
>
> Whoops yourself. The following patch brings your example
Daniel Phillips wrote:
>
> > because then you would be allocating the size of a pointer, not the size
> > of a structure
>
> Whoops Jeff, you didn't have your coffee yet:
Whoops yourself. The following patch brings your example into line with
the driver code. mpuout is a pointer to a structure
On Sunday 17 June 2001 03:32, Jeff Garzik wrote:
> Bill Pringlemeir wrote:
> > Why is the struct type referenced for the allocation size? Why not,
> >
> > if ((card->mpuout = kmalloc(sizeof(card->mpuout), GFP_KERNEL))
>
> because then you would be allocating the size of a pointer, not
Hi,
Bill Pringlemeir wrote:
>
> I have been looking at the emu10k1 driver and I had a few questions
> about general idioms used there.
Warning I've not looked at that particular driver and would concider
myself a Linux kernel newbie. 20 years kernel hacking but only 9
months Linux with two
Hi,
Bill Pringlemeir wrote:
I have been looking at the emu10k1 driver and I had a few questions
about general idioms used there.
Warning I've not looked at that particular driver and would concider
myself a Linux kernel newbie. 20 years kernel hacking but only 9
months Linux with two
On Sunday 17 June 2001 03:32, Jeff Garzik wrote:
Bill Pringlemeir wrote:
Why is the struct type referenced for the allocation size? Why not,
if ((card-mpuout = kmalloc(sizeof(card-mpuout), GFP_KERNEL))
because then you would be allocating the size of a pointer, not the size
of
Daniel Phillips wrote:
because then you would be allocating the size of a pointer, not the size
of a structure
Whoops Jeff, you didn't have your coffee yet:
Whoops yourself. The following patch brings your example into line with
the driver code. mpuout is a pointer to a structure not
On Sunday 17 June 2001 14:27, [EMAIL PROTECTED] wrote:
Daniel Phillips wrote:
because then you would be allocating the size of a pointer, not the
size of a structure
Whoops Jeff, you didn't have your coffee yet:
Whoops yourself. The following patch brings your example into line with
Daniel Phillips wrote:
Yep, the only thing left to resolve is whether Jeff had coffee or not. ;-)
- if ((card-mpuout = kmalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL))
+ if ((card-mpuout = kmalloc(sizeof(*card-mpuout), GFP_KERNEL))
Yeah, this is fine. The original posted
Daniel Phillips wrote:
Yep, the only thing left to resolve is whether Jeff had coffee or not.
;-)
- if ((card-mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
GFP_KERNEL))
+ if ((card-mpuout = kmalloc(sizeof(*card-mpuout), GFP_KERNEL))
Yeah, this is fine. The original
David Flynn wrote:
Daniel Phillips wrote:
Yep, the only thing left to resolve is whether Jeff had coffee or not.
;-)
- if ((card-mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
GFP_KERNEL))
+ if ((card-mpuout = kmalloc(sizeof(*card-mpuout), GFP_KERNEL))
Yeah,
On Sun, 17 Jun 2001, Jeff Garzik wrote:
David Flynn wrote:
Daniel Phillips wrote:
Yep, the only thing left to resolve is whether Jeff had coffee or not.
;-)
- if ((card-mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
GFP_KERNEL))
+ if ((card-mpuout =
On Sunday 17 June 2001 21:18, Geert Uytterhoeven wrote:
On Sun, 17 Jun 2001, Jeff Garzik wrote:
David Flynn wrote:
Daniel Phillips wrote:
- if ((card-mpuout = kmalloc(sizeof(struct emu10k1_mpuout),
GFP_KERNEL))
+ if ((card-mpuout = kmalloc(sizeof(*card-mpuout),
On Sun, 17 Jun 2001, Daniel Phillips wrote:
macro that behaves like `new' in C++:
| #define knew(type, flags) (type *)kmalloc(sizeof(type), (flags))
If the types in the assignment don't match, gcc will tell you.
Well, since we are still beating this one to death, I'd written a knew
Jeff == Jeff Garzik [EMAIL PROTECTED] writes:
[snip]
Jeff It's the preference of the maintainer. It's a tossup: using
Jeff the type in the kmalloc makes the type being allocated obvious.
Jeff But using sizeof(*var) is a tiny bit more resistant to change.
Ok, thanks. I was looking at fixing
On Sunday 17 June 2001 22:37, Alexander Viro wrote:
On Sun, 17 Jun 2001, Daniel Phillips wrote:
Well, since we are still beating this one to death, I'd written a knew
macro as well, and put it aside. It does the assignment for you too:
#define knew(p) ((p) = (typeof(p))
On Sun, 17 Jun 2001, Daniel Phillips wrote:
typeof? It's rather popular in the kernel already. Besides, who is going to
Really? 5 instances in PPC arch-specific code, 1 (absolutely gratitious)
in drivers/mtd, 2 - in m68k (also useless), 4 - in drivers/video, 2 -
in AFFS and 1 - in
Em Sat, Jun 16, 2001 at 09:35:34PM -0400, Richard B. Johnson escreveu:
> > [main.c, line 223]
> > if ((card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL))
> >
> > Why is the struct type referenced for the allocation size? Why not,
> >
> > if ((card->mpuout =
On 16 Jun 2001, Bill Pringlemeir wrote:
>
> I have been looking at the emu10k1 driver and I had a few questions
> about general idioms used there.
>
> In a line like this,
>
> [main.c, line 175]
>
> for (count = 0; count < sizeof(card->digmix) / sizeof(card->digmix[0]);
>count++) {
>
Bill Pringlemeir wrote:
> [main.c, line 175]
>
> for (count = 0; count < sizeof(card->digmix) / sizeof(card->digmix[0]);
>count++) {
>
> Isn't there some sort of `ALEN' macro available, or is this
> considered to muddy things by using a macro?
Yes, we have array size
> [main.c, line
I have been looking at the emu10k1 driver and I had a few questions
about general idioms used there.
In a line like this,
[main.c, line 175]
for (count = 0; count < sizeof(card->digmix) / sizeof(card->digmix[0]);
count++) {
Isn't there some sort of `ALEN' macro available, or is this
I have been looking at the emu10k1 driver and I had a few questions
about general idioms used there.
In a line like this,
[main.c, line 175]
for (count = 0; count sizeof(card-digmix) / sizeof(card-digmix[0]);
count++) {
Isn't there some sort of `ALEN' macro available, or is this
Bill Pringlemeir wrote:
[main.c, line 175]
for (count = 0; count sizeof(card-digmix) / sizeof(card-digmix[0]);
count++) {
Isn't there some sort of `ALEN' macro available, or is this
considered to muddy things by using a macro?
Yes, we have array size
[main.c, line 223]
On 16 Jun 2001, Bill Pringlemeir wrote:
I have been looking at the emu10k1 driver and I had a few questions
about general idioms used there.
In a line like this,
[main.c, line 175]
for (count = 0; count sizeof(card-digmix) / sizeof(card-digmix[0]);
count++) {
Isn't there
Em Sat, Jun 16, 2001 at 09:35:34PM -0400, Richard B. Johnson escreveu:
[main.c, line 223]
if ((card-mpuout = kmalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL))
Why is the struct type referenced for the allocation size? Why not,
if ((card-mpuout =
38 matches
Mail list logo