Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp818225imm; Mon, 21 May 2018 15:05:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpgYp0/h6Fcam57/3pw2qZOoYb07Ef98BZpQ9UK2FhfdhhiI3nSK6SrCqORw1r7dFf/3jLu X-Received: by 2002:a65:5ac9:: with SMTP id d9-v6mr17200039pgt.342.1526940303453; Mon, 21 May 2018 15:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526940303; cv=none; d=google.com; s=arc-20160816; b=METcX4nWZAouMZGALTxM1Hayxy6VKV4kVDOpMIiiBnELK32G0kNyiw8gnvMoSLupOx /NTVYxTgVg02UI/fxD7EikFafHJ5YXWWebBHNl4w6x0QVkk2n9tVm9m9ebTbEV9taJ+f lX3665qpBuM8SAHOnzybZbZXbqPit04QqL5+c+81FQbDZ13Wxvl4I8HfcWvczN8HsnIS GzbkPg/8MsPKkU06J7uiIqq4TDme4N8dYwldQr5Sj+WkVc2iH1ydU2VifPAlWngEjeuv 4nxqPiZjFhCu73nGTL8CJVmcSGWiijbONwwWjDdr4mAZ5h5l/MWSHGG8oE1tVlzAtr7j F2gQ== 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=C6U0XQPvBVxplCCREHuWP8hgiys0H9vjbZbpGOj1fY8=; b=0DCfsQCznkdznnFAjEh1xO6iOjUayZq6ipykGZ7ju0Wcje/tnVSgRAhCYNEru9RmQJ PETyUAhX87guWSEGXP2KRgoEfJg5GqUnSjxYkxx2syLtbf+r5R3dcGdO6T+skDuQXoz9 vQw9ziPpWI4dY9MZvhaTjc/gU2ni08KDWyvLmnxSt3/QmGyt590BbieniPtPOO7EsQEs RzlH0NMK/D6+cCX2ljWyjC5xRVkREXKwZOcUXzjftwjfQFIwat9wDNxWr4s2iekUc0DT xouQbyHQGpU1G/E2SobFmowAFT5+n/nc2SXNir9ldWaDdgN2Q4JpEd9gQ5aOyvvTr/NK aPYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jOmbv7NV; 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 f16-v6si2600875pgn.464.2018.05.21.15.04.48; Mon, 21 May 2018 15:05:03 -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=jOmbv7NV; 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 S1754605AbeEUWED (ORCPT + 99 others); Mon, 21 May 2018 18:04:03 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:33151 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbeEUWEA (ORCPT ); Mon, 21 May 2018 18:04:00 -0400 Received: by mail-qt0-f193.google.com with SMTP id e8-v6so20950372qth.0 for ; Mon, 21 May 2018 15:03:59 -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=C6U0XQPvBVxplCCREHuWP8hgiys0H9vjbZbpGOj1fY8=; b=jOmbv7NV3snHQNz74hYtitj+7avMwDzcuBFzw2+x3FUmGAQwClG2UCEKcLuP+66WMj 1FjwNYB/WGCxAwjoECDNOudBJ6XCR2sg5Y22bynKedmqeaLJkA2JpRZ2QMcCDQieqIsf o72go3THgFboWEtuQzQGU1D5UBQLtfKvoOw+Px0OnlqQcIUxbPkpnzGD+Vwo/P3xKzzS 0rSBoHCjmUwUoYcyqpgtTP4ZVQItyDoQMATVM+32uApCR9+9SYN/X3sLdFCZxwgZpvel nCjyMi4TyZefqwzRyPWbDRexgNPY8zRkaixe9PxbGsOc9Z921+QWadK3jGq4pyLUx9yd Q9vA== 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=C6U0XQPvBVxplCCREHuWP8hgiys0H9vjbZbpGOj1fY8=; b=ghBcRalHQmSqTOKOosFzkIGY5aj1Ez9rLjFOGiJbyT4GDdbA/gLn+/aFYX0PoypYVd BhlMvtUB2a8T/83dlebd1F4ghhg9MUsn/HY+cBP13VxAScnaOL8RMaG70OIV/YfZMiy3 fLPmcAasf0xLdE5f3qjqtFSnbFZt5rqJ5x1CooPdniUd9LEdaRGCDppfMY0IUWdsw4eB PIMq7GbqU16J3yBdE+EaDlX3H66bMatvhVDDQQ5uB/KXDXD2btvMRvl/LqoL11gGo21t /BxLe38Xa/jq8BlXvyKl3gAzBlqFPEfUWpjist6bg7kbBsSCRQdR16Ek7/KCJf9vtdzX TTPA== X-Gm-Message-State: ALKqPwckVmYdiO8QzbFG0kgbhYw0DDMe5F7f68kFC1jaMVRrk+YyU3mS 9WGfd5TVjsIHccWP53BUKpacj4mJlgLllvOhmhf8GKqU X-Received: by 2002:aed:2c43:: with SMTP id f61-v6mr20101403qtd.105.1526940239498; Mon, 21 May 2018 15:03:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.150 with HTTP; Mon, 21 May 2018 15:03:59 -0700 (PDT) In-Reply-To: <1526903890-35761-22-git-send-email-xieyisheng1@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-22-git-send-email-xieyisheng1@huawei.com> From: Andy Shevchenko Date: Tue, 22 May 2018 01:03:59 +0300 Message-ID: Subject: Re: [PATCH 21/33] drm/nouveau: use match_string() helper To: Yisheng Xie Cc: Linux Kernel Mailing List , Ben Skeggs , David Airlie , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org 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 Mon, May 21, 2018 at 2:57 PM, Yisheng Xie wrote: > match_string() returns the index of an array for a matching string, > which can be used intead of open coded variant. > if (nouveau_tv_norm) { > + i = match_string(nv17_tv_norm_names, > + num_tv_norms, nouveau_tv_norm); Same comment for logical split, 2nd parameter looks better on the previous line. > + if (i >= 0) > + tv_enc->tv_norm = i; > + else > NV_WARN(drm, "Invalid TV norm setting \"%s\"\n", > nouveau_tv_norm); I would rather go with if (i < 0) NV_WARN else ... > } -- With Best Regards, Andy Shevchenko