Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp878732rdb; Sun, 1 Oct 2023 09:11:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHs78zcQZymhDx+JevRS/muLNTlc88SCWdiroo5zGRC2Y5Ucb0WrYmvHeWED4AHsBSWYPGF X-Received: by 2002:a05:6870:3294:b0:1d6:51aa:13a2 with SMTP id q20-20020a056870329400b001d651aa13a2mr11302297oac.10.1696176667046; Sun, 01 Oct 2023 09:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696176666; cv=none; d=google.com; s=arc-20160816; b=G9UhxutuotDJmGc/TrsmwVmgWZ8ytbue+c+9RZCkfYu7bPF8QEP/fMOTarXme2MB1u 3fV7dW9Pifu/iUzoLj74f8efbMNgYx0UYQ/QE/gKkJC/kn2VQg0N70aPrX81MdQ6XHJT W4zXADXUpqvsGvbPFhsIGLZ5MKD3gs5/VVPHHQuBgbrx+3YPdCwvN7gKYrRGiFOYEioE c1O4tpJGNntodvt89T/qH1JKWtEGXr1wkFgllKp5rP4WiYGqjLOAnhbD/MAcIRk1gNUJ SiY5UotvjGlsL1SzhamXvgZjAxMHv4YToaBE5nr0wcgM+hl9pl9I9K+OJHK+hwLYRC2V 5XVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from; bh=K5mGJHgjo9RuwYQe4iuyH1Qka9Tu9eOlzlxQkUA1dp8=; fh=P1oX3TMfPecu9Ra+L7DM5V0AqB+xXk+R6KpVEJdIhNI=; b=BrN5loXcqvEJ7ea+xovZ3aNK27hRgfZiAvIac/Sy+S/EXhz7CAe+zR44VP/f6aesnv EfbT2/gFE149qRDoQiW+aJqfX+lbFMljhzrOQH+vGfbwk7jox0+D9zpJ1ajuGeOpmC3g RatUtqTZ6Tj1e1ChiZWBNWHfHY4RB4Y4US+uPiOuzCP/t4/rMuOAwUL3lIw989q67zKr R5/2KFnmmuRuiomMyog5VDdYVRAj1atJswWg3qtxmmuo//XszI4gW1PIjQhQnG9jdh9f FT+eIhkZ8ZWsQM+lBdiJoTA2kMB6C8gFQ+dN1MqJAmrjim3RxxoJp3Xl1LJPeXT06UD2 rUwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bv124-20020a632e82000000b0056da0ae25cfsi24394914pgb.196.2023.10.01.09.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 09:11:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E2BDC8038B38; Sun, 1 Oct 2023 09:11:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235192AbjJAQKz (ORCPT + 99 others); Sun, 1 Oct 2023 12:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235155AbjJAQKy (ORCPT ); Sun, 1 Oct 2023 12:10:54 -0400 Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47989DA for ; Sun, 1 Oct 2023 09:10:51 -0700 (PDT) Received: from [92.206.139.21] (helo=note-book.lan) by smtprelay05.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qmz1l-0008CX-Ob; Sun, 01 Oct 2023 18:10:41 +0200 From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Date: Sun, 01 Oct 2023 18:09:56 +0200 Subject: [PATCH] iio: magnetometer: ak8975: Fix 'Unexpected device' error MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231001-ak_magnetometer-v1-1-09bf3b8798a3@apitzsch.eu> X-B4-Tracking: v=1; b=H4sIANOZGWUC/x3MQQqAIBBA0avIrBNGhaiuEhGWUw2RhkoE0d2Tl m/x/wOJIlOCTjwQ6eLEwReoSsC8Wb+SZFcMGrVRiErafTzs6imHgzJFOWFtsG2w0c5Bqc5IC9/ /sR/e9wOgT7D+YQAAAA== To: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Biju Das Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Apitzsch?= X-Mailer: b4 0.12.3 X-Df-Sender: YW5kcmVAYXBpdHpzY2guZXU= X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 01 Oct 2023 09:11:01 -0700 (PDT) Explicity specify array indices to fix mapping between asahi_compass_chipset and ak_def_array. While at it, remove unneeded AKXXXX. Fixes: 4f9ea93afde1 ("iio: magnetometer: ak8975: Convert enum->pointer for data in the match tables") Signed-off-by: André Apitzsch --- drivers/iio/magnetometer/ak8975.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 8cfceb007936..dd466c5fa621 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -204,7 +204,6 @@ static long ak09912_raw_to_gauss(u16 data) /* Compatible Asahi Kasei Compass parts */ enum asahi_compass_chipset { - AKXXXX = 0, AK8975, AK8963, AK09911, @@ -248,7 +247,7 @@ struct ak_def { }; static const struct ak_def ak_def_array[] = { - { + [AK8975] = { .type = AK8975, .raw_to_gauss = ak8975_raw_to_gauss, .range = 4096, @@ -273,7 +272,7 @@ static const struct ak_def ak_def_array[] = { AK8975_REG_HYL, AK8975_REG_HZL}, }, - { + [AK8963] = { .type = AK8963, .raw_to_gauss = ak8963_09911_raw_to_gauss, .range = 8190, @@ -298,7 +297,7 @@ static const struct ak_def ak_def_array[] = { AK8975_REG_HYL, AK8975_REG_HZL}, }, - { + [AK09911] = { .type = AK09911, .raw_to_gauss = ak8963_09911_raw_to_gauss, .range = 8192, @@ -323,7 +322,7 @@ static const struct ak_def ak_def_array[] = { AK09912_REG_HYL, AK09912_REG_HZL}, }, - { + [AK09912] = { .type = AK09912, .raw_to_gauss = ak09912_raw_to_gauss, .range = 32752, @@ -348,7 +347,7 @@ static const struct ak_def ak_def_array[] = { AK09912_REG_HYL, AK09912_REG_HZL}, }, - { + [AK09916] = { .type = AK09916, .raw_to_gauss = ak09912_raw_to_gauss, .range = 32752, --- base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6 change-id: 20231001-ak_magnetometer-b063098082dd Best regards, -- André Apitzsch