Date: Mon, 20 Apr 2015 21:45:39 +0000 (UTC) From: Sean Bruno <sbruno@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r281796 - projects/em_mq/sys/dev/e1000 Message-ID: <201504202145.t3KLjd7d077148@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sbruno Date: Mon Apr 20 21:45:38 2015 New Revision: 281796 URL: https://svnweb.freebsd.org/changeset/base/281796 Log: Don't blindly assume that the softc returned is going to match up to the em(4) notion of what an adapter struct is. Check to see if the device matches *first* and *then* assume that we can use it as an adapter structure for parsing. Corrections and hints courtesy of jhb. Modified: projects/em_mq/sys/dev/e1000/if_em.c Modified: projects/em_mq/sys/dev/e1000/if_em.c ============================================================================== --- projects/em_mq/sys/dev/e1000/if_em.c Mon Apr 20 21:44:55 2015 (r281795) +++ projects/em_mq/sys/dev/e1000/if_em.c Mon Apr 20 21:45:38 2015 (r281796) @@ -5977,19 +5977,16 @@ em_enable_vectors_82574(struct adapter * DB_COMMAND(em_dump_queue, em_ddb_dump_queue) { devclass_t dc; - struct adapter *adapter; int max_em; dc = devclass_find("em"); max_em = devclass_get_maxunit(dc); - db_printf("max_em %d\n", max_em); for (int index = 0; index < (max_em - 1); index++) { - driver_t *em; - adapter = devclass_get_softc(dc, index); - em = device_get_driver(adapter->dev); - if (em == &em_driver) - em_print_debug_info(adapter); + device_t dev; + dev = devclass_get_device(dc, index); + if (device_get_driver(dev) == &em_driver) + em_print_debug_info(device_get_softc(dev)); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504202145.t3KLjd7d077148>