From owner-svn-src-all@FreeBSD.ORG Sun May 10 02:19:28 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 66CD8476; Sun, 10 May 2015 02:19:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 473EC1EE5; Sun, 10 May 2015 02:19:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4A2JSIv080497; Sun, 10 May 2015 02:19:28 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4A2JR7O080495; Sun, 10 May 2015 02:19:27 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201505100219.t4A2JR7O080495@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 10 May 2015 02:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282702 - in head/sys/dev: iicbus ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2015 02:19:28 -0000 Author: loos Date: Sun May 10 02:19:27 2015 New Revision: 282702 URL: https://svnweb.freebsd.org/changeset/base/282702 Log: Remove unnecessary code and make use of generic implementations for bus_alloc_resource(), bus_release_resource() and bus_set_resource() (bus_generic_rl_alloc_resource(), bus_generic_rl_release_resource() and bus_generic_rl_set_resource() respectively). Do not print the resources for nomatch devices. Use the inherited method for bus_get_resource_list() on ofw_iicbus.c. Submitted by: jhb and Michal Meloun (D2033) Modified: head/sys/dev/iicbus/iicbus.c head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/dev/iicbus/iicbus.c ============================================================================== --- head/sys/dev/iicbus/iicbus.c Sat May 9 22:59:11 2015 (r282701) +++ head/sys/dev/iicbus/iicbus.c Sun May 10 02:19:27 2015 (r282702) @@ -159,9 +159,7 @@ iicbus_probe_nomatch(device_t bus, devic { struct iicbus_ivar *devi = IICBUS_IVAR(child); - device_printf(bus, " at addr %#x", devi->addr); - resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%ld"); - printf("\n"); + device_printf(bus, " at addr %#x\n", devi->addr); } static int @@ -233,57 +231,6 @@ iicbus_hinted_child(device_t bus, const } } -static int -iicbus_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) -{ - struct iicbus_ivar *devi; - struct resource_list_entry *rle; - - devi = IICBUS_IVAR(child); - rle = resource_list_add(&devi->rl, type, rid, start, - start + count - 1, count); - if (rle == NULL) - return (ENXIO); - - return (0); -} - -static struct resource * -iicbus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - struct resource_list *rl; - struct resource_list_entry *rle; - - /* Only IRQ resources are supported. */ - if (type != SYS_RES_IRQ) - return (NULL); - - /* - * Request for the default allocation with a given rid: use resource - * list stored in the local device info. - */ - if ((start == 0UL) && (end == ~0UL)) { - rl = BUS_GET_RESOURCE_LIST(bus, child); - if (rl == NULL) - return (NULL); - rle = resource_list_find(rl, type, *rid); - if (rle == NULL) { - if (bootverbose) - device_printf(bus, "no default resources for " - "rid = %d, type = %d\n", *rid, type); - return (NULL); - } - start = rle->start; - end = rle->end; - count = rle->count; - } - - return (bus_generic_alloc_resource(bus, child, type, rid, start, end, - count, flags)); -} - static struct resource_list * iicbus_get_resource_list(device_t bus __unused, device_t child) { @@ -368,14 +315,14 @@ static device_method_t iicbus_methods[] /* bus interface */ DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), + DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_alloc_resource, iicbus_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource_list, iicbus_get_resource_list), - DEVMETHOD(bus_set_resource, iicbus_set_resource), DEVMETHOD(bus_add_child, iicbus_add_child), DEVMETHOD(bus_print_child, iicbus_print_child), DEVMETHOD(bus_probe_nomatch, iicbus_probe_nomatch), Modified: head/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- head/sys/dev/ofw/ofw_iicbus.c Sat May 9 22:59:11 2015 (r282701) +++ head/sys/dev/ofw/ofw_iicbus.c Sun May 10 02:19:27 2015 (r282702) @@ -50,8 +50,6 @@ static device_t ofw_iicbus_add_child(dev const char *name, int unit); static const struct ofw_bus_devinfo *ofw_iicbus_get_devinfo(device_t bus, device_t dev); -static struct resource_list *ofw_iicbus_get_resource_list(device_t bus, - device_t child); static device_method_t ofw_iicbus_methods[] = { /* Device interface */ @@ -59,7 +57,6 @@ static device_method_t ofw_iicbus_method DEVMETHOD(device_attach, ofw_iicbus_attach), /* Bus interface */ - DEVMETHOD(bus_get_resource_list, ofw_iicbus_get_resource_list), DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), DEVMETHOD(bus_add_child, ofw_iicbus_add_child), @@ -205,12 +202,3 @@ ofw_iicbus_get_devinfo(device_t bus, dev dinfo = device_get_ivars(dev); return (&dinfo->opd_obdinfo); } - -static struct resource_list * -ofw_iicbus_get_resource_list(device_t bus __unused, device_t child) -{ - struct ofw_iicbus_devinfo *devi; - - devi = device_get_ivars(child); - return (&devi->opd_dinfo.rl); -}