Received: by 10.223.185.116 with SMTP id b49csp334695wrg; Thu, 22 Feb 2018 22:54:28 -0800 (PST) X-Google-Smtp-Source: AH8x227yPtKEn63n6gcjWldTtwmb7FDiGtdLSTjioq9vZ5x35Ad9HJ93tgBFIEphY232Li4m9od8 X-Received: by 10.101.81.76 with SMTP id g12mr668096pgq.24.1519368868708; Thu, 22 Feb 2018 22:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519368868; cv=none; d=google.com; s=arc-20160816; b=AjEXkboOCRfBT9Ns2eXNgfuvIwuQ3XwsZaiQeSGDOuDod02l7hWJNoLwWgMjNW2/RX wLWDRZUc3VjSlz5h9IX5UCkBxvVXMgCsKq3u/OaYQk6C5NtQaM6ZZrYNPNtfL1/eQmIJ hz8aPw5G7BteQNkj8yoFhSlr7lwQTtkPeyJmXICGlTBKs6W43zAT0PHl5WQ4MDPMqwDF 4zTDU69e221vzYsXfplgYdgbHSFF3vneTo5J45lq0jsA7DWsP13rmnQnJsPCt+P9s1PL kPZbywmHiT5vdfICYySPZy1bPv0S07GrFmP7JYh77egIG7gzDqg8toYVxTro5D7W4m7O c16A== 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=UasjqQuZm8G7GlrryYhAWYtuAjR/vQiN23Wi8+YvFYE=; b=K641MA0vB62Wcu2u151+jk4FWp1+zRByKD3o3Z5XrA41bRqVjoRRU7RA2ONgSwpvlH OroL1MHLoeMYHWXfskDDypts0jgc1h93lMG82IM0jx+KKf18eZ1hCbQSDkV29akhUUpc MbYa6SAGMBfngMfJVm7HKpOJWrgYkkfEfzruKRxBTCnubbEyHdDPXDrr3yxB57sNe82v baxuz7BzfcPtc2/W1PVR8R2rllEluHhqnA5yMtLSla8fwOqICEfjMtMVtGrL4v8EatOD 9gMfXNxwrcq8D+gimVFU6YdZHpVL7uUMSCOOrLXwQiIu7Zg+9IyHkshr2gZJ+hwIjpLY 5b8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=MAOI4YkV; dkim=pass header.i=@codeaurora.org header.s=default header.b=egqUAtmb; 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 9-v6si1324825ple.367.2018.02.22.22.54.12; Thu, 22 Feb 2018 22:54:28 -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=MAOI4YkV; dkim=pass header.i=@codeaurora.org header.s=default header.b=egqUAtmb; 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 S1751454AbeBWGxd (ORCPT + 99 others); Fri, 23 Feb 2018 01:53:33 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:50444 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751350AbeBWGxb (ORCPT ); Fri, 23 Feb 2018 01:53:31 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5EF606021C; Fri, 23 Feb 2018 06:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519368811; bh=mbdOHot81q724nEhfvp9Irm/mWB4OU1FsZIMNtQ0sIE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MAOI4YkVuuBTEPXS/Xk5kHgZiLGMJWGdVI1NL9KKQksnHyEnPdfUcKjVBDsCXfHzY POeA9AyCkYuy8WbeNOFBZU+zDiyHRaPfvO55qT182TJ+/97+vExI86RNMOLHzGS9E2 gxwQbThBNvjUHb4U9tqZYGdU2e5xobOjTKpdB6No= 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 8C9A56021C; Fri, 23 Feb 2018 06:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519368810; bh=mbdOHot81q724nEhfvp9Irm/mWB4OU1FsZIMNtQ0sIE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=egqUAtmbbf7YFvcVgavuBFhd1/1DNTFpG9hBbGMos2SgbHpfiF57ef1N0sigWYgiq eEq7C3ydJijRIkb5M+yrLb3D4OWvqR0PD9SnO+a2QcUUDeQTKwKhB5U0hxjHYRAE49 9SzXJn6p18hC3dVG6KQDnU0oFOKdcUDzChdbAn4Y= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 23 Feb 2018 12:23:30 +0530 From: poza@codeaurora.org To: Christoph Hellwig Cc: Bjorn Helgaas , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Subject: Re: [PATCH v10 6/7] PCI: Unify wait for link active into generic pci In-Reply-To: <20180222184348.GE6267@infradead.org> References: <1519315332-26852-1-git-send-email-poza@codeaurora.org> <1519315332-26852-7-git-send-email-poza@codeaurora.org> <20180222184348.GE6267@infradead.org> Message-ID: X-Sender: poza@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-02-23 00:13, Christoph Hellwig wrote: >> >> +/** >> + * pci__wait_for_link - Wait for link till its active/inactive > > typo - just wants a single underscore. > >> + pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); >> + ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); > > no need for the !! when assigning to a boolean. bool is 8 bit, while #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ so I think we need it. otherwise it will treat lnk_status & PCI_EXP_LNKSTA_DLLLA as 0 even if 13th bit is set. > >> + >> + while ((ret != active) && (timeout > 0)) { > > No need for either pair of inner braces. > >> + msleep(10); >> + timeout -= 10; >> + pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); >> + ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA); > > Same as above. > >> + } >> + >> + if (ret == active) >> + return true; > > Seems like the structure is a bit odd. Why not: > > for (;;) { > pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); > if ((lnk_status & PCI_EXP_LNKSTA_DLLLA) == active) > return true; > if (timeout <= 0) > break; > timeout -= 10; > } Thanks for suggestion, will do this way. thanks. Regards, Oza.