Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030863Ab3DSPny (ORCPT ); Fri, 19 Apr 2013 11:43:54 -0400 Received: from mail-ia0-f182.google.com ([209.85.210.182]:39725 "EHLO mail-ia0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030656Ab3DSPnw (ORCPT ); Fri, 19 Apr 2013 11:43:52 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 19 Apr 2013 08:43:52 -0700 Message-ID: Subject: Re: Device driver memory 'mmap()' function helper cleanup From: Michel Lespinasse To: Linus Torvalds Cc: Linux Kernel Mailing List , Clemens Ladisch , Arnd Bergmann , Takashi Iwai , Mauro Carvalho Chehab Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1145 Lines: 24 On Tue, Apr 16, 2013 at 8:12 PM, Linus Torvalds wrote: > Guys, I just pushed out a new helper function intended for cleaning up > various device driver mmap functions, because they are rather messy, > and at least part of the problem was the bad impedance between what a > driver author would want to have, and the VM interfaces to map a > memory range into user space with mmap. I have not had a detailed look yet (am at LSF/MM workshop right now). Just a suggestion: when file->f_op->mmap returns an error code, mmap_region() currently has to call unmap_region() to undo any partial mappings that might have been created by the device driver. Would it make more sense to ask that the few drivers that create such messes to clean up after themselves on their error paths ? -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/