Re: bktr(4) bufs plus patch

2003-09-04 Thread Michal Mertl
On Wed, 3 Sep 2003, Jens Rehsack wrote:
 Michal Mertl wrote:
  I found 2 bugs and some potential problems in bktr(4) code.
 
  Bug 1:
  Compilation with options BKTR_USE_FREEBSD_SMBUS failes. Error is
  that code tries to use iicbus which isn't defined where it looks for
  it. I added it there and the compilation and detection goes fine. I don't
  know how to actually test it though.
 

 [...]

 Will anyone responsible take notice of this patch and commit it?

  
 
  *** dev/bktr/bktr_reg.h.ori Sun Dec  8 10:40:14 2002
  --- dev/bktr/bktr_reg.h Sun Dec  8 10:40:38 2002
  ***
  *** 448,453 
  --- 448,454 
struct bktr_i2c_softc {
  int bus_owned;
 
  +   device_t iicbus;
  device_t iicbb;
  device_t smbus;
};
  *** dev/bktr/bktr_os.c.ori  Sun Dec  8 10:39:13 2002
  --- dev/bktr/bktr_os.c  Sun Dec  8 10:39:35 2002
  ***
  *** 499,513 
  destroy_dev(bktr-tunerdev);
  destroy_dev(bktr-bktrdev);
 
  -   /* If this is unit 0, then destroy the alias entries too */
  - #if (__FreeBSD_version =50)
  -   if (unit == 0) {
  -   destroy_dev(bktr-vbidev_alias);
  -   destroy_dev(bktr-tunerdev_alias);
  -   destroy_dev(bktr-bktrdev_alias);
  -   }
  - #endif
  -
  /*
   * Deallocate resources.
   */
  --- 499,504 

The destroy_dev calls for aliases have been removed in -current on 9th Dec
2002 (one day after I sent the email). See PR kern/36413. The fix hasn't
been MFCed but there's no need - the code is wrapped in '#if
(__FreeBSD_version = 50)'. The fix for BKTR_USE_FREEBSD_SMBUS hasn't
been commited.

I didn't send-pr but will recheck the status of things over the weekend
and perhaps will do.

To other readers: in my original email
(http://docs.freebsd.org/cgi/getmsg.cgi?fetch=2276+0+archive/2002/freebsd-current/20021215.freebsd-current)
I talked about another problem (limits on the maximum number of devices).
When I reread what I wrote at the time I have to say 'sorry for my
English' :-).

-- 
Michal Mertl
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: bktr(4) bufs plus patch

2003-09-03 Thread Jens Rehsack
Michal Mertl wrote:
I found 2 bugs and some potential problems in bktr(4) code.

Bug 1:
Compilation with options BKTR_USE_FREEBSD_SMBUS failes. Error is
that code tries to use iicbus which isn't defined where it looks for
it. I added it there and the compilation and detection goes fine. I don't
know how to actually test it though.
[...]

Will anyone responsible take notice of this patch and commit it?



*** dev/bktr/bktr_reg.h.ori	Sun Dec  8 10:40:14 2002
--- dev/bktr/bktr_reg.h	Sun Dec  8 10:40:38 2002
***
*** 448,453 
--- 448,454 
  struct bktr_i2c_softc {
  	int bus_owned;
  
+ 	device_t iicbus;
  	device_t iicbb;
  	device_t smbus;
  };
*** dev/bktr/bktr_os.c.ori	Sun Dec  8 10:39:13 2002
--- dev/bktr/bktr_os.c	Sun Dec  8 10:39:35 2002
***
*** 499,513 
  	destroy_dev(bktr-tunerdev);
  	destroy_dev(bktr-bktrdev);
  
- 	/* If this is unit 0, then destroy the alias entries too */
- #if (__FreeBSD_version =50)
- 	if (unit == 0) {
- 	destroy_dev(bktr-vbidev_alias);
- 	destroy_dev(bktr-tunerdev_alias);
- 	destroy_dev(bktr-bktrdev_alias);
- 	}
- #endif
- 
  	/*
  	 * Deallocate resources.
  	 */
--- 499,504 


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: bktr(4) bufs plus patch

2003-09-03 Thread John-Mark Gurney
Jens Rehsack wrote this message on Wed, Sep 03, 2003 at 22:03 +:
 Michal Mertl wrote:
 I found 2 bugs and some potential problems in bktr(4) code.
 
 Bug 1:
 Compilation with options BKTR_USE_FREEBSD_SMBUS failes. Error is
 that code tries to use iicbus which isn't defined where it looks for
 it. I added it there and the compilation and detection goes fine. I don't
 know how to actually test it though.
 
 
 [...]
 
 Will anyone responsible take notice of this patch and commit it?

I'm not responsible, but I will take notice of it.  Once I get my lab
up and running (hopefully in the next week), I can test this and see how
it works.  Could we get it submitted as a pr (if it isn't already), and
assign it to me?  (I'll assign it to myself once I know the PR).

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 All that I will do, has been done, All that I have, has not.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: bktr(4) bufs plus patch

2003-09-03 Thread Jens Rehsack
John-Mark Gurney wrote:
Jens Rehsack wrote this message on Wed, Sep 03, 2003 at 22:03 +:

Michal Mertl wrote:

I found 2 bugs and some potential problems in bktr(4) code.

Bug 1:
Compilation with options BKTR_USE_FREEBSD_SMBUS failes. Error is
that code tries to use iicbus which isn't defined where it looks for
it. I added it there and the compilation and detection goes fine. I don't
know how to actually test it though.
[...]

Will anyone responsible take notice of this patch and commit it?


I'm not responsible, but I will take notice of it.  Once I get my lab
up and running (hopefully in the next week), I can test this and see how
it works.  Could we get it submitted as a pr (if it isn't already), and
assign it to me?  (I'll assign it to myself once I know the PR).
This should be done by Michal, because it's the original submitter and
seems to have made deep research :-)
Jens

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to [EMAIL PROTECTED]


bktr(4) bufs plus patch

2002-12-08 Thread Michal Mertl
I found 2 bugs and some potential problems in bktr(4) code.

Bug 1:
Compilation with options BKTR_USE_FREEBSD_SMBUS failes. Error is
that code tries to use iicbus which isn't defined where it looks for
it. I added it there and the compilation and detection goes fine. I don't
know how to actually test it though.

Bug 2:
On module unload destroy_dev(9) is called on dev_alias which leads to
panic. According to MAKE_DEV(9) it's forbidden. The patch removes the code
to remove aliases. All seems to work fine.


Problem 1:
When using bktr(4) in a module, there's a helper module
bktr_mem, which allocates memory for bktr(4) devices. There is fixed limit
(#define BKTR_MEM_MAX_DEVICES 8 in bktr_mem.h) on number of devices
supported - it should at least be mentioned somewhere and possibly raised
- I have 16 devices and soon will be using more.

Problem 2:
There's another limit on number of bktr(4) devices in device creation
on lines 443-448 in bktr_os.c.
bktr-bktrdev = make_dev(bktr_cdevsw, unit,
0, 0, 0444, bktr%d,  unit);
bktr-tunerdev= make_dev(bktr_cdevsw, unit+16,
0, 0, 0444, tuner%d, unit);
bktr-vbidev  = make_dev(bktr_cdevsw, unit+32,
0, 0, 0444, vbi%d  , unit);

If I read the code right it seems to limit the maximum number of devices
to 16. I don't see why it can't be much more here - say 256 (so change +16
to +256 and +32 to +512. In DEVFS world users should care about
majors/minors but with normal /dev it could be problem.

Problem 3: (affacting mainly STABLE)
In MAKEDEV there's only one char allowed so one can create only 10
devices. Patch could look like this:

*** MAKEDEV.ori Sun Dec  8 11:02:38 2002
--- MAKEDEV Sun Dec  8 11:07:01 2002
***
*** 1552,1559 
chmod 444 meteor$unit
;;

! bktr?)
unit=`expr $i : 'bktr\(.*\)'`
mknod bktr$unit c 92 `unit2minor $unit`
mknod tuner$unit c 92 `unit2minor $((16 + $unit))`
mknod vbi$unit c 92 `unit2minor $((32 + $unit))`
--- 1552,1562 
chmod 444 meteor$unit
;;

! bktr*)
unit=`expr $i : 'bktr\(.*\)'`
+   if [ ${unit} -lt 0 -o ${unit} -gt 15 ]; then
+   die 3 bktr(4) unit limited to 0-15
+   fi
mknod bktr$unit c 92 `unit2minor $unit`
mknod tuner$unit c 92 `unit2minor $((16 + $unit))`
mknod vbi$unit c 92 `unit2minor $((32 + $unit))`

-- 
Michal Mertl
[EMAIL PROTECTED]


*** dev/bktr/bktr_reg.h.ori Sun Dec  8 10:40:14 2002
--- dev/bktr/bktr_reg.h Sun Dec  8 10:40:38 2002
***
*** 448,453 
--- 448,454 
  struct bktr_i2c_softc {
int bus_owned;
  
+   device_t iicbus;
device_t iicbb;
device_t smbus;
  };
*** dev/bktr/bktr_os.c.ori  Sun Dec  8 10:39:13 2002
--- dev/bktr/bktr_os.c  Sun Dec  8 10:39:35 2002
***
*** 499,513 
destroy_dev(bktr-tunerdev);
destroy_dev(bktr-bktrdev);
  
-   /* If this is unit 0, then destroy the alias entries too */
- #if (__FreeBSD_version =50)
-   if (unit == 0) {
-   destroy_dev(bktr-vbidev_alias);
-   destroy_dev(bktr-tunerdev_alias);
-   destroy_dev(bktr-bktrdev_alias);
-   }
- #endif
- 
/*
 * Deallocate resources.
 */
--- 499,504