Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1986753imm; Tue, 22 May 2018 12:41:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo9iZ49nQ0bNuoKi+Mb67lSwB0qk2cmFMv+Y5kyBFlB2OeN1/EAaXu7TlnBPY2SSYv7VF/s X-Received: by 2002:a17:902:5a0d:: with SMTP id q13-v6mr25998862pli.199.1527018093721; Tue, 22 May 2018 12:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527018093; cv=none; d=google.com; s=arc-20160816; b=NuXwDjHToMo6tKKhyZ3OqHyAiUWXEz0fwgproxritOtDYngqdGlcfhBrQDQLvOTTPM JOnTY4WbtXg7OX6qMFdgIKvMmYVXtlAHQGrFnPO3CypL9WWQCaDxBaIRVIZmTdQgE+6L Loqg5zsT4waaBLfUMbB/nQ+3X9V2/bEfl/tF/2/j0mmui3sKOxh3hHWpD/FMbzZS9Er4 zYcGn0XuJPt15eIUeH44LrdPPsSnSWMyOepiDNRXv9+GBXFBt55IB5CvXcUKC+eJxO5H SIystJphH7Rt/xuLeskzJbFD36osaHXylFp01OFIGAchgC0yNWry3Xe82ZAzZ37M5lRN gy0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=blvKPApKGs1G7kPVc4JngGg13iYfojp2PltTPkTBn3A=; b=sZe/V4eL3lc45+uGsHiVH62AOnhCwDzpg5iL9rxys1QypjNavMZlfvoU12dPVp43cZ 9ZTzOnltkVWOBoxUzPT3FP3Zm5PRhR1/nwkio5cJDizgJ9tzt8tAkgEAnuJMmbmhjGGk 27o0/LSMd06bk0oOo6bmp03kWXBAzfGZp8TCZile2c37IuoOrllzQXhI4DT6sRbz9T9P eHPO4qn7nB7uaVrRe71+ygqoD+GwXW1JJKHl7OfUnaww4a1xU2AGTqIymoWwWuUG00Xh 5FOKux9/MIhUUK4weO1xVBeUw58oBiyaTQf+LsE9voBAqNvLxsZKAx2rV0ogoFrSngB+ 3Q0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sNpOu7gg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12-v6si17060458plo.442.2018.05.22.12.41.18; Tue, 22 May 2018 12:41:33 -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=@gmail.com header.s=20161025 header.b=sNpOu7gg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbeEVTik (ORCPT + 99 others); Tue, 22 May 2018 15:38:40 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:43682 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752989AbeEVTih (ORCPT ); Tue, 22 May 2018 15:38:37 -0400 Received: by mail-qk0-f194.google.com with SMTP id h19-v6so15568334qkj.10; Tue, 22 May 2018 12:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=blvKPApKGs1G7kPVc4JngGg13iYfojp2PltTPkTBn3A=; b=sNpOu7ggJbYUD0KwQu8v7A7/H1tqDf8+4m0ztP31ZyCYP3MVU9ywn4N8RQC8DxOkc+ nXJqIufRV2zzF87foCbQq8L0tvTTuAEVwNXhffflOOzFDPy6JFwmiNzs1N5a5ne2ptb9 e4sENdtEXupRhfDhmRaklT04x3CVaxDWdGLDAg38dOZUP+VfEvp2qpDbD5nnv5zKO90j mcmpYpSRsqP2WJZceYHZPdYsuPZZ4Mkm0CjLI8QjgILQOdhYKIPshBFKWss8S7MleG6W Uwvz2iIZuhHAc6inDgyroquOb7Sc0YHMaj/p+CcegA7LY921w/AXqLuU8WB52H3juIrD YYWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=blvKPApKGs1G7kPVc4JngGg13iYfojp2PltTPkTBn3A=; b=DnVFMmx5dZWCiFI+gEJY423HuFnXONPAECxu1Y02vNxlrWak6Nt6esOMsTJlTJ5NAb iwt4laPS/zeuVLJfR+iTyFS0S7CZ6Dvr2lf4cNpdAXrPAir9m/kRxJE9xXfrnNx63ifu 43zD6px1I86EBpY74lh6n8Lx5KBKwc7pZz/0FhEw2WC5ieW+MVnuXnWoJyi4Gq979hm9 qSEr1oVJn0Nj++pqYiiqT5SKuLSqPpg2OK6MT3MvAAAz6z8klonblu+mdJH4pLOCBgyv L2Fnw4R4Vd4ewp1oFRhxAbf9IDfCM4+Kj4A5kZx00iNkWr51KxJTODz8Yv/129akYUup Fg7w== X-Gm-Message-State: ALKqPwctsqB6nlFmzDDUoR1y4rKpHYMEJfpsx7wT6/AZI5XePFkL4xhX bOz5VfxuMKNQQhVrSXntY1d6eeq3jhEHNDeM3z+2FcxH X-Received: by 2002:a37:d1d3:: with SMTP id o80-v6mr22546807qkl.3.1527017916767; Tue, 22 May 2018 12:38:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9896:0:0:0:0:0 with HTTP; Tue, 22 May 2018 12:38:36 -0700 (PDT) In-Reply-To: References: <1526492623-20527-1-git-send-email-rishabhb@codeaurora.org> <1526492623-20527-3-git-send-email-rishabhb@codeaurora.org> From: Andy Shevchenko Date: Tue, 22 May 2018 22:38:36 +0300 Message-ID: Subject: Re: [PATCH v7 2/2] drivers: soc: Add LLCC driver To: Rishabh Bhatnagar 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >>> + 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? >>> + 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 ? -- With Best Regards, Andy Shevchenko