Received: by 10.223.185.111 with SMTP id b44csp457259wrg; Fri, 9 Mar 2018 07:46:34 -0800 (PST) X-Google-Smtp-Source: AG47ELuRVFeuOwHs37ti0+iHQAg8lzztSVx94eLz4KVwNKzzQVtRgdivoeJBqgST+W+Hc26/iL+1 X-Received: by 2002:a17:902:599b:: with SMTP id p27-v6mr27143718pli.289.1520610394891; Fri, 09 Mar 2018 07:46:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520610394; cv=none; d=google.com; s=arc-20160816; b=krxE2Z7Ho2IQLs/jb/rj91r+LYBERZbJm6XAGN/Gzusw2ibNNZBRHa5Ixza7+BWwmt YBd7HGZWFsCeykcv6p912sYnEnWtOj+1t8uXYHXSoRh70GLH1Ji1j5/awDw1VvUKHKxO Pxv0gNiR6iP4IYF3WLJSs3escSeFiNgbBadCgy966VwvFdWM/LDNNqrPtL95bHvuKDB+ R2zwOnct5uo0u9eC3blBTFJ8I1SJE6utPQGrm00NGTkAwPPnABcTilsdv/BpOeuY/g5W JYq9SLr+2Mt09Oku6AtgQI3is+8VWr9n0J/nxPnQrNPIdV7eCebdxLFheoSL+CVhFEgO A4eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=PWX4YOdQD4SvnosSb9HD6zA5FIbkWtshm2hJ/ePMMwc=; b=SZLzcIsNIaLgBoX1BOkJV5rzpxRfvfCDJ4h4g43yS0nAK0XDcmnYfJ2LM8mvzz0ZdP /3V3gpBq6g8pPQsm9gqlbihcrDHUgoBXf0SkRmdRkRgABM1P7oD+30P4DMC1daDNgPFG jlfL0tDPnYz1cErFiVP8vUAYyhufHso3EOA0cOqicfjDhxFz1LAkou8CLEcLI95RUoi8 Op10rWAPUosMoXz9AXKqRUyibj1mYyGBGZSJUiTeyb1ciF0XEfP/z/c8AIUMoOfFyCXe ffTUEDcNbSCT10C21vzrkJ7h3MmCt0W3nE8hESLjmCIw74Qj8TNz3VrztI3Fh+2oZvKT CsIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZphN09Ci; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZphN09Ci; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1-v6si1043902plb.281.2018.03.09.07.46.19; Fri, 09 Mar 2018 07:46:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZphN09Ci; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZphN09Ci; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932113AbeCIPp2 (ORCPT + 99 others); Fri, 9 Mar 2018 10:45:28 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39210 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751096AbeCIPp0 (ORCPT ); Fri, 9 Mar 2018 10:45:26 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E3F486053B; Fri, 9 Mar 2018 15:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520610325; bh=4olYCP+G2ZptZ8zJRony7jxjjZpgLfkuHAclnqtPpb0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZphN09CiYCQPuOPNodMyycsyeZ9xADSfVKCOcqxjdGmVpHTP+e/Sy4d5k2d624oWj kiaUM6FClzLOKBXU3+mho0FqWEru6vYjdArsIAFE8SySI8bg3ZnBIQNU0n73eG4UCw ej6bGCl41uC1dpGIS6Bjl+8O5rWmrmsisDM6Tqpw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6FCF36050D; Fri, 9 Mar 2018 15:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520610325; bh=4olYCP+G2ZptZ8zJRony7jxjjZpgLfkuHAclnqtPpb0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZphN09CiYCQPuOPNodMyycsyeZ9xADSfVKCOcqxjdGmVpHTP+e/Sy4d5k2d624oWj kiaUM6FClzLOKBXU3+mho0FqWEru6vYjdArsIAFE8SySI8bg3ZnBIQNU0n73eG4UCw ej6bGCl41uC1dpGIS6Bjl+8O5rWmrmsisDM6Tqpw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6FCF36050D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Fri, 9 Mar 2018 08:45:24 -0700 From: Lina Iyer To: Stephen Boyd Cc: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 05/10] drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS Message-ID: <20180309154524.GD3577@codeaurora.org> References: <20180302164317.10554-1-ilina@codeaurora.org> <20180302164317.10554-6-ilina@codeaurora.org> <152053809443.219802.15873554351627646762@swboyd.mtv.corp.google.com> <20180308235830.GC3577@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180308235830.GC3577@codeaurora.org> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 08 2018 at 16:58 -0700, Lina Iyer wrote: >On Thu, Mar 08 2018 at 12:41 -0700, Stephen Boyd wrote: >>Quoting Lina Iyer (2018-03-02 08:43:12) >>>+static int find_slots(struct tcs_group *tcs, struct tcs_request *msg, >>>+ int *m, int *n) >>>+{ >>>+ int slot, offset; >>>+ int i = 0; >>>+ >>>+ /* Find if we already have the msg in our TCS */ >>>+ slot = find_match(tcs, msg->payload, msg->num_payload); >>>+ if (slot >= 0) >>>+ goto copy_data; >> >>Shouldn't this goto skip setting the bits in tcs->slots? >> >No, we overwrite what we found with this new data. >>>+ >>>+ /* Do over, until we can fit the full payload in a TCS */ >>>+ do { >>>+ slot = bitmap_find_next_zero_area(tcs->slots, MAX_TCS_SLOTS, >>>+ i, msg->num_payload, 0); >>>+ if (slot == MAX_TCS_SLOTS) >>>+ break; >>>+ i += tcs->ncpt; >>>+ } while (slot + msg->num_payload - 1 >= i); >>>+ >>>+ if (slot == MAX_TCS_SLOTS) >>>+ return -ENOMEM; >> >>Would be nice to remove this duplicate condition somehow. Maybe a goto? >> >I would return instead of the break earlier instead of this here. >>>+ >>>+copy_data: >>>+ bitmap_set(tcs->slots, slot, msg->num_payload); >>>+ /* Copy the addresses of the resources over to the slots */ >>>+ if (tcs->cmd_addr) { >> >>find_match() above didn't check for tcs->cmd_addr. Does this ever happen >>to fail? >> >Not allocated for active TCSes. I should be checking for it there as >well. Not sure how I didnt see a failure. > Ah, this function is never called for active tcs which would have the tcs->cmd_addr to be NULL. I dont need this check. -- Lina