Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-30 Thread Paul Mackerras
Alan Cox writes: > See the tty_port patches in -next - this is an argument about code which > ought eventually to go away replaced by standard helper functions. OK. In that case I think the best fix for the existing code is just to change the count to be int rather than unsigned int. Paul.

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-30 Thread Alan Cox
> Also, I don't see why those changes have anything to do with "unsigned > things cannot be negative". As long as those counts are never zero on > entry to those code sections, the existing code is fine, and I believe > that assertion can be maintained. If you believe the code needs to > defend a

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread Paul Mackerras
roel kluin writes: > unsigned hp->count and hvcsd->open_count cannot be negative ... > - if (--hvcsd->open_count == 0) { > + if (hvcsd->open_count == 1) { > + hvcsd->open_count--; Why are we no longer decrementing hvcsd->open_count in the cases where it is greater than 1? > -

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread Andreas Schwab
roel kluin <[EMAIL PROTECTED]> writes: > Andreas Schwab wrote: >> roel kluin <[EMAIL PROTECTED]> writes: >> >>> - if (--hvcsd->open_count == 0) { >>> + if (hvcsd->open_count == 1) { >>> + hvcsd->open_count--; >> >> This is not the same. > > I think you're missing that I also decrem

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread roel kluin
Andreas Schwab wrote: > roel kluin <[EMAIL PROTECTED]> writes: > >> -if (--hvcsd->open_count == 0) { >> +if (hvcsd->open_count == 1) { >> +hvcsd->open_count--; > > This is not the same. I think you're missing that I also decrement if (hvcsd->open_count > 1) If not, please ela

Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread Andreas Schwab
roel kluin <[EMAIL PROTECTED]> writes: > - if (--hvcsd->open_count == 0) { > + if (hvcsd->open_count == 1) { > + hvcsd->open_count--; This is not the same. > - if (--hp->count == 0) { > + if (hp->count == 1) { > + hp->count--; Likewise. Andreas. -- And

powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative

2008-11-29 Thread roel kluin
unsigned hp->count and hvcsd->open_count cannot be negative Signed-off-by: Roel Kluin <[EMAIL PROTECTED]> --- Both members of respectively struct hvcs_struct, see vi drivers/char/hvcs.c +262 and struct hvcs_struct, see vi drivers/char/hvsi.c +70 diff --git a/drivers/char/hvcs.c b/drivers/char/hv