Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp44155imm; Tue, 22 May 2018 13:41:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr7uaX8tWf4dsZcCYijrNCaIXUlR5MM8XuW45P7ZlStKfxWvupTvq9ouD6IK8ZMiBLGjtvz X-Received: by 2002:a63:6e05:: with SMTP id j5-v6mr25502pgc.150.1527021710663; Tue, 22 May 2018 13:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527021710; cv=none; d=google.com; s=arc-20160816; b=E0OUmB1tm6Sokk4p4H4okzlpdOB3vUDBMC+CRD+jHDfHa7zrE1unQdSvGPcF0SS9ZF dpbKiWbxFb84EC2/sVmoyxQBzObYwyRPka2onZE9uBk9Gi3Hr1B4zEr5TJzX/R4TZbz8 8g8SWnJyGOH4vKGTZuEtTTgCeb7DbeL3FyOauXe1PtU9tJP9/YY3gXb2Wha7J2sovo4m Cp5Ai0CC3f1wKwQCLTY5zDmMG65oLG9rd/oO4VV1L/9Y0kh4bjQIBXUFSFnaUmzCQsSy 3iOifHu1iATHKaoR5wYnFpGZLMSTmmyofx4eWDIc7vo5GbBnQumrSRBrQVi/yhQG6FS8 vb+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=RKioQpkXAUWhmPYB+tgdaXsW6sa+TvKOsEYRX+jVlmc=; b=GmJt94iNSGmPUSN/AN+p0UexxwbDCa80ztiPVcKExk/nKkyd8bZRaSdlmmLEhDG/kd fyfqgpz3Ego7jAv5PbiM6DHlGLT+zFgSGtcGC0jDloX47Dgg0HWPRY+fKSqqxO/ho3nV RUPj7nOeBdDs1jSlZMfKBiaq5PknVOz29xI7d5Pg0n2whef6vMpPbsRmsePuKTqgpnMH UHE2oYJ3i+u/ZscedzGjdSATT35aKM8Cren51ph6hMlBkOQiP4lP2JTKBYWB/JlHCji5 JjpFQvotM5bbM/eqiKShhXxg3Z+nL/4lcbQ58ZRGMrFZrlpSzPBYSMTGbh8tKu8NdcVx yfDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=eOvpOTgw; dkim=pass header.i=@codeaurora.org header.s=default header.b=nkPpReOJ; 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 j20-v6si17002709pll.223.2018.05.22.13.41.35; Tue, 22 May 2018 13:41:50 -0700 (PDT) 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=eOvpOTgw; dkim=pass header.i=@codeaurora.org header.s=default header.b=nkPpReOJ; 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 S1752890AbeEVUkw (ORCPT + 99 others); Tue, 22 May 2018 16:40:52 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35598 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbeEVUkv (ORCPT ); Tue, 22 May 2018 16:40:51 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8EA1860392; Tue, 22 May 2018 20:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527021650; bh=292LSF5iuxceT3U6ubvBpGIJSQy72XhcSHblbOkJEk4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eOvpOTgwaV5oQJOKM9TScAzpipN/VkQ48dWwtjFL77WH5K+PNCyEclo7WUjUDopSS C0XFqe4F5NG9rKGvrYRxGauxmecyVeQ2OrFJ+UbAUdlkK6+k6nM3Dg1QRHeE4QKnOo n5PEGB4nQkX+bKYIC/VjWUKNsWH1EGWOVb3uOE9Y= 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 mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id BE29660392; Tue, 22 May 2018 20:40:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527021649; bh=292LSF5iuxceT3U6ubvBpGIJSQy72XhcSHblbOkJEk4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nkPpReOJMQenIE8S1JwuAc3w82GHYO9h/aVfQgKXN8nzU3G5x5k+XEswRIi436RSK eVAAFIBngZ8fnH4fba0vC0VWG0KXLDJ9zE7/BrU9QRRf/XB69u8okwDP+V93No1afZ BXNNmmjcEm0gtLN6EdNGqfJR42/ZDaqOxC8HzXqU= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 22 May 2018 13:40:49 -0700 From: rishabhb@codeaurora.org To: Andy Shevchenko Cc: linux-arm Mailing List , linux-arm-msm@vger.kernel.org, devicetree , Linux Kernel Mailing List , linux-arm@lists.infradead.org, tsoni@codeaurora.org, ckadabi@codeaurora.org, Evan Green , Rob Herring Subject: Re: [PATCH v7 2/2] drivers: soc: Add LLCC driver In-Reply-To: References: <1526492623-20527-1-git-send-email-rishabhb@codeaurora.org> <1526492623-20527-3-git-send-email-rishabhb@codeaurora.org> Message-ID: <19968f96da0c548dd7d96e7520ce899e@codeaurora.org> X-Sender: rishabhb@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-22 12:38, Andy Shevchenko wrote: > On Tue, May 22, 2018 at 9:33 PM, wrote: >> On 2018-05-18 14:01, Andy Shevchenko wrote: >>> On Wed, May 16, 2018 at 8:43 PM, Rishabh Bhatnagar >>> wrote: > >>>> +#define ACTIVATE 0x1 >>>> +#define DEACTIVATE 0x2 >>>> +#define ACT_CTRL_OPCODE_ACTIVATE 0x1 >>>> +#define ACT_CTRL_OPCODE_DEACTIVATE 0x2 >>>> +#define ACT_CTRL_ACT_TRIG 0x1 >>> >>> >>> Are these bits? Perhaps BIT() ? >>> >> isn't it just better to use fixed size as u suggest in the next >> comment? > > If the are bits, use BIT() macro. > >>>> +struct llcc_slice_desc *llcc_slice_getd(u32 uid) >>>> +{ >>>> + const struct llcc_slice_config *cfg; >>>> + struct llcc_slice_desc *desc; >>>> + u32 sz, count = 0; >>>> + >>>> + cfg = drv_data->cfg; >>>> + sz = drv_data->cfg_size; >>>> + >>> >>> >>>> + while (cfg && count < sz) { >>>> + if (cfg->usecase_id == uid) >>>> + break; >>>> + cfg++; >>>> + count++; >>>> + } >>>> + if (cfg == NULL || count == sz) >>>> + return ERR_PTR(-ENODEV); >>> >>> >>> if (!cfg) >>> return ERR_PTR(-ENODEV); >>> >>> while (cfg->... != uid) { >>> cfg++; >>> count++; >>> } >>> >>> if (count == sz) >>> return ... >>> >>> Though I would rather put it to for () loop. >>> >> In each while loop iteration the cfg pointer needs to be checked for >> NULL. What if the usecase id never matches the uid passed by client >> and we keep iterating. At some point it will crash. > > do { > if (!cfg || count == sz) > return ...(-ENODEV); > ... > } while (...); > > Though, as I said for-loop will look slightly better I think. Is this fine? for (count = 0; count < sz; count++) { if (!cfg) return ERR_PTR(-ENODEV); if (cfg->usecase_id == uid) break; cfg++; } if (count == sz) return ERR_PTR(-ENODEV); > >>>> + ret = llcc_update_act_ctrl(desc->slice_id, act_ctrl_val, >>>> + DEACTIVATE); >>> >>> >>> Perhaps one line (~83 characters here is OK) ? >> >> The checkpatch script complains about such lines. > > So what if it just 3 characters out? > Other reviewers sometimes are not okay if the checkpatch complains. Because I have gotten many reviews previously concerning about line length. Not sure how to proceed here. >>>> + ret = llcc_update_act_ctrl(desc->slice_id, act_ctrl_val, >>>> + ACTIVATE); > >>> Ditto. > >>>> + attr1_cfg = bcast_off + >>>> + >>>> LLCC_TRP_ATTR1_CFGn(llcc_table[i].slice_id); >>>> + attr0_cfg = bcast_off + >>>> + >>>> LLCC_TRP_ATTR0_CFGn(llcc_table[i].slice_id); > >>> Ditto. > >>>> + attr1_val |= llcc_table[i].probe_target_ways << >>>> + ATTR1_PROBE_TARGET_WAYS_SHIFT; >>>> + attr1_val |= llcc_table[i].fixed_size << >>>> + ATTR1_FIXED_SIZE_SHIFT; >>>> + attr1_val |= llcc_table[i].priority << >>>> ATTR1_PRIORITY_SHIFT; > >>> foo |= >>> bar << SHIFT; >>> >>> would look slightly better. > > Did you consider this option ? Yes, forgot to mention.