From patchwork Tue Apr 19 22:57:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA60EC433F5 for ; Tue, 19 Apr 2022 22:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347110AbiDSXBG (ORCPT ); Tue, 19 Apr 2022 19:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245617AbiDSXBE (ORCPT ); Tue, 19 Apr 2022 19:01:04 -0400 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D542A38BDA for ; Tue, 19 Apr 2022 15:58:20 -0700 (PDT) Received: by mail-pl1-f176.google.com with SMTP id n18so105048plg.5 for ; Tue, 19 Apr 2022 15:58:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F/iOw+gHdiWQR3SIajPkkOTVTmstHvMuCOpTsWqlTrg=; b=XN1gu2cpAFtCjrAkPqctXtkaG5NtS9VwCdYzMuH5Q+mdppT+aini6Jn2rrB1bj/Rdd LwfEZ7+sysNabQldigba9Se3eSWAzQIjshhaHdQv/sCr8k68dozZ1VIScUZBkH2xeJxz yeoghY8TIK53nR9kEXj5zrL4u1KAB5xUnmVToGw3/sDhOmom3y8585/MF95uAcqiFoEr ev/WYbcGhQx+W8XZgFO/xPVBG8uAqr1wCeAN3XyGscQhZbAnfAa6fq9cB0emUXVTaYC1 ZcV1p2bmoWn8huMTS3tCpYNxLAwg31lten1wtzLme958TjwL2ZqqFRQn5yqeM0kSbF+7 fyBg== X-Gm-Message-State: AOAM530yDSKM+4mNsbl0Cxy+xtL9LGmb+b1KZkrZf7uVFlmLzYQOui1A POvKFAmyu304zRVmTL+Pq6Y= X-Google-Smtp-Source: ABdhPJydocEl6jMvO6j8Oec1wxTuQtmoFv80ow2Wbp+zQO3T39MeomqHXOJJ3bIQuC5VVUhHQHPTdw== X-Received: by 2002:a17:902:bcca:b0:153:88c7:a02 with SMTP id o10-20020a170902bcca00b0015388c70a02mr18017979pls.112.1650409100319; Tue, 19 Apr 2022 15:58:20 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:19 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 01/28] scsi: ufs: Fix a spelling error in a source code comment Date: Tue, 19 Apr 2022 15:57:44 -0700 Message-Id: <20220419225811.4127248-2-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Change one occurrence of "adpater" into "adapter". Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/unipro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index 8e9e486a4f7b..705a6465ba5c 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/drivers/scsi/ufs/unipro.h @@ -103,7 +103,7 @@ #define UNIPRO_CB_OFFSET(x) (0x8000 | x) /* - * PHY Adpater attributes + * PHY Adapter attributes */ #define PA_ACTIVETXDATALANES 0x1560 #define PA_ACTIVERXDATALANES 0x1580 From patchwork Tue Apr 19 22:57:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C664C433F5 for ; Tue, 19 Apr 2022 22:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347166AbiDSXBM (ORCPT ); Tue, 19 Apr 2022 19:01:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347127AbiDSXBG (ORCPT ); Tue, 19 Apr 2022 19:01:06 -0400 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E2F338781 for ; Tue, 19 Apr 2022 15:58:23 -0700 (PDT) Received: by mail-pl1-f178.google.com with SMTP id c23so143065plo.0 for ; Tue, 19 Apr 2022 15:58:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kFrJiGoPLc1JlPkJ2qqLkZ4QwtfRPN1jzG22aAKAJhk=; b=LpMqQTIgbL7tZfJ2OgZcMg8dKOOHZ8xslgJc4RH9s3RK/ADPMfo+T2SDGMu6fKh6Sf BAsmgjy+wLYmP7WkwsPPNqdQ88Ws7kxcD9qYt9L/wi9bclqHxs3+41b3ZYLhYtRHv5p4 /7SrNWt2Wqi/mXBszsNFlafq/oYHAJCvefaGw5Fdlctj9kLTTX/nm4mtrT7UeJIOqXyg Txv14HvZH/pBagpcs98OzHNMIWrHi5uo1+bgRjx46GWX8xHtoGDFpp0YuuXH7YXpY9j7 zmDbj/AnPjtiRW2B6wZTp85vGWP1b2ktwhZ2BvZsZcjzKzddCZ9p5nh2xTj4QWHchCus oYOQ== X-Gm-Message-State: AOAM533VZUed15ZFbUvYwLGF1zPmlTmErnoUf6j7JhXoQkDPZWlnLeUK YhrcgTJNIH7wz7j+rrJdmAM= X-Google-Smtp-Source: ABdhPJxpuWFZ0Zh9A/v1o+e+OWV1VS4+f/1AHuigN5xnTvS6k7NTVz6OnYBqV2/EXtijo6Xa+zXnew== X-Received: by 2002:a17:90b:1e0b:b0:1d2:dabc:9929 with SMTP id pg11-20020a17090b1e0b00b001d2dabc9929mr980995pjb.39.1650409102610; Tue, 19 Apr 2022 15:58:22 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:21 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , Bean Huo Subject: [PATCH v3 02/28] scsi: ufs: Declare ufshcd_wait_for_register() static Date: Tue, 19 Apr 2022 15:57:45 -0700 Message-Id: <20220419225811.4127248-3-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Declare this function static since it is only used inside the ufshcd.c source file. Reviewed-by: Avri Altman Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 2 +- drivers/scsi/ufs/ufshcd.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3f9caafa91bf..dbf50b50870b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -639,7 +639,7 @@ EXPORT_SYMBOL_GPL(ufshcd_delay_us); * Return: * -ETIMEDOUT on error, zero on success. */ -int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, +static int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, u32 val, unsigned long interval_us, unsigned long timeout_ms) { diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 88c20f3608c2..949427714d0e 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1030,9 +1030,6 @@ void ufshcd_remove(struct ufs_hba *); int ufshcd_uic_hibern8_enter(struct ufs_hba *hba); int ufshcd_uic_hibern8_exit(struct ufs_hba *hba); void ufshcd_delay_us(unsigned long us, unsigned long tolerance); -int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, - u32 val, unsigned long interval_us, - unsigned long timeout_ms); void ufshcd_parse_dev_ref_clk_freq(struct ufs_hba *hba, struct clk *refclk); void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val); void ufshcd_hba_stop(struct ufs_hba *hba); From patchwork Tue Apr 19 22:57:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35262C433EF for ; Tue, 19 Apr 2022 22:58:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347247AbiDSXBN (ORCPT ); Tue, 19 Apr 2022 19:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232954AbiDSXBI (ORCPT ); Tue, 19 Apr 2022 19:01:08 -0400 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39EC0387A7 for ; Tue, 19 Apr 2022 15:58:25 -0700 (PDT) Received: by mail-pf1-f181.google.com with SMTP id x80so208846pfc.1 for ; Tue, 19 Apr 2022 15:58:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vAvAdPiV+CMBL3q1ZKpWhCqvgC6GS7287yjxaluRU7M=; b=npQn+DF8QRpFT4UgYeox99CP9oniM86Gv935dEwqxG73pC2Bg/yMka7M7txO24WPSO UJSIPA+2kJairjYUHwU93T8UJv1cDOghuJE4pY8wvN6FltvfTaDsCiytSCjJTYnjXuzl a1saJvCo/PaEsXfy9r6XUt6w/YPhRQgs8WmBM4pXthEZS0BsBLij/k3B8ppeZeyP618E LAzRFa42pyQ8cwoeehPnyjus9aZj6Y9LlDON8qp3bl9XqW+DVBsB2LIVD6PCWcGMdbvw e8FIs/sV/MsSHwX9ZytVDair2eYLBDtoSrVaVKQpoxwMyd6sKaI/UdHoIkqOrI9Zgtw/ phlg== X-Gm-Message-State: AOAM533k0MWTkUwTlYCqBS9FJpaUFeLxwf2gVgMyoL0TdDKEeoJB6G8T Dk9rOmD2Ony2gPX1eBMpSZXLZ7EFlarUSw== X-Google-Smtp-Source: ABdhPJwzN5CqV51kkiHHsXZLPYO0lq5mzGM+L84Wk0l7g37nPRk8gBjjlR3gZ15v4JlkKFouSv8FAg== X-Received: by 2002:a05:6a00:2181:b0:4f6:f1b1:1ba7 with SMTP id h1-20020a056a00218100b004f6f1b11ba7mr20157710pfi.73.1650409104565; Tue, 19 Apr 2022 15:58:24 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:23 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bjorn Andersson , Avri Altman Subject: [PATCH v3 03/28] scsi: ufs: Remove superfluous boolean conversions Date: Tue, 19 Apr 2022 15:57:46 -0700 Message-Id: <20220419225811.4127248-4-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove "? true : false" if the preceding expression yields a boolean or if the result of the expression is assigned to a boolean since in these two cases the "? true : false" part is superfluous. Reviewed-by: Bjorn Andersson Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-qcom.c | 3 +-- drivers/scsi/ufs/ufshcd.c | 9 ++++----- drivers/scsi/ufs/ufshcd.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 0d2e950d0865..808b677f6083 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -299,8 +299,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) struct ufs_qcom_host *host = ufshcd_get_variant(hba); struct phy *phy = host->generic_phy; int ret = 0; - bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B) - ? true : false; + bool is_rate_B = UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B; /* Reset UFS Host Controller and PHY */ ret = ufs_qcom_host_reset(hba); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index dbf50b50870b..983fac14b7cd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -712,8 +712,7 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba) */ static inline bool ufshcd_is_device_present(struct ufs_hba *hba) { - return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) & - DEVICE_PRESENT) ? true : false; + return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & DEVICE_PRESENT; } /** @@ -840,7 +839,7 @@ ufshcd_get_rsp_upiu_data_seg_len(struct utp_upiu_rsp *ucd_rsp_ptr) static inline bool ufshcd_is_exception_event(struct utp_upiu_rsp *ucd_rsp_ptr) { return be32_to_cpu(ucd_rsp_ptr->header.dword_2) & - MASK_RSP_EXCEPTION_EVENT ? true : false; + MASK_RSP_EXCEPTION_EVENT; } /** @@ -1350,7 +1349,7 @@ static int ufshcd_devfreq_target(struct device *dev, } /* Decide based on the rounded-off frequency and update */ - scale_up = (*freq == clki->max_freq) ? true : false; + scale_up = *freq == clki->max_freq; if (!scale_up) *freq = clki->min_freq; /* Update the frequency */ @@ -2800,7 +2799,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); - lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba) ? true : false; + lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba); ufshcd_prepare_lrbp_crypto(scsi_cmd_to_rq(cmd), lrbp); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 949427714d0e..b2740b51a546 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -985,7 +985,7 @@ static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba) static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba) { - return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false; + return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit); } static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) From patchwork Tue Apr 19 22:57:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 524A4C433F5 for ; Tue, 19 Apr 2022 22:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347270AbiDSXBO (ORCPT ); Tue, 19 Apr 2022 19:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245617AbiDSXBK (ORCPT ); Tue, 19 Apr 2022 19:01:10 -0400 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F183138BDA for ; Tue, 19 Apr 2022 15:58:26 -0700 (PDT) Received: by mail-pj1-f47.google.com with SMTP id mm4-20020a17090b358400b001cb93d8b137so3283922pjb.2 for ; Tue, 19 Apr 2022 15:58:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MZUbF1J38iJaDn44gIQIZR0oCFbk2eX/sfClUv3JM4I=; b=zIhPvKC5M9FaDDJxq4iz1XASICvJalAnSeTeHkLbDi5iIo38Y7xq/ZvZvpSrZPqbRo U0QOYzHijK5BqGkhaUAs5U1g2kOrEM1OVJsVFTeESd4q4GPSSQrqfDUFeG8xvsHM0sZ1 FWyMXHJggG9SRkUB9eJBu5JFm+fsjKKa2sxzQNRbjMS1VmJemSqlESY2W2/eq6CShTkK tJV4v3cgWapmgMXb0O2X3w7Pq17rRyaRJ5e6n0pGyaqJt5hPGDUJjvVi5qsbTNmhfgoQ wjPPT1c3kK44lyeAguQOQ0kS6BoplCy/JGzJswqgGdxpTsqRRd8YxOl4cG0A84x1OCI3 Yr1Q== X-Gm-Message-State: AOAM531F/XTBgVg1sRPNJmcGRtM0PxkWYPNRz6PiyDgKnq9o9T1cXOYQ CpLTLQ/OzQPXIkhry/V1Ses58FpY2kw3Mg== X-Google-Smtp-Source: ABdhPJzyydVO9VrO8q6LLqjwKHq21WRvFpqGyJ9uFNhFrqlrVoiejurAxRI2uzziPn3ndhBGhBG1LQ== X-Received: by 2002:a17:902:f64d:b0:151:3895:46bf with SMTP id m13-20020a170902f64d00b00151389546bfmr18087181plg.31.1650409106375; Tue, 19 Apr 2022 15:58:26 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:25 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bjorn Andersson , Keoseong Park Subject: [PATCH v3 04/28] scsi: ufs: Simplify statements that return a boolean Date: Tue, 19 Apr 2022 15:57:47 -0700 Message-Id: <20220419225811.4127248-5-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert "if (expr) return true; else return false;" into "return expr;" if either 'expr' is a boolean expression or the return type of the function is 'bool'. Reviewed-by: Bjorn Andersson Reviewed-by: Keoseong Park Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-qcom.h | 5 +---- drivers/scsi/ufs/ufshcd.c | 22 +++++----------------- drivers/scsi/ufs/ufshpb.c | 8 ++------ 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h index 8208e3a3ef59..51570224a6e2 100644 --- a/drivers/scsi/ufs/ufs-qcom.h +++ b/drivers/scsi/ufs/ufs-qcom.h @@ -239,10 +239,7 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host); static inline bool ufs_qcom_cap_qunipro(struct ufs_qcom_host *host) { - if (host->caps & UFS_QCOM_CAP_QUNIPRO) - return true; - else - return false; + return host->caps & UFS_QCOM_CAP_QUNIPRO; } /* ufs-qcom-ice.c */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 983fac14b7cd..c60519372b3b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -939,10 +939,7 @@ static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba) * logic simple, we will only do manual tuning if local unipro version * doesn't support ver1.6 or later. */ - if (ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6) - return true; - else - return false; + return ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6; } /** @@ -2216,10 +2213,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) */ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba) { - if (ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY) - return true; - else - return false; + return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY; } /** @@ -5781,10 +5775,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, return false; } /* Let it continue to flush when available buffer exceeds threshold */ - if (avail_buf < hba->vps->wb_flush_threshold) - return true; - - return false; + return avail_buf < hba->vps->wb_flush_threshold; } static void ufshcd_wb_force_disable(struct ufs_hba *hba) @@ -5863,11 +5854,8 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba) return false; } - if (!hba->dev_info.b_presrv_uspc_en) { - if (avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10)) - return true; - return false; - } + if (!hba->dev_info.b_presrv_uspc_en) + return avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10); return ufshcd_wb_presrv_usrspc_keep_vcc_on(hba, avail_buf); } diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index b2bec19022cd..ebd8fc8fc109 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -90,12 +90,8 @@ static bool ufshpb_is_general_lun(int lun) static bool ufshpb_is_pinned_region(struct ufshpb_lu *hpb, int rgn_idx) { - if (hpb->lu_pinned_end != PINNED_NOT_SET && - rgn_idx >= hpb->lu_pinned_start && - rgn_idx <= hpb->lu_pinned_end) - return true; - - return false; + return hpb->lu_pinned_end != PINNED_NOT_SET && + rgn_idx >= hpb->lu_pinned_start && rgn_idx <= hpb->lu_pinned_end; } static void ufshpb_kick_map_work(struct ufshpb_lu *hpb) From patchwork Tue Apr 19 22:57:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563856 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA803C433FE for ; Tue, 19 Apr 2022 22:58:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352479AbiDSXBP (ORCPT ); Tue, 19 Apr 2022 19:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347208AbiDSXBM (ORCPT ); Tue, 19 Apr 2022 19:01:12 -0400 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE55738BDB for ; Tue, 19 Apr 2022 15:58:28 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id e62-20020a17090a6fc400b001d2cd8e9b0aso190348pjk.5 for ; Tue, 19 Apr 2022 15:58:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jLPy4g/P6lPqKcu5Q8el2I29IYha8Epe6ejgyk2dfiA=; b=ZWCbmIrUn/XzutGCR8l5xpqBj7rgaJ4VpwNdk4FdXuvDFR/rcSqYJ3e9UVdQUFOA3L 7micgxhyHfCugpJDp9IxuiH/sHJAwuGgo9atzC7+XUbzVaVDZIHM+hb2o/nEzCjq5t1m 26z8/wKt7Thj3fp4KZ9cEnL9UoSQQapvHSC5TXUAHeHQnCy4PU+pbWQMyE1PYJug066T bQmV2N0RpIoJEmVGS2Wfu0J3ahycnw6L+k4Y4esqjdoEBA8b9NuQbexJD0B0pQ2VVp0a MRi/hbHYFaufBytFbMqb3a6HsrwbBXYrEsyoCFXTnuZIw9MBQ8FTHeROSpFTyzF+um7j QFEA== X-Gm-Message-State: AOAM530JedwV8a19BbsJC5PVz3sJQK/VOkLPm7P8Wp6q3Pl3GRkez2Ml HP2l774m6SkGeBzvseUpccQ= X-Google-Smtp-Source: ABdhPJx4jD2yLe1/tNRgh8BEuuCAiM/raMV7iS80qQffg/xAdjd6DNJDamJYx/DUlLUaH6wqLxn2yQ== X-Received: by 2002:a17:902:9b98:b0:156:52b1:b100 with SMTP id y24-20020a1709029b9800b0015652b1b100mr17662280plp.174.1650409108196; Tue, 19 Apr 2022 15:58:28 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:27 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , Keoseong Park Subject: [PATCH v3 05/28] scsi: ufs: Remove ufshcd_lrb.sense_bufflen Date: Tue, 19 Apr 2022 15:57:48 -0700 Message-Id: <20220419225811.4127248-6-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org ufshcd_lrb.sense_bufflen is set but never read. Hence remove this struct member. Reviewed-by: Avri Altman Reviewed-by: Keoseong Park Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 3 --- drivers/scsi/ufs/ufshcd.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c60519372b3b..e52e86b0b7a3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2789,7 +2789,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp = &hba->lrb[tag]; WARN_ON(lrbp->cmd); lrbp->cmd = cmd; - lrbp->sense_bufflen = UFS_SENSE_SIZE; lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); @@ -2830,7 +2829,6 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, enum dev_cmd_type cmd_type, int tag) { lrbp->cmd = NULL; - lrbp->sense_bufflen = 0; lrbp->sense_buffer = NULL; lrbp->task_tag = tag; lrbp->lun = 0; /* device management cmd is not specific to any LUN */ @@ -6802,7 +6800,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, lrbp = &hba->lrb[tag]; WARN_ON(lrbp->cmd); lrbp->cmd = NULL; - lrbp->sense_bufflen = 0; lrbp->sense_buffer = NULL; lrbp->task_tag = tag; lrbp->lun = 0; diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index b2740b51a546..b6162b208d99 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -182,7 +182,6 @@ struct ufs_pm_lvl_states { * @ucd_req_dma_addr: UPIU request dma address for debug * @cmd: pointer to SCSI command * @sense_buffer: pointer to sense buffer address of the SCSI command - * @sense_bufflen: Length of the sense buffer * @scsi_status: SCSI status of the command * @command_type: SCSI, UFS, Query. * @task_tag: Task tag of the command @@ -207,7 +206,6 @@ struct ufshcd_lrb { struct scsi_cmnd *cmd; u8 *sense_buffer; - unsigned int sense_bufflen; int scsi_status; int command_type; From patchwork Tue Apr 19 22:57:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DFACC433F5 for ; Tue, 19 Apr 2022 22:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358370AbiDSXBU (ORCPT ); Tue, 19 Apr 2022 19:01:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347267AbiDSXBO (ORCPT ); Tue, 19 Apr 2022 19:01:14 -0400 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F243387A7 for ; Tue, 19 Apr 2022 15:58:30 -0700 (PDT) Received: by mail-pl1-f174.google.com with SMTP id j8so84286pll.11 for ; Tue, 19 Apr 2022 15:58:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6yPV4+N1twKu/2lNcbRy4894tcz7EpVJPYAfwszUkss=; b=fDt+ynWbNmIRz05AbhV7x22mPRiQt/Z4o0dNbJ0gBFVXvGurMyogC0kk/0F+nYiHDW g2kLkq33nOwCiKxJ9TGCS2T5Vje7qWBe2KoPd53Oa9iTYvgxwDJtF3EuJ0svUBkbNVWP uvq4AFZEK6Fpoj9YQu27uv0Y5u4w7uSfUxgPK2/bAp61pVsp3RT4jPfUTyX4fVESJ9PX QrcsAs/JZsh91HKVTiHOQyR3qrYI9J4ptDeqx48ovWkzW0Cbazeho6sLCTzIBBrEpiEz NALjcBylJHcGikitLq7V5Av4RZCsDVoIh+4Tl8t6SAB46ZG8Kt2duVffPWPsB+D58NdM q1Sg== X-Gm-Message-State: AOAM530ER+u9rZxSLStzf2IUrw+xWjP8c+GsNIBlUh3l7EYa3TsyxW9u JasarSCYr5Tbrqg5RT83H5U= X-Google-Smtp-Source: ABdhPJzBFOLpW6lMEZR81DrRZZyZuIDB0hL2+vuCMLcl9/KV0fpP9Splp5fzpBTvmLpKv2FUx7OwdA== X-Received: by 2002:a17:902:8496:b0:158:a8e0:516b with SMTP id c22-20020a170902849600b00158a8e0516bmr17992994plo.4.1650409109919; Tue, 19 Apr 2022 15:58:29 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:29 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 06/28] scsi: ufs: Remove ufshcd_lrb.sense_buffer Date: Tue, 19 Apr 2022 15:57:49 -0700 Message-Id: <20220419225811.4127248-7-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org ufshcd_lrb.sense_buffer is NULL if ufshcd_lrb.cmd is NULL and ufshcd_lrb.sense_buffer points at cmd->sense_buffer if ufshcd_lrb.cmd is set. In other words, the ufshcd_lrb.sense_buffer member is identical to cmd->sense_buffer. Hence this patch that removes the ufshcd_lrb.sense_buffer structure member. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 9 ++++----- drivers/scsi/ufs/ufshcd.h | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e52e86b0b7a3..d4ef31e1a409 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2127,15 +2127,17 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) */ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp) { + u8 *const sense_buffer = lrbp->cmd->sense_buffer; int len; - if (lrbp->sense_buffer && + + if (sense_buffer && ufshcd_get_rsp_upiu_data_seg_len(lrbp->ucd_rsp_ptr)) { int len_to_copy; len = be16_to_cpu(lrbp->ucd_rsp_ptr->sr.sense_data_len); len_to_copy = min_t(int, UFS_SENSE_SIZE, len); - memcpy(lrbp->sense_buffer, lrbp->ucd_rsp_ptr->sr.sense_data, + memcpy(sense_buffer, lrbp->ucd_rsp_ptr->sr.sense_data, len_to_copy); } } @@ -2789,7 +2791,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) lrbp = &hba->lrb[tag]; WARN_ON(lrbp->cmd); lrbp->cmd = cmd; - lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba); @@ -2829,7 +2830,6 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, enum dev_cmd_type cmd_type, int tag) { lrbp->cmd = NULL; - lrbp->sense_buffer = NULL; lrbp->task_tag = tag; lrbp->lun = 0; /* device management cmd is not specific to any LUN */ lrbp->intr_cmd = true; /* No interrupt aggregation */ @@ -6800,7 +6800,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, lrbp = &hba->lrb[tag]; WARN_ON(lrbp->cmd); lrbp->cmd = NULL; - lrbp->sense_buffer = NULL; lrbp->task_tag = tag; lrbp->lun = 0; lrbp->intr_cmd = true; diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index b6162b208d99..b9f17219ca18 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -181,7 +181,6 @@ struct ufs_pm_lvl_states { * @ucd_rsp_dma_addr: UPIU response dma address for debug * @ucd_req_dma_addr: UPIU request dma address for debug * @cmd: pointer to SCSI command - * @sense_buffer: pointer to sense buffer address of the SCSI command * @scsi_status: SCSI status of the command * @command_type: SCSI, UFS, Query. * @task_tag: Task tag of the command @@ -205,7 +204,6 @@ struct ufshcd_lrb { dma_addr_t ucd_prdt_dma_addr; struct scsi_cmnd *cmd; - u8 *sense_buffer; int scsi_status; int command_type; From patchwork Tue Apr 19 22:57:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEB79C433EF for ; Tue, 19 Apr 2022 22:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358372AbiDSXBV (ORCPT ); Tue, 19 Apr 2022 19:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347208AbiDSXBQ (ORCPT ); Tue, 19 Apr 2022 19:01:16 -0400 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D9C838BDA for ; Tue, 19 Apr 2022 15:58:33 -0700 (PDT) Received: by mail-pj1-f46.google.com with SMTP id mm4-20020a17090b358400b001cb93d8b137so3284077pjb.2 for ; Tue, 19 Apr 2022 15:58:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n+DEqcxCsHRV+0HiSYhlEtxBoyz+hIoKEkJidAugI08=; b=cBu0ZQh6Io9iyQnBF9whEm3ZCn/GsHL1FE0jco9vVRvx5x4zG1Y0/b/6H4Q1uGsF2s HQi5sWtK7wICWA2MAf2f9ovkmWISNukAnhwOreCbUBjH4eHS6QugutNuKjEejU9/xkFw YGO+mKqaT2dlKRuGrD9eddoBAcZspWyA+EctYrwLauNA7t3qog+YCyd1W1OesRv8rzSA oQNtxuNjo+vjGj39L+Ldycj7ylc4nzxWdgUoLJNU8xVOUNx1gSM8aiSJhoaAWziLKSsv u9lRt0/ohLQgyKjSFsNEuFJiQJiNPIdTWSWwA3uWRDKsDfeK1mqiP0R1ogvqsnoNbrsd HGwA== X-Gm-Message-State: AOAM532CNd2HgYVQJPzGymdAUf2cOSJ8lTul7eFxMlSnwOeoIHXZDVqG /JkQfnPk6JLI51WSEaPOnV4= X-Google-Smtp-Source: ABdhPJyMvw6VKc8+KvLBsLoq4l9QwPgaEpkTRWwNvblzd0i7JbLz0EZBkk9R5+67pHXgehRhC5N2ww== X-Received: by 2002:a17:902:8a8d:b0:157:ab0:a07 with SMTP id p13-20020a1709028a8d00b001570ab00a07mr17648187plo.77.1650409112568; Tue, 19 Apr 2022 15:58:32 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:31 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bean Huo Subject: [PATCH v3 07/28] scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup() Date: Tue, 19 Apr 2022 15:57:50 -0700 Message-Id: <20220419225811.4127248-8-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use get_unaligned_be16(...) instead of the equivalent but harder to read be16_to_cpup((__be16 *)...). Reviewed-by: Bean Huo Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d4ef31e1a409..3ec26c9eb1be 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7334,7 +7334,7 @@ static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff) u16 unit; for (i = start_scan; i >= 0; i--) { - data = be16_to_cpup((__be16 *)&buff[2 * i]); + data = get_unaligned_be16(&buff[2 * i]); unit = (data & ATTR_ICC_LVL_UNIT_MASK) >> ATTR_ICC_LVL_UNIT_OFFSET; curr_uA = data & ATTR_ICC_LVL_VALUE_MASK; From patchwork Tue Apr 19 22:57:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42B66C433F5 for ; Tue, 19 Apr 2022 22:58:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358373AbiDSXBW (ORCPT ); Tue, 19 Apr 2022 19:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353858AbiDSXBT (ORCPT ); Tue, 19 Apr 2022 19:01:19 -0400 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A53038781 for ; Tue, 19 Apr 2022 15:58:35 -0700 (PDT) Received: by mail-pj1-f46.google.com with SMTP id n11-20020a17090a73cb00b001d1d3a7116bso2580439pjk.0 for ; Tue, 19 Apr 2022 15:58:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q6RgkMDfw/nJyjAPJS/L3T3rA3g8xfDxZjeiiE7pbto=; b=p/PYVMjXjKJniDke6ntVHe3X+dfz9qt0uXw1kXzclGXRtxY4mLdoy+rhEnUNKFHzcB 4fOpTsMoMcOAHcjzq6XFq0BkWDIyindc0Cg+8lb1Jnqi9rQhxPFZyt6rQWLsUEKVSQkq Tr51kO0xnIiQop5kyvZPTfal+aZreMoYevFi2VrxoaGrbnYi46Oz6xeXwJqBpxjUh9nG wVSm2MoPpxtuVkCDzqfDTaD6LKw7wwp/hI1eeySSoYXcX5DHtHTBZmTL8njTMuswny9Z 3E24/Wr59/cBk4p+Q938DRiMWMdKuuNS88SLHteLQX98RSa3zyg1NwY2Xq0x6J3UNcCx AYqg== X-Gm-Message-State: AOAM533ojR1fiVgAEtpY3u1OjiH+mmkX8XRYDkmfJcZznvPIc178Hf0z u7d8GvycZeH18qRb806Giyw= X-Google-Smtp-Source: ABdhPJyInv6OKbuaouuQqq0ch0wzIiVszFY17VQuYBvdPcT3Yssj4EYqqC/+fLXHi7HndtKPCao7+g== X-Received: by 2002:a17:90b:1b03:b0:1d2:a577:d52 with SMTP id nu3-20020a17090b1b0300b001d2a5770d52mr991503pjb.58.1650409114996; Tue, 19 Apr 2022 15:58:34 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:33 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 08/28] scsi: ufs: Remove the UFS_FIX() and END_FIX() macros Date: Tue, 19 Apr 2022 15:57:51 -0700 Message-Id: <20220419225811.4127248-9-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since these two macros reduce code readability, remove these two macros. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 12 +++++---- drivers/scsi/ufs/ufs_quirks.h | 9 ------- drivers/scsi/ufs/ufshcd.c | 43 +++++++++++++++++++-------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 86a938075f30..b275b440f027 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -45,11 +45,13 @@ ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res) static struct ufs_dev_fix ufs_mtk_dev_fixups[] = { - UFS_FIX(UFS_VENDOR_MICRON, UFS_ANY_MODEL, - UFS_DEVICE_QUIRK_DELAY_AFTER_LPM), - UFS_FIX(UFS_VENDOR_SKHYNIX, "H9HQ21AFAMZDAR", - UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES), - END_FIX + { .wmanufacturerid = UFS_VENDOR_MICRON, + .model = UFS_ANY_MODEL, + .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM }, + { .wmanufacturerid = UFS_VENDOR_SKHYNIX, + .model = "H9HQ21AFAMZDAR", + .quirk = UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES }, + {} }; static const struct of_device_id ufs_mtk_of_match[] = { diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h index 35ec9ea79869..e6c535c77527 100644 --- a/drivers/scsi/ufs/ufs_quirks.h +++ b/drivers/scsi/ufs/ufs_quirks.h @@ -29,15 +29,6 @@ struct ufs_dev_fix { unsigned int quirk; }; -#define END_FIX { } - -/* add specific device quirk */ -#define UFS_FIX(_vendor, _model, _quirk) { \ - .wmanufacturerid = (_vendor),\ - .model = (_model), \ - .quirk = (_quirk), \ -} - /* * Some vendor's UFS device sends back to back NACs for the DL data frames * causing the host controller to raise the DFES error status. Sometimes diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3ec26c9eb1be..5fa93be246a5 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -206,24 +206,31 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state, static struct ufs_dev_fix ufs_fixups[] = { /* UFS cards deviations table */ - UFS_FIX(UFS_VENDOR_MICRON, UFS_ANY_MODEL, - UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM | - UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ), - UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL, - UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM | - UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | - UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS), - UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, - UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME), - UFS_FIX(UFS_VENDOR_SKHYNIX, "hB8aL1" /*H28U62301AMR*/, - UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME), - UFS_FIX(UFS_VENDOR_TOSHIBA, UFS_ANY_MODEL, - UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM), - UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9C8KBADG", - UFS_DEVICE_QUIRK_PA_TACTIVATE), - UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9D8KBADG", - UFS_DEVICE_QUIRK_PA_TACTIVATE), - END_FIX + { .wmanufacturerid = UFS_VENDOR_MICRON, + .model = UFS_ANY_MODEL, + .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM | + UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ }, + { .wmanufacturerid = UFS_VENDOR_SAMSUNG, + .model = UFS_ANY_MODEL, + .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM | + UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | + UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, + { .wmanufacturerid = UFS_VENDOR_SKHYNIX, + .model = UFS_ANY_MODEL, + .quirk = UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME }, + { .wmanufacturerid = UFS_VENDOR_SKHYNIX, + .model = "hB8aL1" /*H28U62301AMR*/, + .quirk = UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME }, + { .wmanufacturerid = UFS_VENDOR_TOSHIBA, + .model = UFS_ANY_MODEL, + .quirk = UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM }, + { .wmanufacturerid = UFS_VENDOR_TOSHIBA, + .model = "THGLF2G9C8KBADG", + .quirk = UFS_DEVICE_QUIRK_PA_TACTIVATE }, + { .wmanufacturerid = UFS_VENDOR_TOSHIBA, + .model = "THGLF2G9D8KBADG", + .quirk = UFS_DEVICE_QUIRK_PA_TACTIVATE }, + {} }; static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba); From patchwork Tue Apr 19 22:57:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F935C433F5 for ; Tue, 19 Apr 2022 22:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358376AbiDSXBX (ORCPT ); Tue, 19 Apr 2022 19:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347267AbiDSXBV (ORCPT ); Tue, 19 Apr 2022 19:01:21 -0400 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A0F8387A7 for ; Tue, 19 Apr 2022 15:58:37 -0700 (PDT) Received: by mail-pj1-f45.google.com with SMTP id md20-20020a17090b23d400b001cb70ef790dso3264657pjb.5 for ; Tue, 19 Apr 2022 15:58:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+wbkoJU6O11IaEcR5GZXDjnJxvOiYhlZmVn4u8Ccdj0=; b=W1k1x1ay1S++DxdICyWVhIEFxMKOzputDnjiRhBlj0q+DmMQ6nxOegvyzIhnPZm75B 5cIDM5FpaXZNg34Ae6J7rKX1B/hy3IMqkSbDHL9N8mXfMF48/Citm4rszl7fVFsVSGN7 mtwztdd2RKPxdX1SRiATCTGHvpSfxblPhVmJH/5lxWS65G5DkG4hPreKFEOoT213IH4O 6bGn9uL/p71Iocrfn5TDVa6/6BdXQRqUq+UxcrQOeGUSPJ1aonfx8z8isLg3Fk+TBIm/ cPWckJFcdMJltRLT2aWXPyUbACZiqJalbPhA320dUUJsI/8G4m7gLkV7UIH83spbB35m zkSQ== X-Gm-Message-State: AOAM531UOuae9NYecf3NuMRrAK13pgf7JPWMtmb90n0cxRh3Ye0necvr litXv4gPu6NjbHtDqYMHwec= X-Google-Smtp-Source: ABdhPJzA4gpB6xSiXDXtmYgORB3JISBat7oAeU2tAsKWcWKvmVCzF9VimGwbB5valFFQrSBZcUP+4A== X-Received: by 2002:a17:902:8217:b0:156:9c4f:90eb with SMTP id x23-20020a170902821700b001569c4f90ebmr17339596pln.121.1650409116820; Tue, 19 Apr 2022 15:58:36 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:35 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 09/28] scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk Date: Tue, 19 Apr 2022 15:57:52 -0700 Message-Id: <20220419225811.4127248-10-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since struct ufs_dev_fix contains quirk information, rename it into struct ufs_dev_quirk. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 2 +- drivers/scsi/ufs/ufs_quirks.h | 4 ++-- drivers/scsi/ufs/ufshcd.c | 6 +++--- drivers/scsi/ufs/ufshcd.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index b275b440f027..217348dde6a6 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -44,7 +44,7 @@ #define ufs_mtk_device_reset_ctrl(high, res) \ ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res) -static struct ufs_dev_fix ufs_mtk_dev_fixups[] = { +static struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { { .wmanufacturerid = UFS_VENDOR_MICRON, .model = UFS_ANY_MODEL, .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM }, diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h index e6c535c77527..e38dec5f0351 100644 --- a/drivers/scsi/ufs/ufs_quirks.h +++ b/drivers/scsi/ufs/ufs_quirks.h @@ -19,11 +19,11 @@ #define UFS_VENDOR_WDC 0x145 /** - * ufs_dev_fix - ufs device quirk info + * ufs_dev_quirk - ufs device quirk info * @card: ufs card details * @quirk: device quirk */ -struct ufs_dev_fix { +struct ufs_dev_quirk { u16 wmanufacturerid; u8 *model; unsigned int quirk; diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5fa93be246a5..9df37c80308a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -204,7 +204,7 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state, return UFS_PM_LVL_0; } -static struct ufs_dev_fix ufs_fixups[] = { +static struct ufs_dev_quirk ufs_fixups[] = { /* UFS cards deviations table */ { .wmanufacturerid = UFS_VENDOR_MICRON, .model = UFS_ANY_MODEL, @@ -7624,9 +7624,9 @@ static void ufshcd_temp_notif_probe(struct ufs_hba *hba, u8 *desc_buf) } } -void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups) +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_quirk *fixups) { - struct ufs_dev_fix *f; + struct ufs_dev_quirk *f; struct ufs_dev_info *dev_info = &hba->dev_info; if (!fixups) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index b9f17219ca18..3d18581afc2b 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1180,7 +1180,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, void ufshcd_auto_hibern8_enable(struct ufs_hba *hba); void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit); -void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_fix *fixups); +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_quirk *fixups); #define SD_ASCII_STD true #define SD_RAW false int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, From patchwork Tue Apr 19 22:57:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CA5AC433EF for ; Tue, 19 Apr 2022 22:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358378AbiDSXB0 (ORCPT ); Tue, 19 Apr 2022 19:01:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358375AbiDSXBX (ORCPT ); Tue, 19 Apr 2022 19:01:23 -0400 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9D6838781 for ; Tue, 19 Apr 2022 15:58:39 -0700 (PDT) Received: by mail-pf1-f179.google.com with SMTP id b15so193147pfm.5 for ; Tue, 19 Apr 2022 15:58:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Eta5PBC5X/Kb8I7p5YmauGvSBGUtRZFfJR+9ADQd7To=; b=n65W/CRgXZhpwfbr9PrCpcUTQkjBIKawWpbs+8j8oE5WhcclD0+mb8biOJpL3wIZo6 tPmlV8dXuBf5/HP3ajwW7qAwvNtRu8hexOcm1KARZx5n4PmQhUn/dOCrSID4PoZo0TXF SADN3+/VYRd6+UFlnWbMvvhu9pK82G3MRQ1u1A2fP1k2HFo8JEkMFjSwG46e+vPByZxW JsCF0J5P/5v9US2Gy2z3zjdXfF5zbYMIWIBLefEoh/+4SAePhRxF6k9pBrNMg7Q/uB5C f8ilMcyqypH+raEWeOrOmmSGWj/YCFcwThc3B3xl+4M68W063BBgRK/7DkV4MZomFaPX nDIQ== X-Gm-Message-State: AOAM530Vo/wU+pZbL2PWjBSOub/T81cGwRMe2FAmzDMMBxKlQMka0toL uVev5FLxvDzDajiPwSA61I5p0yrXfyh6QA== X-Google-Smtp-Source: ABdhPJzZ4Dtr0puNtsX4V/tI8BsW00XbEoc2jCD1mmm3Z0gXI+TAi8aLDd0Igj0w/7OCiJNbMN7vIQ== X-Received: by 2002:a05:6a00:178a:b0:50a:9c03:6e62 with SMTP id s10-20020a056a00178a00b0050a9c036e62mr3701398pfg.23.1650409119119; Tue, 19 Apr 2022 15:58:39 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:37 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 10/28] scsi: ufs: Declare the quirks array const Date: Tue, 19 Apr 2022 15:57:53 -0700 Message-Id: <20220419225811.4127248-11-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Declare the quirks array and also its 'model' member const to make it explicit that these are not modified. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 2 +- drivers/scsi/ufs/ufs_quirks.h | 2 +- drivers/scsi/ufs/ufshcd.c | 7 ++++--- drivers/scsi/ufs/ufshcd.h | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 217348dde6a6..9a4474210627 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -44,7 +44,7 @@ #define ufs_mtk_device_reset_ctrl(high, res) \ ufs_mtk_smc(UFS_MTK_SIP_DEVICE_RESET, high, res) -static struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { +static const struct ufs_dev_quirk ufs_mtk_dev_fixups[] = { { .wmanufacturerid = UFS_VENDOR_MICRON, .model = UFS_ANY_MODEL, .quirk = UFS_DEVICE_QUIRK_DELAY_AFTER_LPM }, diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h index e38dec5f0351..bcb4f004bed5 100644 --- a/drivers/scsi/ufs/ufs_quirks.h +++ b/drivers/scsi/ufs/ufs_quirks.h @@ -25,7 +25,7 @@ */ struct ufs_dev_quirk { u16 wmanufacturerid; - u8 *model; + const u8 *model; unsigned int quirk; }; diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9df37c80308a..a1ebfbb6f1b9 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -204,7 +204,7 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state, return UFS_PM_LVL_0; } -static struct ufs_dev_quirk ufs_fixups[] = { +static const struct ufs_dev_quirk ufs_fixups[] = { /* UFS cards deviations table */ { .wmanufacturerid = UFS_VENDOR_MICRON, .model = UFS_ANY_MODEL, @@ -7624,9 +7624,10 @@ static void ufshcd_temp_notif_probe(struct ufs_hba *hba, u8 *desc_buf) } } -void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_quirk *fixups) +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, + const struct ufs_dev_quirk *fixups) { - struct ufs_dev_quirk *f; + const struct ufs_dev_quirk *f; struct ufs_dev_info *dev_info = &hba->dev_info; if (!fixups) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 3d18581afc2b..107d19e98d52 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1180,7 +1180,8 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, void ufshcd_auto_hibern8_enable(struct ufs_hba *hba); void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit); -void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, struct ufs_dev_quirk *fixups); +void ufshcd_fixup_dev_quirks(struct ufs_hba *hba, + const struct ufs_dev_quirk *fixups); #define SD_ASCII_STD true #define SD_RAW false int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, From patchwork Tue Apr 19 22:57:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 814E5C433F5 for ; Tue, 19 Apr 2022 22:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358385AbiDSXBe (ORCPT ); Tue, 19 Apr 2022 19:01:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347267AbiDSXBZ (ORCPT ); Tue, 19 Apr 2022 19:01:25 -0400 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5A8387A7 for ; Tue, 19 Apr 2022 15:58:41 -0700 (PDT) Received: by mail-pj1-f54.google.com with SMTP id d23-20020a17090a115700b001d2bde6c234so2297696pje.1 for ; Tue, 19 Apr 2022 15:58:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=msoxtyUmQMPR1br4wFMJMr/YuaIVdEfrrF3GptbzXVo=; b=DQ49B1i0YGm/qmMzVqgM0pIWePm1EIrG4Ii37vA5xbNoE7jgiBF8qTbQRcnnZAky7N GX7LNkHkME/j4iIuhAw1rCnTZKIfAt8OR7lL00mHhpj42KV8DNojPz/TMU9NsECPyEx9 OL0SZtMdSK/SQFRzVHwJHmPw35TCFVhTExiKNjDhKccAI6/dB7T7nUDQjbiZo0GH3J4e MIJVjvYV9Pqk4K5tOX28HLOcxo6ezjDG43GHfjb/BHgfy83ta+DTBBQQzpTf4JeQgETH Oo6ood178q7swsevOLK0GyiN3fJb2uCKJqmyy4FQj9C4/r5Ftu22YpTmAMume8+V/WJf yehA== X-Gm-Message-State: AOAM533uSCJ9L0RapOABk6lkbYTyoVbT74CeV07RXYiaM3lVRB2jBqeV 9i3e2YDdDg8wjs+RSVuTQceRS/RQ5eHasw== X-Google-Smtp-Source: ABdhPJwDNUuM171EG8m5ybNNKuzC4lNbhZQVMwL6wPpxgQqHRbv7UY+D5nNHte9vungdcmjl23d+/Q== X-Received: by 2002:a17:90a:f3d6:b0:1cb:a0aa:5e60 with SMTP id ha22-20020a17090af3d600b001cba0aa5e60mr957584pjb.161.1650409120948; Tue, 19 Apr 2022 15:58:40 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:40 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 11/28] scsi: ufs: Invert the return value of ufshcd_is_hba_active() Date: Tue, 19 Apr 2022 15:57:54 -0700 Message-Id: <20220419225811.4127248-12-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It is confusing that ufshcd_is_hba_active() returns 'true' if the HBA is not active. Clear up this confusion by inverting the return value of ufshcd_is_hba_active(). This patch does not change any functionality. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index a1ebfbb6f1b9..eabc6b6156fd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -917,12 +917,11 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba) * ufshcd_is_hba_active - Get controller state * @hba: per adapter instance * - * Returns false if controller is active, true otherwise + * Returns true if and only if the controller is active. */ static inline bool ufshcd_is_hba_active(struct ufs_hba *hba) { - return (ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & CONTROLLER_ENABLE) - ? false : true; + return ufshcd_readl(hba, REG_CONTROLLER_ENABLE) & CONTROLLER_ENABLE; } u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba) @@ -4552,7 +4551,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba) int retry_inner; start: - if (!ufshcd_is_hba_active(hba)) + if (ufshcd_is_hba_active(hba)) /* change controller state to "reset state" */ ufshcd_hba_stop(hba); @@ -4578,7 +4577,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba) /* wait for the host controller to complete initialization */ retry_inner = 50; - while (ufshcd_is_hba_active(hba)) { + while (!ufshcd_is_hba_active(hba)) { if (retry_inner) { retry_inner--; } else { From patchwork Tue Apr 19 22:57:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31AD2C433FE for ; Tue, 19 Apr 2022 22:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356526AbiDSXBf (ORCPT ); Tue, 19 Apr 2022 19:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358380AbiDSXB1 (ORCPT ); Tue, 19 Apr 2022 19:01:27 -0400 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A02038781 for ; Tue, 19 Apr 2022 15:58:43 -0700 (PDT) Received: by mail-pj1-f43.google.com with SMTP id u5-20020a17090a6a8500b001d0b95031ebso199538pjj.3 for ; Tue, 19 Apr 2022 15:58:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/6uWtAD/SeeR09KP91P5TwvCx574f8Z/VJ0xjlNkqlU=; b=Cnli1oFsqfB/QbegkRYCHTsOyaFX1ariCQvuhRAVhsN+QhK0Z5hjcrCsIxE6RAUKIr ZOo82ZXaO9P8vEFNdf7IqzsdhNk0LJZV7q/X25noWkcekeyfR/dz+42RgGmEclw7Dfuz t0fzE+6WLNrvtMGQZ5FbVL43R7Xv2f2W7X8bSBtgRC5F8cXV3cRzaubHjQXy9Bw9lJRQ L7fjt+lDeA1ixCMxFEh4gpSBJtEVdMTpmcu6SX5LOUvbAhLgSVAj6PEDIvUcDi1bxNIE nUfsw2K+8dQvG8Vl/jkiel+g6hY/HqPNUfzPf0dAVsVwgeXVtsW3oNIAOZ+EGFpNVgYj ERCQ== X-Gm-Message-State: AOAM532tuPVWHnq29gKsdvVIfWe+luOlGRX55QUxi7EuuuhM9jWIt0y+ L9ZXct/83LIgU8aDV/MTkas= X-Google-Smtp-Source: ABdhPJxn6X04Yvv/5BrBmYBsvouZIFypWHu9yuIDh7jlUawjiCP3LymZRRnu4Lz4BxikyTNpa6S1VA== X-Received: by 2002:a17:903:40ce:b0:158:8178:8563 with SMTP id t14-20020a17090340ce00b0015881788563mr17378078pld.167.1650409122675; Tue, 19 Apr 2022 15:58:42 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:41 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Stanley Chu Subject: [PATCH v3 12/28] scsi: ufs: Remove unused constants and code Date: Tue, 19 Apr 2022 15:57:55 -0700 Message-Id: <20220419225811.4127248-13-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Commit 5b44a07b6bb2 ("scsi: ufs: Remove pre-defined initial voltage values of device power") removed the code that uses the UFS_VREG_VCC* constants and also the code that sets the min_uV and max_uV member variables. Hence also remove these constants and that member variable. Reviewed-by: Stanley Chu Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs.h | 11 ----------- drivers/scsi/ufs/ufshcd.c | 29 +++-------------------------- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 4a00c24a3209..225b5b4a2a7e 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -562,15 +562,6 @@ struct ufs_query_res { struct utp_upiu_query upiu_res; }; -#define UFS_VREG_VCC_MIN_UV 2700000 /* uV */ -#define UFS_VREG_VCC_MAX_UV 3600000 /* uV */ -#define UFS_VREG_VCC_1P8_MIN_UV 1700000 /* uV */ -#define UFS_VREG_VCC_1P8_MAX_UV 1950000 /* uV */ -#define UFS_VREG_VCCQ_MIN_UV 1140000 /* uV */ -#define UFS_VREG_VCCQ_MAX_UV 1260000 /* uV */ -#define UFS_VREG_VCCQ2_MIN_UV 1700000 /* uV */ -#define UFS_VREG_VCCQ2_MAX_UV 1950000 /* uV */ - /* * VCCQ & VCCQ2 current requirement when UFS device is in sleep state * and link is in Hibern8 state. @@ -582,8 +573,6 @@ struct ufs_vreg { const char *name; bool always_on; bool enabled; - int min_uV; - int max_uV; int max_uA; }; diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index eabc6b6156fd..69198e37c976 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8309,33 +8309,10 @@ static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, static int ufshcd_config_vreg(struct device *dev, struct ufs_vreg *vreg, bool on) { - int ret = 0; - struct regulator *reg; - const char *name; - int min_uV, uA_load; - - BUG_ON(!vreg); - - reg = vreg->reg; - name = vreg->name; - - if (regulator_count_voltages(reg) > 0) { - uA_load = on ? vreg->max_uA : 0; - ret = ufshcd_config_vreg_load(dev, vreg, uA_load); - if (ret) - goto out; + if (regulator_count_voltages(vreg->reg) <= 0) + return 0; - if (vreg->min_uV && vreg->max_uV) { - min_uV = on ? vreg->min_uV : 0; - ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); - if (ret) - dev_err(dev, - "%s: %s set voltage failed, err=%d\n", - __func__, name, ret); - } - } -out: - return ret; + return ufshcd_config_vreg_load(dev, vreg, on ? vreg->max_uA : 0); } static int ufshcd_enable_vreg(struct device *dev, struct ufs_vreg *vreg) From patchwork Tue Apr 19 22:57:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F690C433F5 for ; Tue, 19 Apr 2022 22:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358388AbiDSXBg (ORCPT ); Tue, 19 Apr 2022 19:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358375AbiDSXB2 (ORCPT ); Tue, 19 Apr 2022 19:01:28 -0400 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F7438BDA for ; Tue, 19 Apr 2022 15:58:45 -0700 (PDT) Received: by mail-pj1-f52.google.com with SMTP id md4so179994pjb.4 for ; Tue, 19 Apr 2022 15:58:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3ggqJd+K00tQFtanOxz0I5riMOWXTnNeexPzEA8SIb8=; b=5gtg8Jz+55w9AVYCEY3TCUFMDpodzH49j13VsJA58SSNm+S5ymiF+bWFSItM8pAsfL iLBw9IzyOTGKJW58/qFBgSqj3kk5EiXq664peji8OcnqY8lhUVY3W9qc3JXdRe8/8NKm TwXmxfCEEqJZger3DOUw1VOy2YjI/Sw6pJ/Jlg+4QLGPmedHfIwCQ9MTP7k4VHfpWgIJ uS1E7yDTPcLuVUHCTwG3eHLbqc9BPJq9VrTvZ4gOji7bJLUWK3rfy8j01FhWEyPF0eEm KeLsDptQLQQtVEtuL7hN88QDK24zRkioJZJOHWJ6KKydmSRHiRhnHgiy3fGUoGZzaQL1 CGDg== X-Gm-Message-State: AOAM530/bqUJgJbub+XBOJsFTj5lUUjdul9yYhQIBi+AXnK0GH0Ueu8W O/QEuiQNP3HtU0ryD8MbelY= X-Google-Smtp-Source: ABdhPJz8jVNoaFZ5CQDjkUvW9VWGLbEi+N/uSx4u5erlocLYJLOfKMKn3pvkCokbrXkoAx5sU2KpQw== X-Received: by 2002:a17:90b:4a05:b0:1d2:bdc9:df39 with SMTP id kk5-20020a17090b4a0500b001d2bdc9df39mr974163pjb.51.1650409124793; Tue, 19 Apr 2022 15:58:44 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:43 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 13/28] scsi: ufs: Switch to aggregate initialization Date: Tue, 19 Apr 2022 15:57:56 -0700 Message-Id: <20220419225811.4127248-14-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make it easier to verify for humans that ufshcd_init_pwr_dev_param() initializes all structure members. This patch does not change any functionality. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd-pltfrm.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index cca4b2181a81..9923cbc70653 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -297,18 +297,20 @@ EXPORT_SYMBOL_GPL(ufshcd_get_pwr_dev_param); void ufshcd_init_pwr_dev_param(struct ufs_dev_params *dev_param) { - dev_param->tx_lanes = 2; - dev_param->rx_lanes = 2; - dev_param->hs_rx_gear = UFS_HS_G3; - dev_param->hs_tx_gear = UFS_HS_G3; - dev_param->pwm_rx_gear = UFS_PWM_G4; - dev_param->pwm_tx_gear = UFS_PWM_G4; - dev_param->rx_pwr_pwm = SLOW_MODE; - dev_param->tx_pwr_pwm = SLOW_MODE; - dev_param->rx_pwr_hs = FAST_MODE; - dev_param->tx_pwr_hs = FAST_MODE; - dev_param->hs_rate = PA_HS_MODE_B; - dev_param->desired_working_mode = UFS_HS_MODE; + *dev_param = (struct ufs_dev_params){ + .tx_lanes = 2, + .rx_lanes = 2, + .hs_rx_gear = UFS_HS_G3, + .hs_tx_gear = UFS_HS_G3, + .pwm_rx_gear = UFS_PWM_G4, + .pwm_tx_gear = UFS_PWM_G4, + .rx_pwr_pwm = SLOW_MODE, + .tx_pwr_pwm = SLOW_MODE, + .rx_pwr_hs = FAST_MODE, + .tx_pwr_hs = FAST_MODE, + .hs_rate = PA_HS_MODE_B, + .desired_working_mode = UFS_HS_MODE, + }; } EXPORT_SYMBOL_GPL(ufshcd_init_pwr_dev_param); From patchwork Tue Apr 19 22:57:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B84FDC433EF for ; Tue, 19 Apr 2022 22:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358386AbiDSXBe (ORCPT ); Tue, 19 Apr 2022 19:01:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358382AbiDSXBc (ORCPT ); Tue, 19 Apr 2022 19:01:32 -0400 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1455838BDB for ; Tue, 19 Apr 2022 15:58:48 -0700 (PDT) Received: by mail-pj1-f41.google.com with SMTP id mm4-20020a17090b358400b001cb93d8b137so3284513pjb.2 for ; Tue, 19 Apr 2022 15:58:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QD+tceN/gEAQQC3Pa7ZlKSYJgpeqDDr4LSkw0SqEVW8=; b=RU834wkzzIe9mtZbJrnXONst6g+0Gjh44Cp7R30jp7cDlNmy2jlhZ0V3b6DGd0Tz08 d4SAnXOX/YhKVALIGylLklmVWmb2LNYdLl7n/CxsoIC/iKSatP7sepsb6+zuS4eirRvV CH6nCWxojbW/9Vn7yXVhyYQUvYB8napqiwWn9TP+VIeis1dIDrJel0TzcyVLldoOTWlQ 3kUD55t4Kc/IJ1VRMGUW/8B/uLdi6a+I/DiMUx1fIz/zW5oddYgkZL6moJ5kcXsLq9HG tbN9/9DG4D9qJNJHcwmcOc3HW5XTnVD7AHoEacwepc7z0WK8NWXgOI+FVZHPu+Zej9iI JD9Q== X-Gm-Message-State: AOAM530emeH9hMDw3vZyF7EhlaZsrYcyCJoclsZ7xLU18dHx3IoT12Pi 6diCVMAiETtgGE7ZRszamFo= X-Google-Smtp-Source: ABdhPJyANM+KiToUKNk51hDoj87wV87+NyfRuis9pv8PtwNph7Azm1//Wvo3xB/n2Pq3fr8eqJz9hQ== X-Received: by 2002:a17:902:b703:b0:158:2667:7447 with SMTP id d3-20020a170902b70300b0015826677447mr17850962pls.92.1650409127504; Tue, 19 Apr 2022 15:58:47 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:45 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bjorn Andersson Subject: [PATCH v3 14/28] scsi: ufs: Make the config_scaling_param calls type safe Date: Tue, 19 Apr 2022 15:57:57 -0700 Message-Id: <20220419225811.4127248-15-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Pass the actual type to config_scaling_param callback as the third argment instead of a void pointer. Remove a superfluous NULL pointer check from ufs_qcom_config_scaling_param(). Reviewed-by: Bjorn Andersson Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-qcom.c | 14 ++++---------- drivers/scsi/ufs/ufshcd.h | 10 +++++----- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 808b677f6083..dded29722880 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1463,23 +1463,17 @@ static int ufs_qcom_device_reset(struct ufs_hba *hba) #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) static void ufs_qcom_config_scaling_param(struct ufs_hba *hba, - struct devfreq_dev_profile *p, - void *data) + struct devfreq_dev_profile *p, + struct devfreq_simple_ondemand_data *d) { - static struct devfreq_simple_ondemand_data *d; - - if (!data) - return; - - d = (struct devfreq_simple_ondemand_data *)data; p->polling_ms = 60; d->upthreshold = 70; d->downdifferential = 5; } #else static void ufs_qcom_config_scaling_param(struct ufs_hba *hba, - struct devfreq_dev_profile *p, - void *data) + struct devfreq_dev_profile *p, + struct devfreq_simple_ondemand_data *data) { } #endif diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 107d19e98d52..bb2624aabda2 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -348,8 +348,8 @@ struct ufs_hba_variant_ops { int (*phy_initialization)(struct ufs_hba *); int (*device_reset)(struct ufs_hba *hba); void (*config_scaling_param)(struct ufs_hba *hba, - struct devfreq_dev_profile *profile, - void *data); + struct devfreq_dev_profile *profile, + struct devfreq_simple_ondemand_data *data); int (*program_key)(struct ufs_hba *hba, const union ufs_crypto_cfg_entry *cfg, int slot); void (*event_notify)(struct ufs_hba *hba, @@ -1360,11 +1360,11 @@ static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) } static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, - struct devfreq_dev_profile - *profile, void *data) + struct devfreq_dev_profile *p, + struct devfreq_simple_ondemand_data *data) { if (hba->vops && hba->vops->config_scaling_param) - hba->vops->config_scaling_param(hba, profile, data); + hba->vops->config_scaling_param(hba, p, data); } extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; From patchwork Tue Apr 19 22:57:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B860DC433EF for ; Tue, 19 Apr 2022 22:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358389AbiDSXBh (ORCPT ); Tue, 19 Apr 2022 19:01:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358383AbiDSXBd (ORCPT ); Tue, 19 Apr 2022 19:01:33 -0400 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C48C38BE6 for ; Tue, 19 Apr 2022 15:58:50 -0700 (PDT) Received: by mail-pl1-f174.google.com with SMTP id 12so80985pll.12 for ; Tue, 19 Apr 2022 15:58:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u3xoahIYSO9OOaeanh6ld3z8PVf6V1CHNxpRp8Wej3s=; b=mfTgNA4IFz2reNHI+2TGAwxw4r7c3ZMVDz477+HfbSseiuiTPLm2RtNmjZsRA8Srq1 E3Z4irW5Cx8yDMuMH+34nWA7grCEDlXLd2DoXFtJScYnWEs95LHKxbxOZtLkodoSfIBu 8oIaF1MomYQCC6ZY8cRgNRvWFj4/VvkNKmIB6QrmUkATOxrUqY59c3sIv5jbRHtpiD6T 3KymRWQEv6Zd3aOsgLaM3WWx2fEO7dy2+qKE0NI03dA+ILc0Mx81idiIAZpAPHroaVuz plwQbqSjuFHy0JiVISxambxoRYsdAEJVNfZWT5czqGZ/YJOUqb17ISQ+SfPgEGriFxSb 6FQg== X-Gm-Message-State: AOAM533C2tydMwUmjQ5dGr4Fgh92d7Ey74kFf9BGxxTzKC39KefNExve KoA4nXpRMjBhv3EnH76yxPw= X-Google-Smtp-Source: ABdhPJxdeiDq7a2Vg5D0nN2br306jtwd3iVS/WkdO5tQqhLjyE2rTSEScJVQVr8PDnbr4M0lQbixyw== X-Received: by 2002:a17:90a:4203:b0:1cb:6ba1:fcba with SMTP id o3-20020a17090a420300b001cb6ba1fcbamr1006836pjg.20.1650409129572; Tue, 19 Apr 2022 15:58:49 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:48 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bean Huo , Avri Altman Subject: [PATCH v3 15/28] scsi: ufs: Remove the driver version Date: Tue, 19 Apr 2022 15:57:58 -0700 Message-Id: <20220419225811.4127248-16-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The current version number is 0.2. That driver version was assigned more than nine years ago. A version number that is not updated while the driver is updated is not useful. Hence remove the driver version number from the UFS driver. See also commit e0eca63e3421 ("[SCSI] ufs: Separate PCI code into glue driver"). Reviewed-by: Bean Huo Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/cdns-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd-pci.c | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd.c | 1 - drivers/scsi/ufs/ufshcd.h | 1 - 5 files changed, 5 deletions(-) diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c index 7da8be2f35c4..e91cf9fd5a95 100644 --- a/drivers/scsi/ufs/cdns-pltfrm.c +++ b/drivers/scsi/ufs/cdns-pltfrm.c @@ -340,4 +340,3 @@ module_platform_driver(cdns_ufs_pltfrm_driver); MODULE_AUTHOR("Jan Kotas "); MODULE_DESCRIPTION("Cadence UFS host controller platform driver"); MODULE_LICENSE("GPL v2"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index f76692053ca1..81aa14661072 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -601,4 +601,3 @@ MODULE_AUTHOR("Santosh Yaragnavi "); MODULE_AUTHOR("Vinayak Holikatti "); MODULE_DESCRIPTION("UFS host controller PCI glue driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 9923cbc70653..fc5191101192 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -386,4 +386,3 @@ MODULE_AUTHOR("Santosh Yaragnavi "); MODULE_AUTHOR("Vinayak Holikatti "); MODULE_DESCRIPTION("UFS host controller Platform bus based glue driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 69198e37c976..912c3ecb8d7a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9923,4 +9923,3 @@ MODULE_AUTHOR("Santosh Yaragnavi "); MODULE_AUTHOR("Vinayak Holikatti "); MODULE_DESCRIPTION("Generic UFS host controller driver Core"); MODULE_LICENSE("GPL"); -MODULE_VERSION(UFSHCD_DRIVER_VERSION); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index bb2624aabda2..49edbdb5ffd6 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -49,7 +49,6 @@ #include "ufshci.h" #define UFSHCD "ufshcd" -#define UFSHCD_DRIVER_VERSION "0.2" struct ufs_hba; From patchwork Tue Apr 19 22:57:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90C49C433EF for ; Tue, 19 Apr 2022 22:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358390AbiDSXBi (ORCPT ); Tue, 19 Apr 2022 19:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358387AbiDSXBg (ORCPT ); Tue, 19 Apr 2022 19:01:36 -0400 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D5038781 for ; Tue, 19 Apr 2022 15:58:52 -0700 (PDT) Received: by mail-pg1-f180.google.com with SMTP id k14so25476346pga.0 for ; Tue, 19 Apr 2022 15:58:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yvy83NFDlypGK3KJlA/toH8UX9vzBdAcOUh51JSZ2OY=; b=ainafHovZ0wWMcD8er0xoB8MoQT4zlYPddwtGl+96bpKAXgmFqlu/cJYyCB0J9PRs/ w1jWKazZ6zPu+2m/BJ1UMI6rDFqQ5ZGUDtO3qF9frXdETdd+xT9CKxATN/IREEhL3thm zhCkZ5b4xVccjahhI87jn7YfJfTlo+ZY4FnljA9b1W0FLQr69x7OP4bUDYtPB0NC9lut q4UfZ9End/qgYOS0hzzU3akia0k2YnULsBesbSGu4UYEwWA687/cIQ2AZJ3pna1kB0y8 zxf5BXcfh1MNZG2ejjT9gagjuRZZpgtksjlLgNGWuKG10DVZdiAHIL+Bj5qdlwqycaOJ cI+w== X-Gm-Message-State: AOAM532u3Q9tjNMgRbsRcU6jhtsg6OLaqQtaR77P7r1gWxXV4pXPH3K1 1QWw3ylLQEF/19S8UBzTwP4= X-Google-Smtp-Source: ABdhPJzO1v7wFXx5euEdu8k55WWARRvRNiY16r+NE5G1m3HaSTZPthgW+gg+DlCacmrd9jYdfWw96Q== X-Received: by 2002:a63:7745:0:b0:3aa:4db4:3cc6 with SMTP id s66-20020a637745000000b003aa4db43cc6mr2478639pgc.24.1650409131445; Tue, 19 Apr 2022 15:58:51 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:50 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 16/28] scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun Date: Tue, 19 Apr 2022 15:57:59 -0700 Message-Id: <20220419225811.4127248-17-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The new name reflects the role of this member variable better: a WLUN through which the power mode of the UFS device is controlled. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 50 +++++++++++++++++++-------------------- drivers/scsi/ufs/ufshcd.h | 17 ++++++------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 912c3ecb8d7a..e0535e4d8669 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -540,7 +540,7 @@ static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap) static void ufshcd_print_host_state(struct ufs_hba *hba) { - struct scsi_device *sdev_ufs = hba->sdev_ufs_device; + struct scsi_device *sdev_ufs = hba->ufs_device_wlun; dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n", @@ -4195,7 +4195,7 @@ void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit) spin_unlock_irqrestore(hba->host->host_lock, flags); if (update && - !pm_runtime_suspended(&hba->sdev_ufs_device->sdev_gendev)) { + !pm_runtime_suspended(&hba->ufs_device_wlun->sdev_gendev)) { ufshcd_rpm_get_sync(hba); ufshcd_hold(hba, false); ufshcd_auto_hibern8_enable(hba); @@ -4911,13 +4911,13 @@ static void ufshcd_setup_links(struct ufs_hba *hba, struct scsi_device *sdev) * Device wlun is the supplier & rest of the luns are consumers. * This ensures that device wlun suspends after all other luns. */ - if (hba->sdev_ufs_device) { + if (hba->ufs_device_wlun) { link = device_link_add(&sdev->sdev_gendev, - &hba->sdev_ufs_device->sdev_gendev, + &hba->ufs_device_wlun->sdev_gendev, DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); if (!link) { dev_err(&sdev->sdev_gendev, "Failed establishing link - %s\n", - dev_name(&hba->sdev_ufs_device->sdev_gendev)); + dev_name(&hba->ufs_device_wlun->sdev_gendev)); return; } hba->luns_avail--; @@ -5053,15 +5053,15 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev) /* Drop the reference as it won't be needed anymore */ if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) { spin_lock_irqsave(hba->host->host_lock, flags); - hba->sdev_ufs_device = NULL; + hba->ufs_device_wlun = NULL; spin_unlock_irqrestore(hba->host->host_lock, flags); - } else if (hba->sdev_ufs_device) { + } else if (hba->ufs_device_wlun) { struct device *supplier = NULL; /* Ensure UFS Device WLUN exists and does not disappear */ spin_lock_irqsave(hba->host->host_lock, flags); - if (hba->sdev_ufs_device) { - supplier = &hba->sdev_ufs_device->sdev_gendev; + if (hba->ufs_device_wlun) { + supplier = &hba->ufs_device_wlun->sdev_gendev; get_device(supplier); } spin_unlock_irqrestore(hba->host->host_lock, flags); @@ -6037,7 +6037,7 @@ static void ufshcd_clk_scaling_suspend(struct ufs_hba *hba, bool suspend) static void ufshcd_err_handling_prepare(struct ufs_hba *hba) { ufshcd_rpm_get_sync(hba); - if (pm_runtime_status_suspended(&hba->sdev_ufs_device->sdev_gendev) || + if (pm_runtime_status_suspended(&hba->ufs_device_wlun->sdev_gendev) || hba->is_sys_suspended) { enum ufs_pm_op pm_op; @@ -6082,7 +6082,7 @@ static void ufshcd_err_handling_unprepare(struct ufs_hba *hba) static inline bool ufshcd_err_handling_should_stop(struct ufs_hba *hba) { return (!hba->is_powered || hba->shutting_down || - !hba->sdev_ufs_device || + !hba->ufs_device_wlun || hba->ufshcd_state == UFSHCD_STATE_ERROR || (!(hba->saved_err || hba->saved_uic_err || hba->force_reset || ufshcd_is_link_broken(hba)))); @@ -6101,7 +6101,7 @@ static void ufshcd_recover_pm_error(struct ufs_hba *hba) * Set RPM status of wlun device to RPM_ACTIVE, * this also clears its runtime error. */ - ret = pm_runtime_set_active(&hba->sdev_ufs_device->sdev_gendev); + ret = pm_runtime_set_active(&hba->ufs_device_wlun->sdev_gendev); /* hba device might have a runtime error otherwise */ if (ret) @@ -7495,20 +7495,20 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) int ret = 0; struct scsi_device *sdev_boot, *sdev_rpmb; - hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, + hba->ufs_device_wlun = __scsi_add_device(hba->host, 0, 0, ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); - if (IS_ERR(hba->sdev_ufs_device)) { - ret = PTR_ERR(hba->sdev_ufs_device); - hba->sdev_ufs_device = NULL; + if (IS_ERR(hba->ufs_device_wlun)) { + ret = PTR_ERR(hba->ufs_device_wlun); + hba->ufs_device_wlun = NULL; goto out; } - scsi_device_put(hba->sdev_ufs_device); + scsi_device_put(hba->ufs_device_wlun); sdev_rpmb = __scsi_add_device(hba->host, 0, 0, ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); if (IS_ERR(sdev_rpmb)) { ret = PTR_ERR(sdev_rpmb); - goto remove_sdev_ufs_device; + goto remove_ufs_device_wlun; } ufshcd_blk_pm_runtime_init(sdev_rpmb); scsi_device_put(sdev_rpmb); @@ -7523,8 +7523,8 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) } goto out; -remove_sdev_ufs_device: - scsi_remove_device(hba->sdev_ufs_device); +remove_ufs_device_wlun: + scsi_remove_device(hba->ufs_device_wlun); out: return ret; } @@ -8660,7 +8660,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, int ret, retries; spin_lock_irqsave(hba->host->host_lock, flags); - sdp = hba->sdev_ufs_device; + sdp = hba->ufs_device_wlun; if (sdp) { ret = scsi_device_get(sdp); if (!ret && !scsi_device_online(sdp)) { @@ -9224,7 +9224,7 @@ static void ufshcd_wl_shutdown(struct device *dev) ufshcd_rpm_get_sync(hba); scsi_device_quiesce(sdev); shost_for_each_device(sdev, hba->host) { - if (sdev == hba->sdev_ufs_device) + if (sdev == hba->ufs_device_wlun) continue; scsi_device_quiesce(sdev); } @@ -9445,7 +9445,7 @@ EXPORT_SYMBOL(ufshcd_shutdown); */ void ufshcd_remove(struct ufs_hba *hba) { - if (hba->sdev_ufs_device) + if (hba->ufs_device_wlun) ufshcd_rpm_get_sync(hba); ufs_hwmon_remove(hba); ufs_bsg_remove(hba); @@ -9773,7 +9773,7 @@ EXPORT_SYMBOL_GPL(ufshcd_resume_complete); static bool ufshcd_rpm_ok_for_spm(struct ufs_hba *hba) { - struct device *dev = &hba->sdev_ufs_device->sdev_gendev; + struct device *dev = &hba->ufs_device_wlun->sdev_gendev; enum ufs_dev_pwr_mode dev_pwr_mode; enum uic_link_state link_state; unsigned long flags; @@ -9802,7 +9802,7 @@ int __ufshcd_suspend_prepare(struct device *dev, bool rpm_ok_for_spm) * if it's runtime suspended. But ufs doesn't follow that. * Refer ufshcd_resume_complete() */ - if (hba->sdev_ufs_device) { + if (hba->ufs_device_wlun) { /* Prevent runtime suspend */ ufshcd_rpm_get_noresume(hba); /* diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 49edbdb5ffd6..14414225faa1 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -732,6 +732,7 @@ struct ufs_hba_monitor { * @utmrdl_dma_addr: UTMRDL DMA address * @host: Scsi_Host instance of the driver * @dev: device handle + * @ufs_device_wlun: WLUN that controls the entire UFS device. * @lrb: local reference block * @outstanding_tasks: Bits representing outstanding task requests * @outstanding_lock: Protects @outstanding_reqs. @@ -799,11 +800,7 @@ struct ufs_hba { struct Scsi_Host *host; struct device *dev; - /* - * This field is to keep a reference to "scsi_device" corresponding to - * "UFS device" W-LU. - */ - struct scsi_device *sdev_ufs_device; + struct scsi_device *ufs_device_wlun; #ifdef CONFIG_SCSI_UFS_HWMON struct device *hwmon_device; @@ -1407,27 +1404,27 @@ static inline int ufshcd_update_ee_usr_mask(struct ufs_hba *hba, static inline int ufshcd_rpm_get_sync(struct ufs_hba *hba) { - return pm_runtime_get_sync(&hba->sdev_ufs_device->sdev_gendev); + return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); } static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba) { - return pm_runtime_put_sync(&hba->sdev_ufs_device->sdev_gendev); + return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev); } static inline void ufshcd_rpm_get_noresume(struct ufs_hba *hba) { - pm_runtime_get_noresume(&hba->sdev_ufs_device->sdev_gendev); + pm_runtime_get_noresume(&hba->ufs_device_wlun->sdev_gendev); } static inline int ufshcd_rpm_resume(struct ufs_hba *hba) { - return pm_runtime_resume(&hba->sdev_ufs_device->sdev_gendev); + return pm_runtime_resume(&hba->ufs_device_wlun->sdev_gendev); } static inline int ufshcd_rpm_put(struct ufs_hba *hba) { - return pm_runtime_put(&hba->sdev_ufs_device->sdev_gendev); + return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); } #endif /* End of Header */ From patchwork Tue Apr 19 22:58:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE02BC433EF for ; Tue, 19 Apr 2022 22:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358394AbiDSXBl (ORCPT ); Tue, 19 Apr 2022 19:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358391AbiDSXBh (ORCPT ); Tue, 19 Apr 2022 19:01:37 -0400 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF94338781 for ; Tue, 19 Apr 2022 15:58:53 -0700 (PDT) Received: by mail-pf1-f173.google.com with SMTP id l127so188760pfl.6 for ; Tue, 19 Apr 2022 15:58:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Aw6YY+9Ojmaf5Vn85bSv35EzCBs6xNM6n5pGVr8SH9w=; b=tqrsvtv4uAR4V9nphEv25fr0owzNpDHpD/jQXmrUsOexcKHiFgdMVmd1PJJmWAlTzi 93qNE0GyLOh5ZVYifuKN78pep52iRejcY33x55jzMq5a/Wqg6Wj9vEYkPg/BlQsRFyen xd2IB/R9rKFsS+MhpgKMztG+FF8ScbqCvHCCzKkyXB6dvpQz7Cd3JBvKiAW0Jab0FihA RZ34ATno/Kp/Qfd3X8I37H7JBbz1avPivCPm6EGS/QtC9qzkluM9+ZaGhM6+9GRCnoz7 ZlQb3bLEJfjdOaUAwEpDMGuc2ctIWThSpby+BwFfZT5DfT9qmemPtFfz9NUv1wEklNNG INbQ== X-Gm-Message-State: AOAM531LT5c3ubr/+XuhpGW9hK/0qwJTJGnC3rn/WhLdMml6kMHAlCs2 vG4QklHsUR3hkrXo0y0m/60= X-Google-Smtp-Source: ABdhPJy5E0YWq7WONQUSNI5rkC9EKVz/lDxOfee/iKFiXapn82W8HvU7PVD6kLCstYU7CFkrKdXtaw== X-Received: by 2002:a65:5b84:0:b0:398:fd62:6497 with SMTP id i4-20020a655b84000000b00398fd626497mr16479783pgr.179.1650409133292; Tue, 19 Apr 2022 15:58:53 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:52 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche Subject: [PATCH v3 17/28] scsi: ufs: Use an SPDX license identifier in the Kconfig file Date: Tue, 19 Apr 2022 15:58:00 -0700 Message-Id: <20220419225811.4127248-18-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org As requested in Documentation/process/license-rules.rst, use an SPDX license identifier. Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/Kconfig | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 9fe27b01904e..3ebcd5bbc344 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ # # Kernel configuration file for the UFS Host Controller # @@ -7,30 +8,6 @@ # Authors: # Santosh Yaraganavi # Vinayak Holikatti -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# See the COPYING file in the top-level directory or visit -# -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# This program is provided "AS IS" and "WITH ALL FAULTS" and -# without warranty of any kind. You are solely responsible for -# determining the appropriateness of using and distributing -# the program and assume all risks associated with your exercise -# of rights with respect to the program, including but not limited -# to infringement of third party rights, the risks and costs of -# program errors, damage to or loss of data, programs or equipment, -# and unavailability or interruption of operations. Under no -# circumstances will the contributor of this Program be liable for -# any damages of any kind arising from your use or distribution of -# this program. config SCSI_UFSHCD tristate "Universal Flash Storage Controller Driver Core" From patchwork Tue Apr 19 22:58:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1B20C433F5 for ; Tue, 19 Apr 2022 22:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358391AbiDSXBm (ORCPT ); Tue, 19 Apr 2022 19:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358392AbiDSXBj (ORCPT ); Tue, 19 Apr 2022 19:01:39 -0400 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A675738781 for ; Tue, 19 Apr 2022 15:58:55 -0700 (PDT) Received: by mail-pg1-f171.google.com with SMTP id r83so5262082pgr.2 for ; Tue, 19 Apr 2022 15:58:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=thpfQVR6KxBSZIzdXb09bWsMzxC6P+h3c+aJ+9cCBrA=; b=32PSimux1h5R60FbCBIkWcNwqSvoJuKXPX+2FhFiB0QL5OApihkq2yaPnjf3qjsMKA jhBdaozkfvCcj2hiooBYc9+nVQh1GjS2WOI28aSNa9C5Gsdm5l9CVt8Up9luPkGXmjb5 Zs93SFoSg2xOGh06gJkQy3HFpWbGRpQXbIKbV06fNO4wKVwKT0ksQMlCF0TnGrPVrQAD tXN/zF8ucHniUsoyXBsrOrQCrqfWUSBPPYdICXbQLxfUDF1VwNKq+/OUTULyjzvoR7Hq tmwBeOHOb1HpnAfVvg1NqEO3vSHXz9a00wvee/TEiYcMjfjhN6bthc6GdybrftEZf+om heFw== X-Gm-Message-State: AOAM532ApWGEq1nEakqsLdWdIV4rg7/Zy8EJcKoa0C4vA4NYrMH+m1lZ glvkygtfrOYYZG4EZPlMppE= X-Google-Smtp-Source: ABdhPJw09V2jitdpEWb99cQ8ZNX+SAfbZhmBRhG46ogXMiJMsXzzdyGHXhNmrrCdKR7rQkwsVYbFLA== X-Received: by 2002:a05:6a00:2186:b0:4f7:5544:1cc9 with SMTP id h6-20020a056a00218600b004f755441cc9mr19812425pfi.62.1650409135121; Tue, 19 Apr 2022 15:58:55 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:54 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 18/28] scsi: ufs: Remove paths from source code comments Date: Tue, 19 Apr 2022 15:58:01 -0700 Message-Id: <20220419225811.4127248-19-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since specifying the path in a source file is redundant, remove the paths from source code comments. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/Kconfig | 1 - drivers/scsi/ufs/ufshcd-pci.c | 1 - drivers/scsi/ufs/unipro.h | 2 -- 3 files changed, 4 deletions(-) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 3ebcd5bbc344..393b9a01da36 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -2,7 +2,6 @@ # # Kernel configuration file for the UFS Host Controller # -# This code is based on drivers/scsi/ufs/Kconfig # Copyright (C) 2011-2013 Samsung India Software Operations # # Authors: diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 81aa14661072..d36873bc44fe 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -2,7 +2,6 @@ /* * Universal Flash Storage Host controller PCI glue driver * - * This code is based on drivers/scsi/ufs/ufshcd-pci.c * Copyright (C) 2011-2013 Samsung India Software Operations * * Authors: diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index 705a6465ba5c..64647aa5c2e0 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/drivers/scsi/ufs/unipro.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ /* - * drivers/scsi/ufs/unipro.h - * * Copyright (C) 2013 Samsung Electronics Co., Ltd. */ From patchwork Tue Apr 19 22:58:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EE46C433F5 for ; Tue, 19 Apr 2022 22:59:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358397AbiDSXBp (ORCPT ); Tue, 19 Apr 2022 19:01:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358393AbiDSXBl (ORCPT ); Tue, 19 Apr 2022 19:01:41 -0400 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66A47387A7 for ; Tue, 19 Apr 2022 15:58:57 -0700 (PDT) Received: by mail-pf1-f177.google.com with SMTP id a15so168548pfv.11 for ; Tue, 19 Apr 2022 15:58:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AR/WNtu1VUoxOK89WguYB/NAu+Nz/Pd74zMlFYIM9TM=; b=A8Y08WC0xPPYA8gzpv0SMI+VM7pOctSVskNZrQrT6vkikm9bCAAT4DRmXuJ70n4etH gClEiMllTl5CXAKEwiTzqXzb2LFdfjQX2t6ZdE9aHywbwy95PQPeKTFEtHlaCY6eaPG7 ldcd5CLKMBhRN0ZoTjAeYh151zUuHVGgPjS+LxyeDfwpavGlQxjc3X2Vj17zq6UQZQLq LZoT0wGahHJdM6kXYQmWhrelUzf1uArmatZD3lni5jOsU9gNwU1X3yodMyultwXH847Z eWvuHDFw6onulEz34wpnZGp/2ebVKxn7RjGACjVgiEZuLGMMGP0RNhZp9A37ZFFkCQq3 WXeg== X-Gm-Message-State: AOAM531U2QJ9ttB5qTttazM9rTNZsMq3Ep4qNVHQxbduWBz31PJejhBZ 7mxvyF86CQgcjkMJmGhsXMM= X-Google-Smtp-Source: ABdhPJx0eUGW9QViQHrSPGLoV/qoswaLn0070LOc7B96RVAjtyH8s5XFeF7kPfTKf75JpqGb6mdJDg== X-Received: by 2002:a65:56cb:0:b0:378:82ed:d74 with SMTP id w11-20020a6556cb000000b0037882ed0d74mr16724061pgs.491.1650409136811; Tue, 19 Apr 2022 15:58:56 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:56 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 19/28] scsi: ufs: Remove the TRUE and FALSE definitions Date: Tue, 19 Apr 2022 15:58:02 -0700 Message-Id: <20220419225811.4127248-20-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In the Linux kernel coding style document (Documentation/process/coding-style.rst) it is recommended to use the type 'bool' and also the values 'true' and 'false'. Hence this patch that removes the definitions and uses of TRUE and FALSE from the UFS driver. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-exynos.c | 4 ++-- drivers/scsi/ufs/ufs-exynos.h | 8 ++++---- drivers/scsi/ufs/ufshcd.c | 8 ++++---- drivers/scsi/ufs/unipro.h | 14 -------------- 4 files changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 474a4a064a68..0b99c74955ef 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -704,7 +704,7 @@ static void exynos_ufs_establish_connt(struct exynos_ufs *ufs) /* local unipro attributes */ ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID), DEV_ID); - ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID_VALID), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(N_DEVICEID_VALID), true); ufshcd_dme_set(hba, UIC_ARG_MIB(T_PEERDEVICEID), PEER_DEV_ID); ufshcd_dme_set(hba, UIC_ARG_MIB(T_PEERCPORTID), PEER_CPORT_ID); ufshcd_dme_set(hba, UIC_ARG_MIB(T_CPORTFLAGS), CPORT_DEF_FLAGS); @@ -1028,7 +1028,7 @@ static int exynos_ufs_post_link(struct ufs_hba *hba) if (ufs->opts & EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB) ufshcd_dme_set(hba, - UIC_ARG_MIB(T_DBG_SKIP_INIT_HIBERN8_EXIT), TRUE); + UIC_ARG_MIB(T_DBG_SKIP_INIT_HIBERN8_EXIT), true); if (attr->pa_granularity) { exynos_ufs_enable_dbg_mode(hba); diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 1c33e5466082..0b0a3d530ca6 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -248,22 +248,22 @@ long exynos_ufs_calc_time_cntr(struct exynos_ufs *, long); static inline void exynos_ufs_enable_ov_tm(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), true); } static inline void exynos_ufs_disable_ov_tm(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_OV_TM), false); } static inline void exynos_ufs_enable_dbg_mode(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), true); } static inline void exynos_ufs_disable_dbg_mode(struct ufs_hba *hba) { - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_DBG_MODE), false); } #endif /* _UFS_EXYNOS_H_ */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e0535e4d8669..37527865e26b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4325,18 +4325,18 @@ static int ufshcd_change_power_mode(struct ufs_hba *hba, pwr_mode->lane_rx); if (pwr_mode->pwr_rx == FASTAUTO_MODE || pwr_mode->pwr_rx == FAST_MODE) - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), true); else - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_RXTERMINATION), false); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXGEAR), pwr_mode->gear_tx); ufshcd_dme_set(hba, UIC_ARG_MIB(PA_ACTIVETXDATALANES), pwr_mode->lane_tx); if (pwr_mode->pwr_tx == FASTAUTO_MODE || pwr_mode->pwr_tx == FAST_MODE) - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), TRUE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), true); else - ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), FALSE); + ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TXTERMINATION), false); if (pwr_mode->pwr_rx == FASTAUTO_MODE || pwr_mode->pwr_tx == FASTAUTO_MODE || diff --git a/drivers/scsi/ufs/unipro.h b/drivers/scsi/ufs/unipro.h index 64647aa5c2e0..0521f887e3ac 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/drivers/scsi/ufs/unipro.h @@ -298,20 +298,6 @@ enum ufs_unipro_ver { #define T_TC0TXMAXSDUSIZE 0x4060 #define T_TC1TXMAXSDUSIZE 0x4061 -#ifdef FALSE -#undef FALSE -#endif - -#ifdef TRUE -#undef TRUE -#endif - -/* Boolean attribute values */ -enum { - FALSE = 0, - TRUE, -}; - /* CPort setting */ #define E2EFC_ON (1 << 0) #define E2EFC_OFF (0 << 0) From patchwork Tue Apr 19 22:58:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94477C433EF for ; Tue, 19 Apr 2022 22:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358405AbiDSXB6 (ORCPT ); Tue, 19 Apr 2022 19:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358395AbiDSXBm (ORCPT ); Tue, 19 Apr 2022 19:01:42 -0400 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FA3238781 for ; Tue, 19 Apr 2022 15:58:59 -0700 (PDT) Received: by mail-pg1-f172.google.com with SMTP id k14so25476518pga.0 for ; Tue, 19 Apr 2022 15:58:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=suepi4ajJAfM8bieNhK4/XUW0mgtvhHSHvhiWsmr9rE=; b=XYkD+mYtkiha25OxWVShVDiNYoTrvJ/rcU7nhQsh0V8O/hsS2e4jeUyKeiKyZNIFiP 0JkcpPRo4rQqZ5hE8fJ9ywMyINiMZqU7X/qkaHFx9zStd2KxIAJrfya/jPiSfE1JBbYi 4WMLxjrVjnjgYqx1Opf7ftV/xrUg76c2UPTb/BcBXsGlQF5r6DlT+c6Aq3N5JzC365vk 14IHfmesxvc03fylpwVaQDD4Xhy2GYyJshtLtCuQgKOuI5lfeL8CfdVYljsZcEii3+I9 DkaCCngOC5At8qcOudx4KaFKsNo8f6C+Q126P27EIQxgx+ZcBS7+4MOlUH+e7uicKWT0 zXyg== X-Gm-Message-State: AOAM532k2uupK0aRXiGi8Fg1o0b6P1vVGgElpgK1iIL9qqiHvjE41nn+ HvK5KEU+jgq1GjVSme5iwg0= X-Google-Smtp-Source: ABdhPJyZ2GPZq4IuMxeQvQdRzlhq1A4BKwCtuQvdduBZnCsPB72nhHGi4fGP6riYfU5GArhaz7MZiA== X-Received: by 2002:a65:4108:0:b0:399:1f0e:50da with SMTP id w8-20020a654108000000b003991f0e50damr16979201pgp.2.1650409138865; Tue, 19 Apr 2022 15:58:58 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:57 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 20/28] scsi: ufs: Remove locking from around single register writes Date: Tue, 19 Apr 2022 15:58:03 -0700 Message-Id: <20220419225811.4127248-21-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Single register writes are atomic and hence do not need to be surrounded by locking. Additionally, MMIO writes are typically posted asynchronously. Hence, there is no guarantee that these have finished by the time the spin_unlock*() call has finished. See also the nonposted-mmio property of the Open Firmware tree. See also pci_iomap(). Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 8 -------- drivers/scsi/ufs/ufshcd.c | 4 ---- 2 files changed, 12 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 9a4474210627..2b26acc74efb 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -171,7 +171,6 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba, enum ufs_notify_change_status status) { struct ufs_mtk_host *host = ufshcd_get_variant(hba); - unsigned long flags; if (status == PRE_CHANGE) { if (host->unipro_lpm) { @@ -185,12 +184,8 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba, ufs_mtk_crypto_enable(hba); if (host->caps & UFS_MTK_CAP_DISABLE_AH8) { - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, - flags); - hba->capabilities &= ~MASK_AUTO_HIBERN8_SUPPORT; hba->ahit = 0; } @@ -994,13 +989,10 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm) static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba) { - unsigned long flags; int ret; /* disable auto-hibern8 */ - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, flags); /* wait host return to idle state when auto-hibern8 off */ ufs_mtk_wait_idle_state(hba, 5); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 37527865e26b..d1c3f6291538 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4207,14 +4207,10 @@ EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update); void ufshcd_auto_hibern8_enable(struct ufs_hba *hba) { - unsigned long flags; - if (!ufshcd_is_auto_hibern8_supported(hba)) return; - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, flags); } /** From patchwork Tue Apr 19 22:58:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A08EC433FE for ; Tue, 19 Apr 2022 22:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358399AbiDSXB7 (ORCPT ); Tue, 19 Apr 2022 19:01:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358396AbiDSXBo (ORCPT ); Tue, 19 Apr 2022 19:01:44 -0400 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47195387A7 for ; Tue, 19 Apr 2022 15:59:01 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id d23-20020a17090a115700b001d2bde6c234so2298103pje.1 for ; Tue, 19 Apr 2022 15:59:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tGEXHmMu3kvnw3VvaDiJOZqYOiflKEv4GwCAstRS5Bo=; b=UzyrI1/7Mq77sZ101vXHhclyV0Iv6EP2CJGAViQQF2hBX/Z9rh8rYf3fP4CQ5nmRK8 u7R2RcnfH6j+gjXxlk0FrYQ4EVY53s36hKQmr+KJ0nflxrt64TBh3yKIS8p05C7Ty5UE WmQKbVZFnxLg5LhtmGZQNbkId/NLo/FI68/TdFuAaESY6KreaRqMJqcgNXiLkZTjY8KP q+gsI7QnQhKnKs92Ho9saBchMowAcN6BujpKcK09SqdFH6vCGSje0Ga7brqZAafIAKVW LDFn/LkAEtVUF66ZeTW9V6CRMviQesOaZOXy984kZRzWEnWU4mI5MTo1n7L91Ik/zjUH 9yQg== X-Gm-Message-State: AOAM532mO/ubPBv7LeA7Cnpqwf+krZV0NuHvg/d0PQf8aAPq6TAY/PhS eOW7LdVVQne9+wvaoVFATGY= X-Google-Smtp-Source: ABdhPJw1lUUALhhfZHRcTg2lFQ9nwtbTzd3283Md51fQZijUIksy84sVwoxwUUivxzg1XdwBdO0uUg== X-Received: by 2002:a17:90b:3715:b0:1cd:5529:4d72 with SMTP id mg21-20020a17090b371500b001cd55294d72mr955854pjb.201.1650409140696; Tue, 19 Apr 2022 15:59:00 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:58:59 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 21/28] scsi: ufs: Introduce ufshcd_clkgate_delay_set() Date: Tue, 19 Apr 2022 15:58:04 -0700 Message-Id: <20220419225811.4127248-22-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Since the code to modify delay_ms while holding the host lock occurs twice, introduce a function that performs this action. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 5 +---- drivers/scsi/ufs/ufshcd.c | 18 +++++++++++++----- drivers/scsi/ufs/ufshcd.h | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 2b26acc74efb..d19b35495302 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -857,7 +857,6 @@ static int ufs_mtk_pre_link(struct ufs_hba *hba) static void ufs_mtk_setup_clk_gating(struct ufs_hba *hba) { - unsigned long flags; u32 ah_ms; if (ufshcd_is_clkgating_allowed(hba)) { @@ -866,9 +865,7 @@ static void ufs_mtk_setup_clk_gating(struct ufs_hba *hba) hba->ahit); else ah_ms = 10; - spin_lock_irqsave(hba->host->host_lock, flags); - hba->clk_gating.delay_ms = ah_ms + 5; - spin_unlock_irqrestore(hba->host->host_lock, flags); + ufshcd_clkgate_delay_set(hba->dev, ah_ms + 5); } } diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d1c3f6291538..cb74a9eeee70 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1864,18 +1864,26 @@ static ssize_t ufshcd_clkgate_delay_show(struct device *dev, return sysfs_emit(buf, "%lu\n", hba->clk_gating.delay_ms); } +void ufshcd_clkgate_delay_set(struct device *dev, unsigned long value) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + unsigned long flags; + + spin_lock_irqsave(hba->host->host_lock, flags); + hba->clk_gating.delay_ms = value; + spin_unlock_irqrestore(hba->host->host_lock, flags); +} +EXPORT_SYMBOL_GPL(ufshcd_clkgate_delay_set); + static ssize_t ufshcd_clkgate_delay_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct ufs_hba *hba = dev_get_drvdata(dev); - unsigned long flags, value; + unsigned long value; if (kstrtoul(buf, 0, &value)) return -EINVAL; - spin_lock_irqsave(hba->host->host_lock, flags); - hba->clk_gating.delay_ms = value; - spin_unlock_irqrestore(hba->host->host_lock, flags); + ufshcd_clkgate_delay_set(dev, value); return count; } diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 14414225faa1..3eb5d2c17e39 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1186,6 +1186,8 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, int ufshcd_hold(struct ufs_hba *hba, bool async); void ufshcd_release(struct ufs_hba *hba); +void ufshcd_clkgate_delay_set(struct device *dev, unsigned long value); + void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, int *desc_length); From patchwork Tue Apr 19 22:58:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B013C433F5 for ; Tue, 19 Apr 2022 22:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358406AbiDSXCC (ORCPT ); Tue, 19 Apr 2022 19:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358393AbiDSXBr (ORCPT ); Tue, 19 Apr 2022 19:01:47 -0400 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363FD38BDA for ; Tue, 19 Apr 2022 15:59:03 -0700 (PDT) Received: by mail-pf1-f176.google.com with SMTP id bo5so197590pfb.4 for ; Tue, 19 Apr 2022 15:59:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J/MJzNqvlCtUnHD68INLBgpjwK6/TYRS8vbqLhrtU/k=; b=CxnMuAjGzvvYv+KXye/gA6VE/7/tFxTWytSwyyncr8x8Dy3gIrXTXoTMdBMdst1vHd vVf8j9IS33frRcbrXOgKo1Pe7wvGNaCFDervhYgGclW0+FqshSFsS9vhgbmBSQ41dls9 TxnRsWjUZZ0IExhX6gIZudfd92a7/H+sQVPaQCA0uUmuDK9/rOCrJmmiXXpUU3RE1g0f 3QOj+q1HrQGSjq03f2boBc1kASPSLYwLPeUzg7fei28qdhJW4UGF0KpflGCjY+AKbUdo lujJVUM2ZZ7eLlFC6xPCPsqZkBxVIaAJYk8PMkJDkndkzVvGQuLqxAOqpAd0U33WC+Xb AVtA== X-Gm-Message-State: AOAM532ror8dNwDwWO7PCKCZZCUmJGVIL7mRHoa3H+ugOihb/f2WOEhx PrPptZHk70lrj1Yl5VnW6Ak= X-Google-Smtp-Source: ABdhPJzWfrlvR38NSuTDb2X9yy4znY8iswxACuu+stwub4pxc1b0kKuQiYtb6dDJ8nUPiAx0wbT8Dw== X-Received: by 2002:a65:52cc:0:b0:3a9:fd44:1d7 with SMTP id z12-20020a6552cc000000b003a9fd4401d7mr10469548pgp.211.1650409142629; Tue, 19 Apr 2022 15:59:02 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:59:01 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Bjorn Andersson Subject: [PATCH v3 22/28] scsi: ufs: qcom: Fix ufs_qcom_resume() Date: Tue, 19 Apr 2022 15:58:05 -0700 Message-Id: <20220419225811.4127248-23-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Clearing hba->is_sys_suspended if ufs_qcom_resume() succeeds is wrong. That variable must only be cleared if all actions involved in a resume succeed. Hence remove the statement that clears hba->is_sys_suspended from ufs_qcom_resume(). Reviewed-by: Bjorn Andersson Fixes: 81c0fc51b7a7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms") Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-qcom.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index dded29722880..98ed9e9f7e2e 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -640,12 +640,7 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) return err; } - err = ufs_qcom_ice_resume(host); - if (err) - return err; - - hba->is_sys_suspended = false; - return 0; + return ufs_qcom_ice_resume(host); } static void ufs_qcom_dev_ref_clk_ctrl(struct ufs_qcom_host *host, bool enable) From patchwork Tue Apr 19 22:58:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30788C433EF for ; Tue, 19 Apr 2022 22:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358407AbiDSXCE (ORCPT ); Tue, 19 Apr 2022 19:02:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236236AbiDSXBs (ORCPT ); Tue, 19 Apr 2022 19:01:48 -0400 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 281E738BDB for ; Tue, 19 Apr 2022 15:59:05 -0700 (PDT) Received: by mail-pj1-f53.google.com with SMTP id d23-20020a17090a115700b001d2bde6c234so2298205pje.1 for ; Tue, 19 Apr 2022 15:59:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EJ468TeVvgDjWAjEHgL/VFPLqS8lMjgqHXroFUEkPJw=; b=8PN6LXfZbLbXggWlUeVh9XhJyFP0DzOjSyNvBPTn1Ynemn3zZdqGaZUqKnLB0vlJnf 6ca/9g71aoVbeLN9QHQQl7Sa0Pbk6NcaStvxVUsSJZ16A6ozuyv4gTxNtC05/QcRgeX2 evijuNPYy3IvtpC71dB88UjD13oOOkQ3tFPnRYpTttq0X1nOhCy9aDmV2e3DYQmoR5gH Tr/yEuJJQRvqXK6JX8TGAY1Fm/P6g8eakH5Puh+AdEW6a7W4Ka6/pQujOMu7T1C3GlUp PVwJ+AMT6B1pGmDAiclFGCSPnhTwYJjT1Ia1wSgXbnCtpfCU2eslmgaTMhNsAdxoOzI7 qFvA== X-Gm-Message-State: AOAM5311Xr4W2ZXqruX0mUU95rpyT6TfDN0Xyug0Wthxq5VIUNGWirKz 2FArmeaDfWGDzuEfZJ8bypM= X-Google-Smtp-Source: ABdhPJy26uKlFyIuChLtuKrXaGMsU2bW61bisnb8p5SbqR4U0hTtjOiE19K0baIuESvubvBaMrQFuA== X-Received: by 2002:a17:90b:1c05:b0:1d2:ae49:b23d with SMTP id oc5-20020a17090b1c0500b001d2ae49b23dmr977883pjb.236.1650409144650; Tue, 19 Apr 2022 15:59:04 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:59:03 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Eric Biggers Subject: [PATCH v3 23/28] scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives Date: Tue, 19 Apr 2022 15:58:06 -0700 Message-Id: <20220419225811.4127248-24-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org ufshcd-crypto.h declares functions that must only be called by the UFS core. Hence remove the #include "ufshcd-crypto.h" directive from UFS drivers. Reviewed-by: Eric Biggers Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-mediatek.c | 1 - drivers/scsi/ufs/ufs-qcom-ice.c | 1 - drivers/scsi/ufs/ufs-qcom.h | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index d19b35495302..84ccb5258736 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -19,7 +19,6 @@ #include #include "ufshcd.h" -#include "ufshcd-crypto.h" #include "ufshcd-pltfrm.h" #include "ufs_quirks.h" #include "unipro.h" diff --git a/drivers/scsi/ufs/ufs-qcom-ice.c b/drivers/scsi/ufs/ufs-qcom-ice.c index bbb0ad7590ec..921d6a93b653 100644 --- a/drivers/scsi/ufs/ufs-qcom-ice.c +++ b/drivers/scsi/ufs/ufs-qcom-ice.c @@ -9,7 +9,6 @@ #include #include -#include "ufshcd-crypto.h" #include "ufs-qcom.h" #define AES_256_XTS_KEY_SIZE 64 diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h index 51570224a6e2..771bc95d02c7 100644 --- a/drivers/scsi/ufs/ufs-qcom.h +++ b/drivers/scsi/ufs/ufs-qcom.h @@ -7,6 +7,7 @@ #include #include +#include "ufshcd.h" #define MAX_UFS_QCOM_HOSTS 1 #define MAX_U32 (~(u32)0) From patchwork Tue Apr 19 22:58:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564254 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24B60C433FE for ; Tue, 19 Apr 2022 22:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358408AbiDSXCF (ORCPT ); Tue, 19 Apr 2022 19:02:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358398AbiDSXBv (ORCPT ); Tue, 19 Apr 2022 19:01:51 -0400 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1668A38BE6 for ; Tue, 19 Apr 2022 15:59:07 -0700 (PDT) Received: by mail-pg1-f177.google.com with SMTP id g9so485499pgc.10 for ; Tue, 19 Apr 2022 15:59:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EOUmboiNj5HOTm5MUZWIXZufVp76FS1+C1EDHdcAOvQ=; b=HO3dOqeNXLpoRjc0DymEdHalZUhoIYzR3nYVCZSn9U/uQ0r0aG9pSTKrhlfI42Vrzt V9bA0G1OG3IbYqdEiKdAdmJFK21DcmJfMvKG1Ivi8A+vysl3yxzDIDAsV5pkGkMqr5nW r3G06x5/QkteVT5pK7xNZ4WpU3JBLOj01sXQ1u7WJ5OL1hBgnuATMmpWsXTrTNBfEA18 PAkvECufnHmnYhXm2D0F7MFuMHmnVhHsAe2AtZbS2ZaZESLWBxMuhgVSzK9IzCzn408c NbLwBlQzosDQS6vJQ9wACYv9RodtYlEKPuZl9NwWZihnlurnlNY7eM4F+ayjrMBbVl6q dTvg== X-Gm-Message-State: AOAM530Nz9GBKSqo//jUxWScA9fkSUIWupBXphpIUrVNNjSj7HRDFyOg vyYzppH9eBKm41QaBayMeo4= X-Google-Smtp-Source: ABdhPJyQoCwMWrQHGQelc5qEINSgp+dTyWCtXNfQAXbtDQLkB6HpzvEqLH7XOxJtrHguuu3W1NTahw== X-Received: by 2002:a05:6a00:724:b0:4fa:a35f:8e0f with SMTP id 4-20020a056a00072400b004faa35f8e0fmr19982737pfm.25.1650409146399; Tue, 19 Apr 2022 15:59:06 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:59:05 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 24/28] scsi: ufs: Fix kernel-doc syntax in ufshcd.h Date: Tue, 19 Apr 2022 15:58:07 -0700 Message-Id: <20220419225811.4127248-25-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch fixes all the warnings and errors reported by the following command: scripts/kernel-doc -none drivers/scsi/ufs/ufshcd.h Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.h | 89 ++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 3eb5d2c17e39..412fe43cd763 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -236,6 +236,7 @@ struct ufs_query { * @type: device management command type - Query, NOP OUT * @lock: lock to allow one command at a time * @complete: internal commands completion + * @query: Device management query information */ struct ufs_dev_cmd { enum dev_cmd_type type; @@ -253,7 +254,7 @@ struct ufs_dev_cmd { * @min_freq: min frequency that can be used for clock scaling * @curr_freq: indicates the current frequency that it is set to * @keep_link_active: indicates that the clk should not be disabled if - link is active + * link is active * @enabled: variable to check against multiple enable/disable */ struct ufs_clk_info { @@ -308,11 +309,13 @@ struct ufs_pwr_mode_info { * to set some things * @hibern8_notify: called around hibern8 enter/exit * @apply_dev_quirks: called to apply device specific quirks + * @fixup_dev_quirks: called to modify device specific quirks * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information * @phy_initialization: used to initialize phys * @device_reset: called to issue a reset pulse on the UFS device + * @config_scaling_param: called to configure clock scaling parameters * @program_key: program or evict an inline encryption key * @event_notify: called to notify important events */ @@ -379,6 +382,7 @@ enum clk_gating_state { * @is_initialized: Indicates whether clock gating is initialized or not * @active_reqs: number of requests that are pending and should be waited for * completion before gating clocks. + * @clk_gating_workq: workqueue for clock gating work. */ struct ufs_clk_gating { struct delayed_work gate_work; @@ -415,9 +419,9 @@ struct ufs_saved_pwr_info { * @resume_work: worker to resume devfreq * @min_gear: lowest HS gear to scale down to * @is_enabled: tracks if scaling is currently enabled or not, controlled by - clkscale_enable sysfs node + * clkscale_enable sysfs node * @is_allowed: tracks if scaling is currently allowed or not, used to block - clock scaling which is not invoked from devfreq governor + * clock scaling which is not invoked from devfreq governor * @is_initialized: Indicates whether clock scaling is initialized or not * @is_busy_started: tracks if busy period has started or not * @is_suspended: tracks if devfreq is suspended or not @@ -444,7 +448,7 @@ struct ufs_clk_scaling { /** * struct ufs_event_hist - keeps history of errors * @pos: index to indicate cyclic buffer position - * @reg: cyclic buffer for registers value + * @val: cyclic buffer for registers value * @tstamp: cyclic buffer for time stamp * @cnt: error counter */ @@ -463,6 +467,7 @@ struct ufs_event_hist { * reset this after link-startup. * @last_hibern8_exit_tstamp: Set time after the hibern8 exit. * Clear after the first successful command completion. + * @event: array with event history. */ struct ufs_stats { u32 last_intr_status; @@ -733,6 +738,13 @@ struct ufs_hba_monitor { * @host: Scsi_Host instance of the driver * @dev: device handle * @ufs_device_wlun: WLUN that controls the entire UFS device. + * @hwmon_device: device instance registered with the hwmon core. + * @curr_dev_pwr_mode: active UFS device power mode. + * @uic_link_state: active state of the link to the UFS device. + * @rpm_lvl: desired UFS power management level during runtime PM. + * @spm_lvl: desired UFS power management level during system PM. + * @pm_op_in_progress: whether or not a PM operation is in progress. + * @ahit: value of Auto-Hibernate Idle Timer register. * @lrb: local reference block * @outstanding_tasks: Bits representing outstanding task requests * @outstanding_lock: Protects @outstanding_reqs. @@ -743,17 +755,26 @@ struct ufs_hba_monitor { * @reserved_slot: Used to submit device commands. Protected by @dev_cmd.lock. * @ufs_version: UFS Version to which controller complies * @vops: pointer to variant specific operations + * @vps: pointer to variant specific parameters * @priv: pointer to variant specific private data * @irq: Irq number of the controller - * @active_uic_cmd: handle of active UIC command - * @uic_cmd_mutex: mutex for UIC command + * @is_irq_enabled: whether or not the UFS controller interrupt is enabled. + * @dev_ref_clk_freq: reference clock frequency + * @quirks: bitmask with information about deviations from the UFSHCI standard. + * @dev_quirks: bitmask with information about deviations from the UFS standard. * @tmf_tag_set: TMF tag set. * @tmf_queue: Used to allocate TMF tags. - * @pwr_done: completion for power mode change + * @tmf_rqs: array with pointers to TMF requests while these are in progress. + * @active_uic_cmd: handle of active UIC command + * @uic_cmd_mutex: mutex for UIC command + * @uic_async_done: completion used during UIC processing * @ufshcd_state: UFSHCD state * @eh_flags: Error handling flags * @intr_mask: Interrupt Mask Bits * @ee_ctrl_mask: Exception event control mask + * @ee_drv_mask: Exception event mask for driver + * @ee_usr_mask: Exception event mask for user (set via debugfs) + * @ee_ctrl_mutex: Used to serialize exception event information. * @is_powered: flag to check if HBA is powered * @shutting_down: flag to check if shutdown has been invoked * @host_sem: semaphore used to serialize concurrent contexts @@ -764,26 +785,52 @@ struct ufs_hba_monitor { * @uic_error: UFS interconnect layer error status * @saved_err: sticky error mask * @saved_uic_err: sticky UIC error mask + * @ufs_stats: various error counters * @force_reset: flag to force eh_work perform a full reset * @force_pmc: flag to force a power mode change * @silence_err_logs: flag to silence error logs * @dev_cmd: ufs device management command information * @last_dme_cmd_tstamp: time stamp of the last completed DME command + * @nop_out_timeout: NOP OUT timeout value + * @dev_info: information about the UFS device * @auto_bkops_enabled: to track whether bkops is enabled in device * @vreg_info: UFS device voltage regulator information * @clk_list_head: UFS host controller clocks list node head + * @req_abort_count: number of times ufshcd_abort() has been called + * @lanes_per_direction: number of lanes per data direction between the UFS + * controller and the UFS device. * @pwr_info: holds current power mode * @max_pwr_info: keeps the device max valid pwm - * @clk_scaling_lock: used to serialize device commands and clock scaling - * @desc_size: descriptor sizes reported by device + * @clk_gating: information related to clock gating + * @caps: bitmask with information about UFS controller capabilities + * @devfreq: frequency scaling information owned by the devfreq core + * @clk_scaling: frequency scaling information owned by the UFS driver + * @is_sys_suspended: whether or not the entire system has been suspended * @urgent_bkops_lvl: keeps track of urgent bkops level for device * @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for * device is known or not. + * @clk_scaling_lock: used to serialize device commands and clock scaling + * @desc_size: descriptor sizes reported by device * @scsi_block_reqs_cnt: reference counting for scsi block requests + * @bsg_dev: struct device associated with the BSG queue + * @bsg_queue: BSG queue associated with the UFS controller + * @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power + * management) after the UFS device has finished a WriteBooster buffer + * flush or auto BKOP. + * @ufshpb_dev: information related to HPB (Host Performance Booster). + * @monitor: statistics about UFS commands * @crypto_capabilities: Content of crypto capabilities register (0x100) * @crypto_cap_array: Array of crypto capabilities * @crypto_cfg_register: Start of the crypto cfg array * @crypto_profile: the crypto profile of this hba (if applicable) + * @debugfs_root: UFS controller debugfs root directory + * @debugfs_ee_work: used to restore ee_ctrl_mask after a delay + * @debugfs_ee_rate_limit_ms: user configurable delay after which to restore + * ee_ctrl_mask + * @luns_avail: number of regular and well known LUNs supported by the UFS + * device + * @complete_put: whether or not to call ufshcd_rpm_put() from inside + * ufshcd_resume_complete() */ struct ufs_hba { void __iomem *mmio_base; @@ -853,9 +900,9 @@ struct ufs_hba { enum ufshcd_state ufshcd_state; u32 eh_flags; u32 intr_mask; - u16 ee_ctrl_mask; /* Exception event mask */ - u16 ee_drv_mask; /* Exception event mask for driver */ - u16 ee_usr_mask; /* Exception event mask for user (via debugfs) */ + u16 ee_ctrl_mask; + u16 ee_drv_mask; + u16 ee_usr_mask; struct mutex ee_ctrl_mutex; bool is_powered; bool shutting_down; @@ -996,11 +1043,11 @@ static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) readl((hba)->mmio_base + (reg)) /** - * ufshcd_rmwl - read modify write into a register - * @hba - per adapter instance - * @mask - mask to apply on read value - * @val - actual value to write - * @reg - register address + * ufshcd_rmwl - perform read/modify/write for a controller register + * @hba: per adapter instance + * @mask: mask to apply on read value + * @val: actual value to write + * @reg: register address */ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) { @@ -1035,8 +1082,8 @@ static inline void check_upiu_size(void) /** * ufshcd_set_variant - set variant specific data to the hba - * @hba - per adapter instance - * @variant - pointer to variant specific data + * @hba: per adapter instance + * @variant: pointer to variant specific data */ static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant) { @@ -1046,7 +1093,7 @@ static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant) /** * ufshcd_get_variant - get variant specific data from the hba - * @hba - per adapter instance + * @hba: per adapter instance */ static inline void *ufshcd_get_variant(struct ufs_hba *hba) { @@ -1367,7 +1414,7 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; -/* +/** * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN * @scsi_lun: scsi LUN id * From patchwork Tue Apr 19 22:58:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CFF9C433F5 for ; Tue, 19 Apr 2022 22:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358411AbiDSXCI (ORCPT ); Tue, 19 Apr 2022 19:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358400AbiDSXB5 (ORCPT ); Tue, 19 Apr 2022 19:01:57 -0400 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF0C38BF0 for ; Tue, 19 Apr 2022 15:59:08 -0700 (PDT) Received: by mail-pf1-f181.google.com with SMTP id n22so236598pfa.0 for ; Tue, 19 Apr 2022 15:59:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1vcSv+MVLdh1Wfw67TIbF/fd+t7Zg8wj9NqjsvB59t0=; b=Rs/jpMXKo6fCnalk08gncHlcYYzrOhr5onoqUfvuwiwJ5mYJCtlU7J/sjgZK60rYLb pK4lB6GjQc0H6mDEd+KkENSPlB/fq7vkSOVhXTJUyICucQG2NGHpuhED1NLLnL765Jqy 1AP4yxFJenX5eFOvyxGQtuSp4V7k0+61/diSb7zDX5X6emRzcl1of3uobd+y3dSrnBtA HR4II1pVZssnYIw0R39V7JdNvKwNCxEvYbwOuuRDujbDfj2RqoRIZec1jOBcNxfsKclv BUy3lI7GTPe/DFOaXpMC4CXe/RrcC/VUnlrJejEG4SXk2+MC97oHa548dsHcNoW2K3St Iydw== X-Gm-Message-State: AOAM532kdVd0s1GGR92ast8ohSIk9J1pkLSUAoCkKCHWdJT9wD+/J09a /BGx8WX8BkZCrqjzbT2dH80= X-Google-Smtp-Source: ABdhPJyJ8K62ABOmAN0B65Iz7brB0VqwNzKSjIQ9vVqeT6xaqHJPSjier+l3w5M/GV1OOjKF40YZNg== X-Received: by 2002:a05:6a00:e0b:b0:4fa:a167:5b35 with SMTP id bq11-20020a056a000e0b00b004faa1675b35mr20337166pfb.69.1650409148320; Tue, 19 Apr 2022 15:59:08 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:59:07 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche Subject: [PATCH v3 25/28] scsi: ufs: Minimize #include directives Date: Tue, 19 Apr 2022 15:58:08 -0700 Message-Id: <20220419225811.4127248-26-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Follow the convention that is used elsewhere in the Linux kernel source code and only include those headers of which the declarations are used directly. Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/cdns-pltfrm.c | 1 + drivers/scsi/ufs/tc-dwc-g210-pci.c | 1 + drivers/scsi/ufs/tc-dwc-g210-pltfrm.c | 1 + drivers/scsi/ufs/tc-dwc-g210.c | 2 ++ drivers/scsi/ufs/tc-dwc-g210.h | 2 ++ drivers/scsi/ufs/ufs-exynos.c | 1 + drivers/scsi/ufs/ufs-hisi.c | 2 ++ drivers/scsi/ufs/ufs-mediatek.c | 3 +++ drivers/scsi/ufs/ufs-qcom-ice.c | 1 + drivers/scsi/ufs/ufs-qcom.c | 4 ++++ drivers/scsi/ufs/ufs-sysfs.c | 1 + drivers/scsi/ufs/ufs-sysfs.h | 3 ++- drivers/scsi/ufs/ufs_bsg.c | 5 ++++ drivers/scsi/ufs/ufs_bsg.h | 7 +----- drivers/scsi/ufs/ufshcd-crypto.h | 5 ++-- drivers/scsi/ufs/ufshcd-dwc.c | 2 ++ drivers/scsi/ufs/ufshcd-dwc.h | 2 ++ drivers/scsi/ufs/ufshcd-pci.c | 2 ++ drivers/scsi/ufs/ufshcd-pltfrm.c | 1 + drivers/scsi/ufs/ufshcd.c | 9 ++++++++ drivers/scsi/ufs/ufshcd.h | 33 ++++----------------------- drivers/scsi/ufs/ufshci.h | 2 ++ drivers/scsi/ufs/ufshpb.c | 4 ++++ 23 files changed, 56 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c index e91cf9fd5a95..e05c0ae64eea 100644 --- a/drivers/scsi/ufs/cdns-pltfrm.c +++ b/drivers/scsi/ufs/cdns-pltfrm.c @@ -9,6 +9,7 @@ * */ +#include #include #include #include diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g210-pci.c index 7b08e2e07cc5..e635c211c783 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pci.c +++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c @@ -11,6 +11,7 @@ #include "ufshcd-dwc.h" #include "tc-dwc-g210.h" +#include #include #include diff --git a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c b/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c index 783ec43efa78..f15a84d0c176 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c +++ b/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "ufshcd-pltfrm.h" #include "ufshcd-dwc.h" diff --git a/drivers/scsi/ufs/tc-dwc-g210.c b/drivers/scsi/ufs/tc-dwc-g210.c index f954a68f6b4c..7ef67c9fc5b8 100644 --- a/drivers/scsi/ufs/tc-dwc-g210.c +++ b/drivers/scsi/ufs/tc-dwc-g210.c @@ -7,6 +7,8 @@ * Authors: Joao Pinto */ +#include + #include "ufshcd.h" #include "unipro.h" diff --git a/drivers/scsi/ufs/tc-dwc-g210.h b/drivers/scsi/ufs/tc-dwc-g210.h index 5a506da03f4a..f7154012f5c7 100644 --- a/drivers/scsi/ufs/tc-dwc-g210.h +++ b/drivers/scsi/ufs/tc-dwc-g210.h @@ -10,6 +10,8 @@ #ifndef _TC_DWC_G210_H #define _TC_DWC_G210_H +struct ufs_hba; + int tc_dwc_g210_config_40_bit(struct ufs_hba *hba); int tc_dwc_g210_config_20_bit(struct ufs_hba *hba); diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 0b99c74955ef..ddb2d42605c5 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c index ab1a7ebd89b1..7046143063ee 100644 --- a/drivers/scsi/ufs/ufs-hisi.c +++ b/drivers/scsi/ufs/ufs-hisi.c @@ -7,6 +7,8 @@ */ #include +#include +#include #include #include #include diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 84ccb5258736..083d6bd4d561 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -8,6 +8,9 @@ #include #include +#include +#include +#include #include #include #include diff --git a/drivers/scsi/ufs/ufs-qcom-ice.c b/drivers/scsi/ufs/ufs-qcom-ice.c index 921d6a93b653..745e48ec598f 100644 --- a/drivers/scsi/ufs/ufs-qcom-ice.c +++ b/drivers/scsi/ufs/ufs-qcom-ice.c @@ -6,6 +6,7 @@ * Copyright 2019 Google LLC */ +#include #include #include diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 98ed9e9f7e2e..a63844961222 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -5,6 +5,9 @@ #include #include +#include +#include +#include #include #include #include @@ -18,6 +21,7 @@ #include "ufs-qcom.h" #include "ufshci.h" #include "ufs_quirks.h" + #define UFS_QCOM_DEFAULT_DBG_PRINT_EN \ (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN) diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 5c405ff7b6ea..95a4e64ce401 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -8,6 +8,7 @@ #include "ufs.h" #include "ufs-sysfs.h" +#include "ufshcd.h" static const char *ufshcd_uic_link_state_to_string( enum uic_link_state state) diff --git a/drivers/scsi/ufs/ufs-sysfs.h b/drivers/scsi/ufs/ufs-sysfs.h index 0f4e750a6748..8d94af3b8077 100644 --- a/drivers/scsi/ufs/ufs-sysfs.h +++ b/drivers/scsi/ufs/ufs-sysfs.h @@ -7,11 +7,12 @@ #include -#include "ufshcd.h" +struct device; void ufs_sysfs_add_nodes(struct device *dev); void ufs_sysfs_remove_nodes(struct device *dev); extern const struct attribute_group ufs_sysfs_unit_descriptor_group; extern const struct attribute_group ufs_sysfs_lun_attributes_group; + #endif diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c index 39bf204c6ec3..fbcdfb713542 100644 --- a/drivers/scsi/ufs/ufs_bsg.c +++ b/drivers/scsi/ufs/ufs_bsg.c @@ -4,7 +4,12 @@ * * Copyright (C) 2018 Western Digital Corporation */ + +#include +#include +#include #include "ufs_bsg.h" +#include "ufshcd.h" static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len, struct utp_upiu_query *qr) diff --git a/drivers/scsi/ufs/ufs_bsg.h b/drivers/scsi/ufs/ufs_bsg.h index d09918758631..57712d2656d2 100644 --- a/drivers/scsi/ufs/ufs_bsg.h +++ b/drivers/scsi/ufs/ufs_bsg.h @@ -5,12 +5,7 @@ #ifndef UFS_BSG_H #define UFS_BSG_H -#include -#include -#include - -#include "ufshcd.h" -#include "ufs.h" +struct ufs_hba; #ifdef CONFIG_SCSI_UFS_BSG void ufs_bsg_remove(struct ufs_hba *hba); diff --git a/drivers/scsi/ufs/ufshcd-crypto.h b/drivers/scsi/ufs/ufshcd-crypto.h index e18c01276873..57dd51256b57 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.h +++ b/drivers/scsi/ufs/ufshcd-crypto.h @@ -6,9 +6,10 @@ #ifndef _UFSHCD_CRYPTO_H #define _UFSHCD_CRYPTO_H -#ifdef CONFIG_SCSI_UFS_CRYPTO +#include #include "ufshcd.h" -#include "ufshci.h" + +#ifdef CONFIG_SCSI_UFS_CRYPTO static inline void ufshcd_prepare_lrbp_crypto(struct request *rq, struct ufshcd_lrb *lrbp) diff --git a/drivers/scsi/ufs/ufshcd-dwc.c b/drivers/scsi/ufs/ufshcd-dwc.c index 5bb9d3a88795..a57973c8d2a1 100644 --- a/drivers/scsi/ufs/ufshcd-dwc.c +++ b/drivers/scsi/ufs/ufshcd-dwc.c @@ -7,6 +7,8 @@ * Authors: Joao Pinto */ +#include + #include "ufshcd.h" #include "unipro.h" diff --git a/drivers/scsi/ufs/ufshcd-dwc.h b/drivers/scsi/ufs/ufshcd-dwc.h index 4268ca2eb64c..43b70794e24f 100644 --- a/drivers/scsi/ufs/ufshcd-dwc.h +++ b/drivers/scsi/ufs/ufshcd-dwc.h @@ -10,6 +10,8 @@ #ifndef _UFSHCD_DWC_H #define _UFSHCD_DWC_H +#include "ufshcd.h" + struct ufshcd_dme_attr_val { u32 attr_sel; u32 mib_val; diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index d36873bc44fe..5fe30dcf98b4 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -10,6 +10,8 @@ */ #include "ufshcd.h" +#include +#include #include #include #include diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index fc5191101192..f5313f407617 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -8,6 +8,7 @@ * Vinayak Holikatti */ +#include #include #include #include diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index cb74a9eeee70..5308f43bda6e 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -16,7 +16,16 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include "ufshcd.h" #include "ufs_quirks.h" #include "unipro.h" diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 412fe43cd763..ab0c643296c0 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -12,38 +12,13 @@ #ifndef _UFSHCD_H #define _UFSHCD_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include #include +#include +#include +#include +#include #include "unipro.h" - -#include -#include -#include -#include -#include -#include -#include -#include - #include "ufs.h" #include "ufs_quirks.h" #include "ufshci.h" diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index a7ff0e5b5494..f81aa95ffbc4 100644 --- a/drivers/scsi/ufs/ufshci.h +++ b/drivers/scsi/ufs/ufshci.h @@ -11,6 +11,8 @@ #ifndef _UFSHCI_H #define _UFSHCI_H +#include + enum { TASK_REQ_UPIU_SIZE_DWORDS = 8, TASK_RSP_UPIU_SIZE_DWORDS = 8, diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index ebd8fc8fc109..5a974642779f 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -10,6 +10,10 @@ */ #include +#include +#include +#include +#include #include "ufshcd.h" #include "ufshpb.h" From patchwork Tue Apr 19 22:58:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 563846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7D7FC433F5 for ; Tue, 19 Apr 2022 22:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358409AbiDSXCG (ORCPT ); Tue, 19 Apr 2022 19:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358401AbiDSXB6 (ORCPT ); Tue, 19 Apr 2022 19:01:58 -0400 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E1338BF1 for ; Tue, 19 Apr 2022 15:59:10 -0700 (PDT) Received: by mail-pl1-f179.google.com with SMTP id j8so85523pll.11 for ; Tue, 19 Apr 2022 15:59:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fOU1/Pepe52OePCJAW6Boa1hD1Yk4gdg7f3FgGlBhdo=; b=CUxHQMkerC/NpxhdTZHwTi+sgFq/YXFO22RTuVCDp7wQ15gmxFUqee+Z35QH+YQrh3 DmP7BgtGfQQW48VgaWaNEP8bY3GOdKurMbBCsIIoI6X/rRlroMXsoYVvlvF+wxmfdFlE jJ0gIr8mujemiB6gI4uGyAxjoxwzgwjGW/2iN4LlY+wfiBIParzd8i/1y+w3ceVviFbJ +KGRgbziEa7LFqD5WzDH40HSUTp3i4iYd7lUkHLt6U7E0WDdDpgwBskTB/wh9KPTqf7Q 8EOa3mFez3qdzjeyKCEH776hFEV5DCFqqcfgw/R36sxGwGqho+6ofowguRK+zss3eUGs 2auA== X-Gm-Message-State: AOAM5329dhntItvzC3fx9kBEwsSyHHd1FCjHVq4y8gEFH2aqNz2ud14a QgQjZcEEuWE8VhlaqADRP7Q= X-Google-Smtp-Source: ABdhPJwpSqXt2CVwaXLZkgctFYGyLCiX9a/xGoVml6zLWBouTMyPqUz6kw289eXbjCq+AL69gf+CJg== X-Received: by 2002:a17:90a:600b:b0:1cb:8ba5:d3bc with SMTP id y11-20020a17090a600b00b001cb8ba5d3bcmr1011563pji.42.1650409150292; Tue, 19 Apr 2022 15:59:10 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:59:09 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche Subject: [PATCH v3 26/28] scsi: ufs: Split the ufshcd.h header file Date: Tue, 19 Apr 2022 15:58:09 -0700 Message-Id: <20220419225811.4127248-27-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Split the ufshcd.h header file into a header file that defines the interface used by UFS drivers and another header file with declarations and data structures only used by the UFS core. Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs-debugfs.c | 1 + drivers/scsi/ufs/ufs-hwmon.c | 1 + drivers/scsi/ufs/ufs-sysfs.c | 2 +- drivers/scsi/ufs/ufs_bsg.c | 1 + drivers/scsi/ufs/ufshcd-crypto.h | 2 + drivers/scsi/ufs/ufshcd-priv.h | 279 +++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd.c | 2 +- drivers/scsi/ufs/ufshcd.h | 222 ------------------------ drivers/scsi/ufs/ufshpb.c | 2 +- 9 files changed, 287 insertions(+), 225 deletions(-) create mode 100644 drivers/scsi/ufs/ufshcd-priv.h diff --git a/drivers/scsi/ufs/ufs-debugfs.c b/drivers/scsi/ufs/ufs-debugfs.c index 4a0bbcf1757a..c10a8f09682b 100644 --- a/drivers/scsi/ufs/ufs-debugfs.c +++ b/drivers/scsi/ufs/ufs-debugfs.c @@ -5,6 +5,7 @@ #include "ufs-debugfs.h" #include "ufshcd.h" +#include "ufshcd-priv.h" static struct dentry *ufs_debugfs_root; diff --git a/drivers/scsi/ufs/ufs-hwmon.c b/drivers/scsi/ufs/ufs-hwmon.c index 74855491dc8f..c38d9d98a86d 100644 --- a/drivers/scsi/ufs/ufs-hwmon.c +++ b/drivers/scsi/ufs/ufs-hwmon.c @@ -8,6 +8,7 @@ #include #include "ufshcd.h" +#include "ufshcd-priv.h" struct ufs_hwmon_data { struct ufs_hba *hba; diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 95a4e64ce401..8a3c6442f291 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -8,7 +8,7 @@ #include "ufs.h" #include "ufs-sysfs.h" -#include "ufshcd.h" +#include "ufshcd-priv.h" static const char *ufshcd_uic_link_state_to_string( enum uic_link_state state) diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c index fbcdfb713542..9e9b93867cab 100644 --- a/drivers/scsi/ufs/ufs_bsg.c +++ b/drivers/scsi/ufs/ufs_bsg.c @@ -10,6 +10,7 @@ #include #include "ufs_bsg.h" #include "ufshcd.h" +#include "ufshcd-priv.h" static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len, struct utp_upiu_query *qr) diff --git a/drivers/scsi/ufs/ufshcd-crypto.h b/drivers/scsi/ufs/ufshcd-crypto.h index 57dd51256b57..9f98f18f9646 100644 --- a/drivers/scsi/ufs/ufshcd-crypto.h +++ b/drivers/scsi/ufs/ufshcd-crypto.h @@ -8,6 +8,8 @@ #include #include "ufshcd.h" +#include "ufshcd-priv.h" +#include "ufshci.h" #ifdef CONFIG_SCSI_UFS_CRYPTO diff --git a/drivers/scsi/ufs/ufshcd-priv.h b/drivers/scsi/ufs/ufshcd-priv.h new file mode 100644 index 000000000000..3fa8ab94e4e1 --- /dev/null +++ b/drivers/scsi/ufs/ufshcd-priv.h @@ -0,0 +1,279 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _UFSHCD_PRIV_H_ +#define _UFSHCD_PRIV_H_ + +#include +#include "ufshcd.h" + +static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) +{ + return !hba->shutting_down; +} + +void ufshcd_schedule_eh_work(struct ufs_hba *hba); + +static inline bool ufshcd_keep_autobkops_enabled_except_suspend( + struct ufs_hba *hba) +{ + return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; +} + +static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba) +{ + if (hba->dev_info.wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) + return hba->dev_info.wb_dedicated_lu; + return 0; +} + +#ifdef CONFIG_SCSI_UFS_HWMON +void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask); +void ufs_hwmon_remove(struct ufs_hba *hba); +void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask); +#else +static inline void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask) {} +static inline void ufs_hwmon_remove(struct ufs_hba *hba) {} +static inline void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask) {} +#endif + +int ufshcd_read_desc_param(struct ufs_hba *hba, + enum desc_idn desc_id, + int desc_index, + u8 param_offset, + u8 *param_read_buf, + u8 param_size); +int ufshcd_query_attr_retry(struct ufs_hba *hba, enum query_opcode opcode, + enum attr_idn idn, u8 index, u8 selector, + u32 *attr_val); +int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode, + enum attr_idn idn, u8 index, u8 selector, u32 *attr_val); +int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, + enum flag_idn idn, u8 index, bool *flag_res); +void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit); + +#define SD_ASCII_STD true +#define SD_RAW false +int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, + u8 **buf, bool ascii); + +int ufshcd_hold(struct ufs_hba *hba, bool async); +void ufshcd_release(struct ufs_hba *hba); + +void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, + int *desc_length); + +int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd); + +int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, + struct utp_upiu_req *req_upiu, + struct utp_upiu_req *rsp_upiu, + int msgcode, + u8 *desc_buff, int *buff_len, + enum query_opcode desc_op); + +int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable); + +/* Wrapper functions for safely calling variant operations */ +static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) +{ + if (hba->vops) + return hba->vops->name; + return ""; +} + +static inline void ufshcd_vops_exit(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->exit) + return hba->vops->exit(hba); +} + +static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->get_ufs_hci_version) + return hba->vops->get_ufs_hci_version(hba); + + return ufshcd_readl(hba, REG_UFS_VERSION); +} + +static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, + bool up, enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->clk_scale_notify) + return hba->vops->clk_scale_notify(hba, up, status); + return 0; +} + +static inline void ufshcd_vops_event_notify(struct ufs_hba *hba, + enum ufs_event_type evt, + void *data) +{ + if (hba->vops && hba->vops->event_notify) + hba->vops->event_notify(hba, evt, data); +} + +static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on, + enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->setup_clocks) + return hba->vops->setup_clocks(hba, on, status); + return 0; +} + +static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba, + bool status) +{ + if (hba->vops && hba->vops->hce_enable_notify) + return hba->vops->hce_enable_notify(hba, status); + + return 0; +} +static inline int ufshcd_vops_link_startup_notify(struct ufs_hba *hba, + bool status) +{ + if (hba->vops && hba->vops->link_startup_notify) + return hba->vops->link_startup_notify(hba, status); + + return 0; +} + +static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, + enum ufs_notify_change_status status, + struct ufs_pa_layer_attr *dev_max_params, + struct ufs_pa_layer_attr *dev_req_params) +{ + if (hba->vops && hba->vops->pwr_change_notify) + return hba->vops->pwr_change_notify(hba, status, + dev_max_params, dev_req_params); + + return -ENOTSUPP; +} + +static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba, + int tag, u8 tm_function) +{ + if (hba->vops && hba->vops->setup_task_mgmt) + return hba->vops->setup_task_mgmt(hba, tag, tm_function); +} + +static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba, + enum uic_cmd_dme cmd, + enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->hibern8_notify) + return hba->vops->hibern8_notify(hba, cmd, status); +} + +static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->apply_dev_quirks) + return hba->vops->apply_dev_quirks(hba); + return 0; +} + +static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->fixup_dev_quirks) + hba->vops->fixup_dev_quirks(hba); +} + +static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op, + enum ufs_notify_change_status status) +{ + if (hba->vops && hba->vops->suspend) + return hba->vops->suspend(hba, op, status); + + return 0; +} + +static inline int ufshcd_vops_resume(struct ufs_hba *hba, enum ufs_pm_op op) +{ + if (hba->vops && hba->vops->resume) + return hba->vops->resume(hba, op); + + return 0; +} + +static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->dbg_register_dump) + hba->vops->dbg_register_dump(hba); +} + +static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) +{ + if (hba->vops && hba->vops->device_reset) + return hba->vops->device_reset(hba); + + return -EOPNOTSUPP; +} + +static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, + struct devfreq_dev_profile *p, + struct devfreq_simple_ondemand_data *data) +{ + if (hba->vops && hba->vops->config_scaling_param) + hba->vops->config_scaling_param(hba, p, data); +} + +extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; + +/** + * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN + * @scsi_lun: scsi LUN id + * + * Returns UPIU LUN id + */ +static inline u8 ufshcd_scsi_to_upiu_lun(unsigned int scsi_lun) +{ + if (scsi_is_wlun(scsi_lun)) + return (scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID) + | UFS_UPIU_WLUN_ID; + else + return scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID; +} + +int __ufshcd_write_ee_control(struct ufs_hba *hba, u32 ee_ctrl_mask); +int ufshcd_write_ee_control(struct ufs_hba *hba); +int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask, u16 *other_mask, + u16 set, u16 clr); + +static inline int ufshcd_update_ee_drv_mask(struct ufs_hba *hba, + u16 set, u16 clr) +{ + return ufshcd_update_ee_control(hba, &hba->ee_drv_mask, + &hba->ee_usr_mask, set, clr); +} + +static inline int ufshcd_update_ee_usr_mask(struct ufs_hba *hba, + u16 set, u16 clr) +{ + return ufshcd_update_ee_control(hba, &hba->ee_usr_mask, + &hba->ee_drv_mask, set, clr); +} + +static inline int ufshcd_rpm_get_sync(struct ufs_hba *hba) +{ + return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba) +{ + return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline void ufshcd_rpm_get_noresume(struct ufs_hba *hba) +{ + pm_runtime_get_noresume(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline int ufshcd_rpm_resume(struct ufs_hba *hba) +{ + return pm_runtime_resume(&hba->ufs_device_wlun->sdev_gendev); +} + +static inline int ufshcd_rpm_put(struct ufs_hba *hba) +{ + return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); +} + +#endif /* _UFSHCD_PRIV_H_ */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5308f43bda6e..da8beed2767c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -26,7 +26,7 @@ #include #include #include -#include "ufshcd.h" +#include "ufshcd-priv.h" #include "ufs_quirks.h" #include "unipro.h" #include "ufs-sysfs.h" diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index ab0c643296c0..16f69ab1b309 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1007,11 +1007,6 @@ static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba) return hba->caps & UFSHCD_CAP_WB_EN; } -static inline bool ufshcd_is_user_access_allowed(struct ufs_hba *hba) -{ - return !hba->shutting_down; -} - #define ufshcd_writel(hba, val, reg) \ writel((val), (hba)->mmio_base + (reg)) #define ufshcd_readl(hba, reg) \ @@ -1075,28 +1070,6 @@ static inline void *ufshcd_get_variant(struct ufs_hba *hba) BUG_ON(!hba); return hba->priv; } -static inline bool ufshcd_keep_autobkops_enabled_except_suspend( - struct ufs_hba *hba) -{ - return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; -} - -static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba) -{ - if (hba->dev_info.wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) - return hba->dev_info.wb_dedicated_lu; - return 0; -} - -#ifdef CONFIG_SCSI_UFS_HWMON -void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask); -void ufs_hwmon_remove(struct ufs_hba *hba); -void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask); -#else -static inline void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask) {} -static inline void ufs_hwmon_remove(struct ufs_hba *hba) {} -static inline void ufs_hwmon_notify_event(struct ufs_hba *hba, u8 ee_mask) {} -#endif #ifdef CONFIG_PM extern int ufshcd_runtime_suspend(struct device *dev); @@ -1230,13 +1203,6 @@ int __ufshcd_suspend_prepare(struct device *dev, bool rpm_ok_for_spm); void ufshcd_resume_complete(struct device *dev); /* Wrapper functions for safely calling variant operations */ -static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) -{ - if (hba->vops) - return hba->vops->name; - return ""; -} - static inline int ufshcd_vops_init(struct ufs_hba *hba) { if (hba->vops && hba->vops->init) @@ -1245,61 +1211,6 @@ static inline int ufshcd_vops_init(struct ufs_hba *hba) return 0; } -static inline void ufshcd_vops_exit(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->exit) - return hba->vops->exit(hba); -} - -static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->get_ufs_hci_version) - return hba->vops->get_ufs_hci_version(hba); - - return ufshcd_readl(hba, REG_UFS_VERSION); -} - -static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, - bool up, enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->clk_scale_notify) - return hba->vops->clk_scale_notify(hba, up, status); - return 0; -} - -static inline void ufshcd_vops_event_notify(struct ufs_hba *hba, - enum ufs_event_type evt, - void *data) -{ - if (hba->vops && hba->vops->event_notify) - hba->vops->event_notify(hba, evt, data); -} - -static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on, - enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->setup_clocks) - return hba->vops->setup_clocks(hba, on, status); - return 0; -} - -static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba, - bool status) -{ - if (hba->vops && hba->vops->hce_enable_notify) - return hba->vops->hce_enable_notify(hba, status); - - return 0; -} -static inline int ufshcd_vops_link_startup_notify(struct ufs_hba *hba, - bool status) -{ - if (hba->vops && hba->vops->link_startup_notify) - return hba->vops->link_startup_notify(hba, status); - - return 0; -} - static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba) { if (hba->vops && hba->vops->phy_initialization) @@ -1308,102 +1219,8 @@ static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba) return 0; } -static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, - enum ufs_notify_change_status status, - struct ufs_pa_layer_attr *dev_max_params, - struct ufs_pa_layer_attr *dev_req_params) -{ - if (hba->vops && hba->vops->pwr_change_notify) - return hba->vops->pwr_change_notify(hba, status, - dev_max_params, dev_req_params); - - return -ENOTSUPP; -} - -static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba, - int tag, u8 tm_function) -{ - if (hba->vops && hba->vops->setup_task_mgmt) - return hba->vops->setup_task_mgmt(hba, tag, tm_function); -} - -static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba, - enum uic_cmd_dme cmd, - enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->hibern8_notify) - return hba->vops->hibern8_notify(hba, cmd, status); -} - -static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->apply_dev_quirks) - return hba->vops->apply_dev_quirks(hba); - return 0; -} - -static inline void ufshcd_vops_fixup_dev_quirks(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->fixup_dev_quirks) - hba->vops->fixup_dev_quirks(hba); -} - -static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op, - enum ufs_notify_change_status status) -{ - if (hba->vops && hba->vops->suspend) - return hba->vops->suspend(hba, op, status); - - return 0; -} - -static inline int ufshcd_vops_resume(struct ufs_hba *hba, enum ufs_pm_op op) -{ - if (hba->vops && hba->vops->resume) - return hba->vops->resume(hba, op); - - return 0; -} - -static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->dbg_register_dump) - hba->vops->dbg_register_dump(hba); -} - -static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) -{ - if (hba->vops && hba->vops->device_reset) - return hba->vops->device_reset(hba); - - return -EOPNOTSUPP; -} - -static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, - struct devfreq_dev_profile *p, - struct devfreq_simple_ondemand_data *data) -{ - if (hba->vops && hba->vops->config_scaling_param) - hba->vops->config_scaling_param(hba, p, data); -} - extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; -/** - * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN - * @scsi_lun: scsi LUN id - * - * Returns UPIU LUN id - */ -static inline u8 ufshcd_scsi_to_upiu_lun(unsigned int scsi_lun) -{ - if (scsi_is_wlun(scsi_lun)) - return (scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID) - | UFS_UPIU_WLUN_ID; - else - return scsi_lun & UFS_UPIU_MAX_UNIT_NUM_ID; -} - int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, const char *prefix); @@ -1412,43 +1229,4 @@ int ufshcd_write_ee_control(struct ufs_hba *hba); int ufshcd_update_ee_control(struct ufs_hba *hba, u16 *mask, u16 *other_mask, u16 set, u16 clr); -static inline int ufshcd_update_ee_drv_mask(struct ufs_hba *hba, - u16 set, u16 clr) -{ - return ufshcd_update_ee_control(hba, &hba->ee_drv_mask, - &hba->ee_usr_mask, set, clr); -} - -static inline int ufshcd_update_ee_usr_mask(struct ufs_hba *hba, - u16 set, u16 clr) -{ - return ufshcd_update_ee_control(hba, &hba->ee_usr_mask, - &hba->ee_drv_mask, set, clr); -} - -static inline int ufshcd_rpm_get_sync(struct ufs_hba *hba) -{ - return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba) -{ - return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline void ufshcd_rpm_get_noresume(struct ufs_hba *hba) -{ - pm_runtime_get_noresume(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline int ufshcd_rpm_resume(struct ufs_hba *hba) -{ - return pm_runtime_resume(&hba->ufs_device_wlun->sdev_gendev); -} - -static inline int ufshcd_rpm_put(struct ufs_hba *hba) -{ - return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); -} - #endif /* End of Header */ diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 5a974642779f..5fae0861b488 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -15,7 +15,7 @@ #include #include -#include "ufshcd.h" +#include "ufshcd-priv.h" #include "ufshpb.h" #include "../sd.h" From patchwork Tue Apr 19 22:58:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C08C433EF for ; Tue, 19 Apr 2022 22:59:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358412AbiDSXCJ (ORCPT ); Tue, 19 Apr 2022 19:02:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358402AbiDSXB6 (ORCPT ); Tue, 19 Apr 2022 19:01:58 -0400 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB6738BF2 for ; Tue, 19 Apr 2022 15:59:12 -0700 (PDT) Received: by mail-pj1-f44.google.com with SMTP id j8-20020a17090a060800b001cd4fb60dccso217292pjj.2 for ; Tue, 19 Apr 2022 15:59:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=loZN4P8PpEJMzWmmaiVmJVuchCHtJ8qGAORX0RHp8rk=; b=4tIPld7t1qXOg0y24yaiXsQj+3EbZ5VkRgPTaCSp77gkt2UxYZ9rDIwSzze1xC8msI WxigR7Bq1zEdsG9xmayMg66/sgrKGF2DBAWsta8gG5J49LzM3Wcs46TPsjIpC0lbmBn3 6YgU37THAOd902h6IKQaUj2PRskF1RCecRKulcAdKIqIq7RO3FQvOXd8/QQYBCrjJmdN 5z/gOD1BGOv7LbxLfyOSNG8eKKYeeLr0PZD/OrP9CilswF4nIzvEP3wC2U8fmTWPMVeQ bLDZdG1/JgWtsfalZknGDZU9WP0/wyQUZZf4UtH29OdrNYgpmiT3aTVQswjsI23iH5qb JrKw== X-Gm-Message-State: AOAM530OPBGJk5un8mxLCyXf6Ep80tx4egkNgezRcG0rAkkJOnApQX5e 12vyVJFS7k/TKmoH0DL9j7Y= X-Google-Smtp-Source: ABdhPJwQjdl1VH0HPRKVMbVwOHvEwfkK3mKKQi+SZhKr78C2j36HRy7pZJQ6SYeyVCfFLMJxfHNo9Q== X-Received: by 2002:a17:90a:1c08:b0:1cd:474a:a4f8 with SMTP id s8-20020a17090a1c0800b001cd474aa4f8mr994665pjs.82.1650409152206; Tue, 19 Apr 2022 15:59:12 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.59.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:59:11 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman Subject: [PATCH v3 27/28] scsi: ufs: Move the struct ufs_ref_clk definition Date: Tue, 19 Apr 2022 15:58:10 -0700 Message-Id: <20220419225811.4127248-28-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the definition of this data structure since it is only used in a single source file. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs.h | 5 ----- drivers/scsi/ufs/ufshcd.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 225b5b4a2a7e..f52173b8ad96 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -415,11 +415,6 @@ enum ufs_ref_clk_freq { REF_CLK_FREQ_INVAL = -1, }; -struct ufs_ref_clk { - unsigned long freq_hz; - enum ufs_ref_clk_freq val; -}; - /* Query response result code */ enum { QUERY_RESULT_SUCCESS = 0x00, diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index da8beed2767c..198bef3eb4b2 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7959,6 +7959,11 @@ static int ufshcd_device_geo_params_init(struct ufs_hba *hba) return err; } +struct ufs_ref_clk { + unsigned long freq_hz; + enum ufs_ref_clk_freq val; +}; + static struct ufs_ref_clk ufs_ref_clk_freqs[] = { {19200000, REF_CLK_FREQ_19_2_MHZ}, {26000000, REF_CLK_FREQ_26_MHZ}, From patchwork Tue Apr 19 22:58:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 564253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5F7FC4332F for ; Tue, 19 Apr 2022 22:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358410AbiDSXCG (ORCPT ); Tue, 19 Apr 2022 19:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358403AbiDSXB6 (ORCPT ); Tue, 19 Apr 2022 19:01:58 -0400 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7374C38BF8 for ; Tue, 19 Apr 2022 15:59:14 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id n8so121530plh.1 for ; Tue, 19 Apr 2022 15:59:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wL8r/dkKyV4Y/mikFzmlbqWC8R98dUB/Oz42MtzPdL4=; b=z1ROCS9qru8myhOarMAQnAjIExZweM19TDh3UHHuPm+zuqLBFrWfOD9hYndPV5jRTD drMR4DhwJFDwq7301yMIOI81jAgQ8nUlLZ8UKnK2pN8UCVDp11L3BNeWoX4Sx6PLI906 Iwqt7ie9SL/tQ3JVlrxS0LRxr5ucLlsS78Ln+aW1RZJkZYHku02f+x+QaTT+/5kNDYoL JC1ekAjONYOEB1aaAl7QNqN0jzdrcN+K0nK0PC3w1xEYq6JgjsJ/TgSaRkzmk4H4/FU/ 1KY09dRYUrvxfNa9uQlUmU6CmecFRc7Knjv7GAXniyYsmu7ogu3+lpEBAgBjb/rzdwbG Houg== X-Gm-Message-State: AOAM532oG5OtRE23NGGS8OPdVDUsqnZj3L8NN0dRRkRrg3Hgjvc0Jv2+ LlXyK9IeN1r6kUhh3nkJKE4= X-Google-Smtp-Source: ABdhPJx8MdZhyjQnAYdp86QJIdRetujvfaahK1Tjh9sfLEz6nzlkJom/QBUcPH+R2zitLzCFWIopfw== X-Received: by 2002:a17:90a:c70f:b0:1bf:3e2d:6cfa with SMTP id o15-20020a17090ac70f00b001bf3e2d6cfamr1015158pjt.70.1650409153943; Tue, 19 Apr 2022 15:59:13 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:59ec:2e90:f751:1806]) by smtp.gmail.com with ESMTPSA id c15-20020a63350f000000b003992202f95fsm17622557pga.38.2022.04.19.15.59.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 15:59:13 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche Subject: [PATCH v3 28/28] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition Date: Tue, 19 Apr 2022 15:58:11 -0700 Message-Id: <20220419225811.4127248-29-bvanassche@acm.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220419225811.4127248-1-bvanassche@acm.org> References: <20220419225811.4127248-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the definition of this function from a public into a private header file since it is only used inside the UFS core. Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufs.h | 19 ------------------- drivers/scsi/ufs/ufshcd-priv.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index f52173b8ad96..1bba3fead2ce 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -620,23 +620,4 @@ enum ufs_trace_tsf_t { UFS_TSF_CDB, UFS_TSF_OSF, UFS_TSF_TM_INPUT, UFS_TSF_TM_OUTPUT }; -/** - * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor - * @dev_info: pointer of instance of struct ufs_dev_info - * @lun: LU number to check - * @return: true if the lun has a matching unit descriptor, false otherwise - */ -static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, - u8 lun, u8 param_offset) -{ - if (!dev_info || !dev_info->max_lu_supported) { - pr_err("Max General LU supported by UFS isn't initialized\n"); - return false; - } - /* WB is available only for the logical unit from 0 to 7 */ - if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS) - return lun < UFS_UPIU_MAX_WB_LUN_ID; - return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); -} - #endif /* End of Header */ diff --git a/drivers/scsi/ufs/ufshcd-priv.h b/drivers/scsi/ufs/ufshcd-priv.h index 3fa8ab94e4e1..38bc77d3dbbd 100644 --- a/drivers/scsi/ufs/ufshcd-priv.h +++ b/drivers/scsi/ufs/ufshcd-priv.h @@ -276,4 +276,23 @@ static inline int ufshcd_rpm_put(struct ufs_hba *hba) return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); } +/** + * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor + * @dev_info: pointer of instance of struct ufs_dev_info + * @lun: LU number to check + * @return: true if the lun has a matching unit descriptor, false otherwise + */ +static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, + u8 lun, u8 param_offset) +{ + if (!dev_info || !dev_info->max_lu_supported) { + pr_err("Max General LU supported by UFS isn't initialized\n"); + return false; + } + /* WB is available only for the logical unit from 0 to 7 */ + if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS) + return lun < UFS_UPIU_MAX_WB_LUN_ID; + return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); +} + #endif /* _UFSHCD_PRIV_H_ */