Sat Dec 14 12:29:13 2019 UTC ()
Pull up following revision(s) (requested by mlelstev in ticket #552):

	sys/dev/i2c/i2c.c: revision 1.70

Revert previous. Indirect matches are not wanted on platforms that
use external configuration data (FDT or OF).


(martin)
diff -r1.69 -r1.69.4.1 src/sys/dev/i2c/i2c.c

cvs diff -r1.69 -r1.69.4.1 src/sys/dev/i2c/i2c.c (expand / switch to unified diff)

--- src/sys/dev/i2c/i2c.c 2019/03/26 09:20:38 1.69
+++ src/sys/dev/i2c/i2c.c 2019/12/14 12:29:13 1.69.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i2c.c,v 1.69 2019/03/26 09:20:38 mlelstv Exp $ */ 1/* $NetBSD: i2c.c,v 1.69.4.1 2019/12/14 12:29:13 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38#ifdef _KERNEL_OPT 38#ifdef _KERNEL_OPT
39#include "opt_i2c.h" 39#include "opt_i2c.h"
40#endif 40#endif
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.69 2019/03/26 09:20:38 mlelstv Exp $"); 43__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.69.4.1 2019/12/14 12:29:13 martin Exp $");
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/device.h> 47#include <sys/device.h>
48#include <sys/event.h> 48#include <sys/event.h>
49#include <sys/conf.h> 49#include <sys/conf.h>
50#include <sys/malloc.h> 50#include <sys/malloc.h>
51#include <sys/kmem.h> 51#include <sys/kmem.h>
52#include <sys/kthread.h> 52#include <sys/kthread.h>
53#include <sys/proc.h> 53#include <sys/proc.h>
54#include <sys/kernel.h> 54#include <sys/kernel.h>
55#include <sys/fcntl.h> 55#include <sys/fcntl.h>
56#include <sys/module.h> 56#include <sys/module.h>
@@ -709,42 +709,37 @@ iic_compatible_match(const struct i2c_at @@ -709,42 +709,37 @@ iic_compatible_match(const struct i2c_at
709 709
710/* 710/*
711 * iic_use_direct_match -- 711 * iic_use_direct_match --
712 * Helper for direct-config of i2c. Returns true if this is 712 * Helper for direct-config of i2c. Returns true if this is
713 * a direct-config situation, along with with match result. 713 * a direct-config situation, along with with match result.
714 * Returns false if the driver should use indirect-config 714 * Returns false if the driver should use indirect-config
715 * matching logic. 715 * matching logic.
716 */ 716 */
717bool 717bool
718iic_use_direct_match(const struct i2c_attach_args *ia, const cfdata_t cf, 718iic_use_direct_match(const struct i2c_attach_args *ia, const cfdata_t cf,
719 const struct device_compatible_entry *compats, 719 const struct device_compatible_entry *compats,
720 int *match_resultp) 720 int *match_resultp)
721{ 721{
722 int res; 
723 
724 KASSERT(match_resultp != NULL); 722 KASSERT(match_resultp != NULL);
725 723
726 if (ia->ia_name != NULL && 724 if (ia->ia_name != NULL &&
727 strcmp(ia->ia_name, cf->cf_name) == 0) { 725 strcmp(ia->ia_name, cf->cf_name) == 0) {
728 *match_resultp = I2C_MATCH_DIRECT_SPECIFIC; 726 *match_resultp = I2C_MATCH_DIRECT_SPECIFIC;
729 return true; 727 return true;
730 } 728 }
731 729
732 if (ia->ia_ncompat > 0 && ia->ia_compat != NULL) { 730 if (ia->ia_ncompat > 0 && ia->ia_compat != NULL) {
733 res = iic_compatible_match(ia, compats, NULL); 731 *match_resultp = iic_compatible_match(ia, compats, NULL);
734 if (res) { 732 return true;
735 *match_resultp = res; 
736 return true; 
737 } 
738 } 733 }
739 734
740 return false; 735 return false;
741} 736}
742 737
743static int 738static int
744iic_open(dev_t dev, int flag, int fmt, lwp_t *l) 739iic_open(dev_t dev, int flag, int fmt, lwp_t *l)
745{ 740{
746 struct iic_softc *sc = device_lookup_private(&iic_cd, minor(dev)); 741 struct iic_softc *sc = device_lookup_private(&iic_cd, minor(dev));
747 742
748 mutex_enter(&iic_mtx); 743 mutex_enter(&iic_mtx);
749 if (sc == NULL) { 744 if (sc == NULL) {
750 mutex_exit(&iic_mtx); 745 mutex_exit(&iic_mtx);