Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4138301ybg; Fri, 25 Oct 2019 13:57:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzi5SX0og3fbIsBC6ItfXA/aYhwT8j2WE9AOQptapIHFRCyIGXWZHOMKVQhbrdX67mkbGBg X-Received: by 2002:aa7:d852:: with SMTP id f18mr6126835eds.110.1572037040047; Fri, 25 Oct 2019 13:57:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572037040; cv=none; d=google.com; s=arc-20160816; b=Q+qgvXJmmP1lrGGqgPzJLCm889AJfT0BbQSwsOySpcOIwwYajGjKyMqkDwPPT70i+0 HFMKQV7uDuPcuw68ssoRhLqgtUvDP5IK58D5Y9Gh2UqBfhtSd7ySIwcQzxL5hwCHWRjZ aNzY32xFZHK7+dL+xUcedAlLLWGx5pHUfTJet8e6R8odCEh9VjOA7P37nukcxTElgXvW Rk21Oz9ROcQZ4CwoNXfOwCvwVCrT2y0pTWUSPkYLMVTbeSen6WHvzsIgBsJDV2dLnyVe COcgHaVX3BxM4Ibeg/GzVSAa5z++GIIVIX4dMd2TjLpTutCWOu0aRJNA9nfh5Fj2Omjm ttxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=2Gj222psC+ydWsaF5gMlny1BmmWIVdou0S6Ni7ju44k=; b=m6FTVfQQXtoYPIumJmrX/M3A0qVlFosO/5R5nMm4TYKzIN+KMLmVq0O5feHXVwvtyF 4b5NWPi3fg5pzpEQgZRsIxei+EfMz0xGPJVtS4E1EODX7HYAEDf0xQr4FgLN6ZXeNXYZ UlM+zj9yWdKrSwSR0T014gwpXd6/JbhF2VOTna1gy8kRegeOjqumqz/VM+n6VJUjYOn3 /+sCgZ+becJjtNlXByQWyKZGDUwa/tJg9EGQqPa4MSHTM3xfxyfvKlKZTYTIlIFR2uln fZ7gWvGh3ZV4rmCe70s6bC7Vy92nKHqeXc+gICLuELZYNDLypRGwsAzHjmM02wwKQQNv BqIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=SlrAb0Vp; 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 l8si1893828ejc.432.2019.10.25.13.56.57; Fri, 25 Oct 2019 13:57:20 -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=fail header.i=@ffwll.ch header.s=google header.b=SlrAb0Vp; 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 S1727372AbfJYTkf (ORCPT + 99 others); Fri, 25 Oct 2019 15:40:35 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36837 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727348AbfJYTkf (ORCPT ); Fri, 25 Oct 2019 15:40:35 -0400 Received: by mail-wr1-f67.google.com with SMTP id w18so3646211wrt.3 for ; Fri, 25 Oct 2019 12:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=2Gj222psC+ydWsaF5gMlny1BmmWIVdou0S6Ni7ju44k=; b=SlrAb0VpRC2LidQiFdSzxi13PPngSwAVFMlhwTS3HufxE9huKhmIAgqmIR//798lPx bOQ2RR/GU0hW0KqsOP8l98Ar1lQDKXoQA/L6z9fLQxb/D/WZFmMR+SdgcBbZtxTMxGLx RFNjhh0n5RhjmOQPhAXid/4PH1covWIixTMlc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=2Gj222psC+ydWsaF5gMlny1BmmWIVdou0S6Ni7ju44k=; b=K+agSMN1L9iFnD6swBRh5oGPA0PQ5LkjQ4l0SL31x4cQ5S18LscPL1pYy0DUmE48+3 dlSknep1yNYsWVXvfQNG0zwDY9kxQTncKqShyc8zikU76WKf7nYGHK3N135JSxAArOxk qct21q1AtjT+ONVOhWTbgf2NJUHFchTfzczLpZalHZVxztoYfpo8kLGEdqRwBgAaanDo hoYqyoGnuXdJwpKgtex2ZK1n20fDfIZVIgL2S1zuWmf1zJdaAs5HZJg0UPgaSSlqfztE ZGd5g7IibhHWgBH4l94fVvd4NC6n2ngYKAqgx6Mmm/2e6uGlCpaQJ4Y2T3mvORAGaABR kdhA== X-Gm-Message-State: APjAAAUrc96e4ixiVeP2aCzJ+O9Li2NQyz8ETjjRpkYYkgUHRKn0QckZ rYtde4ho6j8vkhshPPq9CdnmOg== X-Received: by 2002:a05:6000:351:: with SMTP id e17mr4260765wre.96.1572032432883; Fri, 25 Oct 2019 12:40:32 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id r65sm3210045wmr.9.2019.10.25.12.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 12:40:31 -0700 (PDT) Date: Fri, 25 Oct 2019 21:40:29 +0200 From: Daniel Vetter To: Julia Lawall Cc: Wambui Karuga , dri-devel@lists.freedesktop.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com Subject: Re: [Outreachy kernel] [Outreachy][PATCH] drm: use DIV_ROUND_UP helper macro for calculations Message-ID: <20191025194029.GU11828@phenom.ffwll.local> Mail-Followup-To: Julia Lawall , Wambui Karuga , dri-devel@lists.freedesktop.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, sean@poorly.run, airlied@linux.ie, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com References: <20191025094907.3582-1-wambui.karugax@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.2.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 25, 2019 at 12:12:23PM +0200, Julia Lawall wrote: > > > On Fri, 25 Oct 2019, Wambui Karuga wrote: > > > Replace open coded divisor calculations with the DIV_ROUND_UP kernel > > macro for better readability. > > Issue found using coccinelle: > > @@ > > expression n,d; > > @@ > > ( > > - ((n + d - 1) / d) > > + DIV_ROUND_UP(n,d) > > | > > - ((n + (d - 1)) / d) > > + DIV_ROUND_UP(n,d) > > ) > > > > Signed-off-by: Wambui Karuga > > Acked-by: Julia Lawall Applied to drm-misc-next, thanks for your patch. -Daniel > > > > --- > > drivers/gpu/drm/drm_agpsupport.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c > > index 6e09f27fd9d6..4c7ad46fdd21 100644 > > --- a/drivers/gpu/drm/drm_agpsupport.c > > +++ b/drivers/gpu/drm/drm_agpsupport.c > > @@ -212,7 +212,7 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) > > if (!entry) > > return -ENOMEM; > > > > - pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; > > + pages = DIV_ROUND_UP(request->size, PAGE_SIZE); > > type = (u32) request->type; > > memory = agp_allocate_memory(dev->agp->bridge, pages, type); > > if (!memory) { > > @@ -325,7 +325,7 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) > > entry = drm_agp_lookup_entry(dev, request->handle); > > if (!entry || entry->bound) > > return -EINVAL; > > - page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE; > > + page = DIV_ROUND_UP(request->offset, PAGE_SIZE); > > retcode = drm_bind_agp(entry->memory, page); > > if (retcode) > > return retcode; > > -- > > 2.23.0 > > > > -- > > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191025094907.3582-1-wambui.karugax%40gmail.com. > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch