All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wink Saville <wink@saville.com>
To: linux-kernel@vger.kernel.org,
	Johannes Weiner <hannes-kernel@saeurebad.de>
Subject: Re: [PATCH 2/7] Initial implementation of the trec driver and include files
Date: Wed, 21 Mar 2007 09:49:12 -0700	[thread overview]
Message-ID: <46016208.3040303@saville.com> (raw)
In-Reply-To: <20070321082238.GA16768@leiferikson>

Johannes Weiner wrote:
> Your patch has broken lines where there shouldn't be any.
>   
OK.

>> +	struct trec_buffer_struct *	pNext;
>> +	struct trec_struct *		pCur;
>> +	struct trec_struct *		pEnd;
>> Please don't use camel-case - in general.
>>     
Would p_next, p_cur and p_end be OK?
>   
>> +static int snprint_address(char *b, int bsize, unsigned long address)
>> +{
>> +#ifdef CONFIG_KALLSYMS
>> +	unsigned long offset = 0, symsize;
>>     
>> +#else
>> +	return snprintf(b, bsize, "0x%016lx", address);
>> +#endif
>> +}
>>     
>
> Would it make sense to #ifdef the whole function?
> Make it static int (*)(...) if CONFIG_KALLSYMS and otherwise just a
> static inline int (*)(...) { return 0; }
>   
Maybe, but I think just letting the compiler decide is better.
>   
>> [...]
>> +static int trec_device_init(void)
>> +{
>> +	int 		result;
>> +		DPK("trec_device_init: cdev_add failed\n");
>> +		goto done;
>>     
>
> If you jump to `done' here, unregister_chrdev_region is never called.
>
> You should also declare trec_device_init as __init and trex_device_exit
> as __exit.
>   
I'll fix this.
>   
>> --- /dev/null
>> +++ b/include/linux/trec.h
>> @@ -0,0 +1,34 @@
>> +/*
>> +#define TREC0()			trec_write(TREC_PC_ADDR, TREC_PID, 0, 0)
>>     

>> +
>> +#define ZREC0()			do { } while (0)
>>     
> Why not seperate them by an #ifndef? So you don't have to replace TREC?
> with ZREC? but rather change one #define knob.
>
> =Hannes
>
>   

The reason is to allow the user easily change individual TREC's from 
active to inactive by just
changing a single character. Eventually I envision adding runtime 
support for changing if a
particular set of TREC's are active or not, but this was simple.

Thanks for the feed back.


Wink


  parent reply	other threads:[~2007-03-21 16:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21  6:47 [PATCH 2/7] Initial implementation of the trec driver and include files Wink Saville
2007-03-21  8:22 ` Johannes Weiner
2007-03-21  8:37   ` Johannes Weiner
2007-03-21 16:49   ` Wink Saville [this message]
2007-03-21 18:17     ` Johannes Weiner
2007-03-22  4:59       ` Wink Saville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46016208.3040303@saville.com \
    --to=wink@saville.com \
    --cc=hannes-kernel@saeurebad.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.