Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Oct 2006 15:45:51 +0200
From:      "usleepless" <usleepless@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/104882: pvr250 and pvrxxx drivers need iicbb patched 
Message-ID:  <20061028134553.0149643D81@mx1.FreeBSD.org>
Resent-Message-ID: <200610281350.k9SDoHG6040288@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         104882
>Category:       kern
>Synopsis:       pvr250 and pvrxxx drivers need iicbb patched
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 28 13:50:17 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     usleepless
>Release:        FreeBSD 6.1-RELEASE-p10 i386
>Organization:
none 
>Environment:
System: FreeBSD x.y.z 6.1-RELEASE-p10 FreeBSD 6.1-RELEASE-p10 #18: Thu Oct 26 12:53:20 CEST 2006 usleepless@x.y.z:/usr/obj/usr/src/sys/CUSTOM_FBSD6 i386


	
>Description:
The multimedia/pvr250 and multimedia/pvrxxx drivers need the kernel patched to function properly. This is confusing for not so savvy users, and an annoyance for others ( for example when updating your system, you will have to go through this again ). As far as i have been able to verify, this patch does not cause any harm to other iicbb users ( bktr for example ).

	
>How-To-Repeat:
Install multimedia/pvr250 or multimedia/pvrxxx
	
>Fix:
Please see attached patch ( which applies cleanly for 6.x as well )
	

--- Patch.iicbb-fbsd5 begins here ---
*** dev/iicbus/iicbb.c.ORIGINAL	Sun Aug 24 13:49:13 2003
--- dev/iicbus/iicbb.c	Fri Jul  1 15:55:21 2005
*************** struct iicbb_softc {
*** 66,71 ****
--- 66,72 ----
  static int iicbb_probe(device_t);
  static int iicbb_attach(device_t);
  static int iicbb_detach(device_t);
+ static void iicbb_child_detached(device_t, device_t);
  static int iicbb_print_child(device_t, device_t);
  
  static int iicbb_callback(device_t, int, caddr_t);
*************** static device_method_t iicbb_methods[] =
*** 82,87 ****
--- 83,89 ----
  	DEVMETHOD(device_detach,	iicbb_detach),
  
  	/* bus interface */
+ 	DEVMETHOD(bus_child_detached,	iicbb_child_detached),
  	DEVMETHOD(bus_print_child,	iicbb_print_child),
  
  	/* iicbus interface */
*************** static int iicbb_attach(device_t dev)
*** 130,144 ****
  static int iicbb_detach(device_t dev)
  {
  	struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev);
  
! 	if (sc->iicbus) {
! 		bus_generic_detach(dev);
! 		device_delete_child(dev, sc->iicbus);
! 	}
  
  	return (0);
  }
  
  static int
  iicbb_print_child(device_t bus, device_t dev)
  {
--- 132,165 ----
  static int iicbb_detach(device_t dev)
  {
  	struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev);
+ 	device_t child;
  
! 	/*
! 	 * Detach the children before recursively deleting
! 	 * in case a child has a pointer to a grandchild
! 	 * which is used by the child's detach routine.
! 	 *
! 	 * Remember the child before detaching so we can
! 	 * delete it (bus_generic_detach indirectly zeroes
! 	 * sc->child_dev).
! 	 */
! 	child = sc->iicbus;
! 	bus_generic_detach(dev);
! 	if (child)
! 		device_delete_child(dev, child);
  
  	return (0);
  }
  
+ static void
+ iicbb_child_detached( device_t dev, device_t child )
+ {
+ 	struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev);
+ 
+ 	if (child == sc->iicbus)
+ 		sc->iicbus = NULL;
+ }
+ 
  static int
  iicbb_print_child(device_t bus, device_t dev)
  {
*************** static int iicbb_read(device_t dev, char
*** 383,388 ****
--- 404,410 ----
  }
  
  DRIVER_MODULE(iicbb, bktr, iicbb_driver, iicbb_devclass, 0, 0);
+ DRIVER_MODULE(iicbb, cxm_iic, iicbb_driver, iicbb_devclass, 0, 0);
  DRIVER_MODULE(iicbb, lpbb, iicbb_driver, iicbb_devclass, 0, 0);
  DRIVER_MODULE(iicbb, viapm, iicbb_driver, iicbb_devclass, 0, 0);
  
*** dev/iicbus/iicbus_if.m.ORIGINAL	Wed Apr 13 14:25:01 2005
--- dev/iicbus/iicbus_if.m	Mon Oct 24 00:51:05 2005
*************** METHOD int read {
*** 90,96 ****
  #
  METHOD int write {
  	device_t dev;
! 	char *buf;
  	int len;
  	int *bytes;
  	int timeout;
--- 90,96 ----
  #
  METHOD int write {
  	device_t dev;
! 	const char *buf;
  	int len;
  	int *bytes;
  	int timeout;
*** dev/iicbus/iiconf.h.ORIGINAL	Wed Jun 16 22:51:57 2004
--- dev/iicbus/iiconf.h	Mon Oct 24 00:43:41 2005
*************** extern int iicbus_started(device_t);
*** 114,120 ****
  extern int iicbus_start(device_t, u_char, int);
  extern int iicbus_stop(device_t);
  extern int iicbus_repeated_start(device_t, u_char, int);
! extern int iicbus_write(device_t, char *, int, int *, int);
  extern int iicbus_read(device_t, char *, int, int *, int, int);
  
  /* single byte read/write functions, start/stop not managed */
--- 114,120 ----
  extern int iicbus_start(device_t, u_char, int);
  extern int iicbus_stop(device_t);
  extern int iicbus_repeated_start(device_t, u_char, int);
! extern int iicbus_write(device_t, const char *, int, int *, int);
  extern int iicbus_read(device_t, char *, int, int *, int, int);
  
  /* single byte read/write functions, start/stop not managed */
*** dev/iicbus/iiconf.c.ORIGINAL	Wed Jun 16 22:51:57 2004
--- dev/iicbus/iiconf.c	Mon Oct 24 00:47:32 2005
*************** iicbus_stop(device_t bus)
*** 234,240 ****
   * iicbus_start() call
   */
  int
! iicbus_write(device_t bus, char *buf, int len, int *sent, int timeout)
  {
  	struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
  	
--- 234,240 ----
   * iicbus_start() call
   */
  int
! iicbus_write(device_t bus, const char *buf, int len, int *sent, int timeout)
  {
  	struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
  	
--- Patch.iicbb-fbsd5 ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061028134553.0149643D81>