Messages in this thread | | | Date | Wed, 13 Aug 2008 00:07:22 +0200 | From | Pavel Machek <> | Subject | Re: [PATCH 01/01][retry 1] x86: L3 cache index disable for 2.6.26 |
| |
> > > + for (i = 0; i < 2; i++) { > > > + unsigned int reg = 0; > > > + > > > + pci_read_config_dword(dev, 0x1BC + i * 4, ®); > > > + > > > + ret += sprintf(buf, "%s %x\t", buf, reg); > > > + } > > > + ret += sprintf(buf,"%s\n", buf); > > > > So you print "buf" few times? Why? And you use both \t and \n > > as deliminer... > > I'm printing the values of the two config registers into > the string buffer, separated by tabs, and terminated by > an EOL. Is there a prefered way to do that instead of > what I have?
Hmm, I misparsed that.
Yes, we have some helpers for sysfs writing... SEQ_printf(), IIRC.
Is this even valid C?
ret += sprintf(buf, "%s %x\t", buf, reg);
You are printing into buffer you are passing as argument. That seems fragile.
Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
| |