Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp675975rdf; Fri, 3 Nov 2023 11:28:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIB3RucrgL8aQ8NPT/Rv01N4ZIW5mwcUIpnBd+59DFFl3b3uJyBZk5SsI3bGJFFfBuWR7/ X-Received: by 2002:a17:90a:31c6:b0:27d:2601:bc92 with SMTP id j6-20020a17090a31c600b0027d2601bc92mr4592861pjf.11.1699036103128; Fri, 03 Nov 2023 11:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699036103; cv=none; d=google.com; s=arc-20160816; b=DvMT7wKahR1aG1I70hNnj5cA8uPDDe386ZyXLhNeS0njx4nXB7zMLz7Ltnv7mAvVo4 dSf4SUGrC5lGBs8peTj7lj+wFaDITKCr0QrPAT2XOSMUtolvcGBoI5QAWIoxrLIwm+N7 bX5m/To1ASQcEYXgFZo9V9xCkpvklYKZWnw9qN/sviJR7zo9R+UC8SGJ7asYCHBCgH6W CgpCbXH8I9pEQjyxGV4hkmU1f8UAIhy5sZbwLl0Cg7UDqnFMSyf7WmYUKbPBhiyPOBSV aBaqg844kP0FtEwA0JFm/SwFw57nAUTlr66/WlZ9qidMP0ULFY6zMfCzBURPD6sPCtzv lwgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=tCQTZTtBGHUcOzfNPoWKgA+n3Zp3rKItoxbSjEs0GKE=; fh=T3SvWiPr29BHPEXL2aNnotttMFPxLY66I78bndOC01k=; b=XKiUBji0O9ZCbPhqldz/Rm56Rc3a/d9HbrvuCfS6PUdIGIhNicdnrMcXTgXpc6y9Nm KwCYCM2TtQr2MBM9UBRZizpPIMuOCmxkkTTy5cCbZ+pAVk9dTuosc4iQTfPOxWpcExyk Qmvx07vkc1HWa6R99oCLKzXVG750dYouWbNg0KMM+XHXoYxLVl/iMr27ai6cgd9dSehq jRvITURg9ktqx5lJ+gROvK1oxYHGoawsUffB/OSW/BCNtTVlcs+OhIn6hddZuTx+ABHE iIvyDNRIYEr2hCWo4ZYePtHz09Xyn1h8dVUhdM2hb1FHT0RmyM+S8w/+k9UIhL4YTaUv iyVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kyp1LLj8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fw18-20020a17090b129200b002684bc84493si2006577pjb.131.2023.11.03.11.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 11:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kyp1LLj8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 845F88061152; Fri, 3 Nov 2023 11:28:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234129AbjKCS2T (ORCPT + 99 others); Fri, 3 Nov 2023 14:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233934AbjKCS2R (ORCPT ); Fri, 3 Nov 2023 14:28:17 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC872DB for ; Fri, 3 Nov 2023 11:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699036052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=tCQTZTtBGHUcOzfNPoWKgA+n3Zp3rKItoxbSjEs0GKE=; b=Kyp1LLj89KfwiLqdjlRIuEAFcGphbDA7CM/asGpVqZ66C+RBbifyW27rYWwqWzMO/flxfN /bWW2i8Pr1n7zKiwXdY5gCgfGq0CJ0c0VN3zbraRMIKKO0rIQoGI7Ipe+k3GJbvI2R1STa z+laGdy1AIbkhX0Afpl6uaPPsO2bBuw= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-338-dmATparcOzqhWsHJ-sPZaA-1; Fri, 03 Nov 2023 14:27:29 -0400 X-MC-Unique: dmATparcOzqhWsHJ-sPZaA-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5401de6ce9eso456203a12.0 for ; Fri, 03 Nov 2023 11:27:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699036048; x=1699640848; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tCQTZTtBGHUcOzfNPoWKgA+n3Zp3rKItoxbSjEs0GKE=; b=Ts02zWUJmLUoJyrDAFlZnB72C7rCqVGV8jtbxFydAO0TnxfenMTPEM6fiBBdwKatvj zbW/V9rINZ5sgs6fACYoT0Z6yB7/henvIL9JIW9qnwNaAwFjz3zXagjn2QUiqpzBU8TG nZ3DlV3bUpcrAGUBpYzwDFFu0f6cAs94zOfGe/KlLB2WycI1NMhmKpf7rjQzEgdC201Q uw2J+FlnG8puY/LHkCF6rOsUqHCIaw3yUkhpicbwGjeA2BsTwSQ6oZdNCOSXC0WHSrNE FgjlCRfDoWBf52++9ooyzXOaigdDQcU2ah/yHjnvwEnXcGz2bL9fuzaOUudTn7VjBkKX MFxQ== X-Gm-Message-State: AOJu0YxJC1mc/rKgVoV/t39ztDX5M9Y5t54FDePxUGDYaUNEY6wHhziQ lRfJ1bL7mrjssobhedh2aAKtVcXJaA48H+uw5hqoMzTbpH9fQmljJ8B72xPV8dTLvxiNIMIOmfx I7uAsfHwUpFI7SddvUGTtDBb/ X-Received: by 2002:a05:6402:f0a:b0:544:3966:6904 with SMTP id i10-20020a0564020f0a00b0054439666904mr873182eda.2.1699036048592; Fri, 03 Nov 2023 11:27:28 -0700 (PDT) X-Received: by 2002:a05:6402:f0a:b0:544:3966:6904 with SMTP id i10-20020a0564020f0a00b0054439666904mr873173eda.2.1699036048291; Fri, 03 Nov 2023 11:27:28 -0700 (PDT) Received: from pstanner-thinkpadt14sgen1.fritz.box ([2001:9e8:32d1:5200:227b:d2ff:fe26:2a7a]) by smtp.gmail.com with ESMTPSA id v23-20020a50d597000000b0053dd8898f75sm1250103edi.81.2023.11.03.11.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 11:27:28 -0700 (PDT) From: Philipp Stanner To: Dave Airlie , Thomas Zimmermann , Jocelyn Falempe , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Philipp Stanner Subject: [PATCH v2] drm/ast: use managed devres functions Date: Fri, 3 Nov 2023 19:25:43 +0100 Message-ID: <20231103182542.97589-2-pstanner@redhat.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 11:28:21 -0700 (PDT) Currently, tha ast-driver just maps the PCI-dev's regions with pcim_iomap(). It does not actually reserve the regions exclusively with, e.g., pci_request_regions(). Replace the calls to pcim_iomap() with ones to pcim_iomap_regions() to reserve and map the regions simultaneously. Suggested-by: Thomas Zimmermann Signed-off-by: Philipp Stanner --- Changes in v2: - Remove unnecessary return code checks for pcim_iomap_regions() (Jocelyn) Thx Jocelyn for the kind review --- drivers/gpu/drm/ast/ast_main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index dae365ed3969..8b714b99f9d6 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -444,9 +444,11 @@ struct ast_device *ast_device_create(const struct drm_driver *drv, if (ret) return ERR_PTR(ret); - ast->regs = pcim_iomap(pdev, 1, 0); - if (!ast->regs) - return ERR_PTR(-EIO); + ret = pcim_iomap_regions(pdev, BIT(1), 0); + if (ret) + return ERR_PTR(ret); + + ast->regs = pcim_iomap_table(pdev)[1]; /* * After AST2500, MMIO is enabled by default, and it should be adopted @@ -461,9 +463,10 @@ struct ast_device *ast_device_create(const struct drm_driver *drv, /* "map" IO regs if the above hasn't done so already */ if (!ast->ioregs) { - ast->ioregs = pcim_iomap(pdev, 2, 0); - if (!ast->ioregs) - return ERR_PTR(-EIO); + ret = pcim_iomap_regions(pdev, BIT(2), 0); + if (ret) + return ERR_PTR(ret); + ast->ioregs = pcim_iomap_table(pdev)[2]; } if (!ast_is_vga_enabled(dev)) { -- 2.41.0