Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp240250lqr; Wed, 5 Jun 2024 04:58:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUb2qsBvLWxmSxGr719N3uQ2JNvK0NNndYKq9GaIvQcSsieMfF5YLllooG26R5y+J57mJphuHkX2tAt2JxY2d+wox2KbI58NvCmc8rDcw== X-Google-Smtp-Source: AGHT+IEZadvOK8Kwj1WqXmRiJb+2XuLewgeczpasei62XktCd5I2VjA5V07dbgcdzHj6x8S8rbht X-Received: by 2002:a05:6e02:b27:b0:374:b0d8:6c4 with SMTP id e9e14a558f8ab-374b1ee1c48mr24441105ab.3.1717588692870; Wed, 05 Jun 2024 04:58:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717588692; cv=pass; d=google.com; s=arc-20160816; b=nw4kfj+M1C9UTDYQdJ0k9MYo8cmLOx61jGELv97K7DZsB3kpE/rfhlHubT/JpPN4oG Qb1qh2zVSAdylnwDQKzjVoFY646rtK8QIGDmavM1v184NaWP5CkDbLsW7Sxm25uvo4EE yepA6RvHbc5/BKESCzFRaYlAYKvgoZkCIGwLo+95lREvWfDznZwEb1v1VyFJDOwc06Nb 3QIYJcw2hlx7gELcJARmqIgqqRZGFDV3E8dNlruhy58tHpqkebtFYpZ9Vy8lW0/t8pAV bHlLm2MAgy3UGOMjPeH+cmdb6TKviS7/5cXGot0z4wIKx9za1kK3VfNbruGYs0m/CVZe 1V6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=M3KHkOiRo15rPo/com6ahkDkzj/9OqGtBfPrYhCo9Lo=; fh=xb0yH9TBrlgH/i1Ds2cjcEBrhDIdMONrmeWuc57YIwg=; b=huMjfHSTI7oJrj92/RxeHxgtrqXfOwqIfPw1jHJHaXF1+HD2hySRXjYsEOZ4Arl0v3 1E1vkSncR/TUq7AstTvw5CYlQ/A519sgbUv1IP71u/78J4WHk9Z8g17gC+LLjWcHH1vE DSdk/byYVI6QI4581GIBuaLPurmTAusmmcIHd86l1/4Xcm6u8BrupUIbSho1EAIcVp62 WaMTORKiGsq661yaL1ZIAG/oyp/z54fPJWNp4ekHngBghGX+vahFk5+ep20MQxNdM6Cb wASpYUp+Mf/fMELRenLDiCfxfWtalwQw/S4Vy6VDfbeMEMdQyCM/xl1rOzmX9xfOKlnn FVTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MeZ4UL0+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540faffdsi2272512a12.34.2024.06.05.04.58.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 04:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MeZ4UL0+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 473D428C005 for ; Wed, 5 Jun 2024 11:50:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A558B194A4A; Wed, 5 Jun 2024 11:49:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MeZ4UL0+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF8D4193078; Wed, 5 Jun 2024 11:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588175; cv=none; b=Vva7jWzs+NApAPKvQeW3Rz1M/y+UbqFjimbQv+3pL74RsYtB1Ty1lcZD7PxhTvMSy3o0Xe9GeyUDv/LrH0yXXIoNSRSMac8vB8hmG4ZebpJxZKgTh3fAsF5bLNjslIyglJ1uDUMAdxrROMCVNvW5xq8HENvT4zFW8LhTfffD/qw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588175; c=relaxed/simple; bh=dfOEL015ORH+6IM7K8biVLVLo1OBKrxckpzA/YbrmQQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EIUJYJg6ByaP40Qgc6NrCYztQj8ZWoeB3WSQEpCr5eMxHr2ulaE3wYIOVwKCKlWuBmz1GMsPeJXdoI4Be06xQCgNn7bQKyEU/3cn5PU0mXQs0mjOn6CjkoqY57Xo/ypkxCY4UEl6LaCQle1oEy2EvpyjQrOUI9d5XlCjB5qbjw4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MeZ4UL0+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F2B7C32781; Wed, 5 Jun 2024 11:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588175; bh=dfOEL015ORH+6IM7K8biVLVLo1OBKrxckpzA/YbrmQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MeZ4UL0+pv31wDBY2zRXDV9fnzYtOaqnmFZC4FLIbHDhY8Z1q9R1ZF3s4R5RHG79s 7hosjCDCReBpDNWJ/biWE2acstMfIbD1QhxMyXa+tuwKKorSsvuO/bZvzL5jOzaeIa mJrog/9uQT1daJbRqM47+obJP2idFsOK7A5hC++hkX4Bai9E33kzfchjQ4T2sqkEvq RtDZSu35mSywu+ELrfdjkj+1x7pIqEmBjyTLuRv/PKdV9YOQu/QpBTNz7Ybs1NfCPp JOjtqsFsV4Ung+JsV8jzimSYagGZcyupwLMb/dqK6EUPLRTrbdmoXJXfGB1ufcjDtA cEC/pYh9SKzeQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dmitry Baryshkov , Heikki Krogerus , Greg Kroah-Hartman , Sasha Levin , neil.armstrong@linaro.org, quic_kriskura@quicinc.com, luca.weiss@fairphone.com, robh@kernel.org, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 6.9 04/28] usb: typec: ucsi_glink: rework quirks implementation Date: Wed, 5 Jun 2024 07:48:33 -0400 Message-ID: <20240605114927.2961639-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605114927.2961639-1-sashal@kernel.org> References: <20240605114927.2961639-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.9.3 Content-Transfer-Encoding: 8bit From: Dmitry Baryshkov [ Upstream commit 3f81cf54c1889eeecbb8d9188f5f2f597622170e ] In preparation to adding more quirks, extract quirks to the static variables and reference them through match->data. Otherwise adding more quirks will add the table really cumbersome. Signed-off-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20240329-qcom-ucsi-fixes-v2-8-0f5d37ed04db@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/ucsi_glink.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c index ce08eb33e5bec..0e6f837f6c31b 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -311,12 +311,14 @@ static void pmic_glink_ucsi_destroy(void *data) mutex_unlock(&ucsi->lock); } +static unsigned long quirk_sc8180x = UCSI_NO_PARTNER_PDOS; + static const struct of_device_id pmic_glink_ucsi_of_quirks[] = { - { .compatible = "qcom,qcm6490-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, - { .compatible = "qcom,sc8180x-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, - { .compatible = "qcom,sc8280xp-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, - { .compatible = "qcom,sm8350-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, - { .compatible = "qcom,sm8550-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, }, + { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8180x, }, + { .compatible = "qcom,sc8180x-pmic-glink", .data = &quirk_sc8180x, }, + { .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8180x, }, + { .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, }, + { .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sc8180x, }, {} }; @@ -354,7 +356,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev, match = of_match_device(pmic_glink_ucsi_of_quirks, dev->parent); if (match) - ucsi->ucsi->quirks = (unsigned long)match->data; + ucsi->ucsi->quirks = *(unsigned long *)match->data; ucsi_set_drvdata(ucsi->ucsi, ucsi); -- 2.43.0