From patchwork Wed Jun 24 17:23:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 6669691 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4CCE6C05AC for ; Wed, 24 Jun 2015 17:30:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 612B8205AA for ; Wed, 24 Jun 2015 17:30:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65527205DF for ; Wed, 24 Jun 2015 17:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754012AbbFXR36 (ORCPT ); Wed, 24 Jun 2015 13:29:58 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:34628 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753968AbbFXR3z (ORCPT ); Wed, 24 Jun 2015 13:29:55 -0400 Received: by pdbep18 with SMTP id ep18so12982256pdb.1; Wed, 24 Jun 2015 10:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=paHNopcM5mWzfTjNXRT6FNdCBuPRueYK4t7S8U60isI=; b=0G7KXl5ckcF7S1/kF2gnGY5cio0ZKexkvoDxZwBROOQv2EqjbOsqbkTB3YXf12b4ej urXAPN28Usy7FXllbxbrKNSN95mUfEweZf5KJk7JsySvLp8KORUWZ2q01Y1gDMpy5tv2 jukriDbsnvAncJv2NTQFSLE8bo8REosepnfxTOQRLb28Bky+cIWOO94q+7h0VMHQAlv/ xS5aEOPiIkzADAfWrWxtYVZ8sj3F8WhwO1xzoOr8/C647wWqNntmcRsPIVer+SXemN9W CHS+OfDlE3IvY+QwFeoMjPJbdGI4mGxfeD96eCt6+kN1XOGfh0XeV/NShgIlWk/iR8bF bdeA== X-Received: by 10.70.49.229 with SMTP id x5mr81211206pdn.81.1435166994489; Wed, 24 Jun 2015 10:29:54 -0700 (PDT) Received: from mcgrof@gmail.com (c-98-234-145-61.hsd1.ca.comcast.net. [98.234.145.61]) by mx.google.com with ESMTPSA id c16sm27420232pdl.61.2015.06.24.10.29.51 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 24 Jun 2015 10:29:53 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Wed, 24 Jun 2015 10:27:44 -0700 From: "Luis R. Rodriguez" To: bp@suse.de, andy@silverblocksystems.net, mchehab@osg.samsung.com, dledford@redhat.com Cc: mingo@kernel.org, fengguang.wu@intel.com, linux-media@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: [PATCH v2 2/2] x86/mm/pat, drivers/media/ivtv: move pat warn and replace WARN() with pr_warn() Date: Wed, 24 Jun 2015 10:23:20 -0700 Message-Id: <1435166600-11956-3-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435166600-11956-1-git-send-email-mcgrof@do-not-panic.com> References: <1435166600-11956-1-git-send-email-mcgrof@do-not-panic.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Luis R. Rodriguez" On built-in kernels this warning will always splat as this is part of the module init. Fix that by shifting the PAT requirement check out under the code that does the "quasi-probe" for the device. This device driver relies on an existing driver to find its own devices, it looks for that device driver and its own found devices, then uses driver_for_each_device() to try to see if it can probe each of those devices as a frambuffer device with ivtvfb_init_card(). We tuck the PAT requiremenet check then on the ivtvfb_init_card() call making the check at least require an ivtv device present before complaining. Reported-by: Fengguang Wu [0-day test robot] Signed-off-by: Luis R. Rodriguez --- drivers/media/pci/ivtv/ivtvfb.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index 4cb365d..8b95eef 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -38,6 +38,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -1171,6 +1173,13 @@ static int ivtvfb_init_card(struct ivtv *itv) { int rc; +#ifdef CONFIG_X86_64 + if (pat_enabled()) { + pr_warn("ivtvfb needs PAT disabled, boot with nopat kernel parameter\n"); + return -ENODEV; + } +#endif + if (itv->osd_info) { IVTVFB_ERR("Card %d already initialised\n", ivtvfb_card_id); return -EBUSY; @@ -1265,12 +1274,6 @@ static int __init ivtvfb_init(void) int registered = 0; int err; -#ifdef CONFIG_X86_64 - if (WARN(pat_enabled(), - "ivtvfb needs PAT disabled, boot with nopat kernel parameter\n")) { - return -ENODEV; - } -#endif if (ivtvfb_card_id < -1 || ivtvfb_card_id >= IVTV_MAX_CARDS) { printk(KERN_ERR "ivtvfb: ivtvfb_card_id parameter is out of range (valid range: -1 - %d)\n",