Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp942070pxb; Wed, 1 Sep 2021 13:17:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGbhIVl7/Z8lOIeNOnvOh/OCo6SDqkmZU4TPcXitObT7ysGsSIlb+ldz6dZIEhqvntiUBL X-Received: by 2002:aa7:c1d0:: with SMTP id d16mr1439298edp.110.1630527424092; Wed, 01 Sep 2021 13:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630527424; cv=none; d=google.com; s=arc-20160816; b=AlCZqC2ttfoY32puAH7xxDa1fk+VJzGngHLtMOZc+Zf1Xv/cZX6StJcge3ugEy14LJ beLkQiOMN6jNQcZ78GfxzJE6cWWQnwkwZAPGV2qxpj41gBYmS8twz949kocZTTT/8p1u /gsLGlI58kpVmLfJEciKLFUCW5F0pjfk9sPs1krFuw9qVEnMzyzRb/IRNxCaTMMYFyF7 6HbXzCYMX6UHxhJVbkpBg8zQt6fljZ5crbR5KMYbXR55f0oGpgGwwtOa1Ith4o9qPyns VOiBOdHEJVFURSDcw7x+bGMAycMjVoBeXriK0wdradOzteVCnHHYuiSNLRocOG6RXTeE v57Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kznhPZI+exdo53r0z19QLREGIB9sxK1qJGjkW9+snMw=; b=09j1i9ejFE+CNOs6G1MIlWX+vgPknpZG4TQZ5lWUG1w3y8kMBI+I2aZtjRl78odMJx 9O0HUTAJkqyFVfQoRtVQYfVIC0pjYkutzc/JHs5DXwyHZgbnk3wZrHjCpAeuxpPK4h3o 2HvznYoXi46IqH8f+eaX9PvnknD5iPupf+fUa/nOS1gTFeCBe7phZIBZwMwG7stb8Olr CRrnQZsr3Ld5qGSQMuq7qKJf4/gOjHPYEsK+DLSWmgzY2y7NRhwq1anxtImm5l+lHdES NRrYWUy76buQCuwPZBiHfsWEHV+WMDo9zWXtq6k/Uh2AIjvqjfqjwLCJVDIA1UrFQGhi gmhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QPeXShP9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si791649ejc.42.2021.09.01.13.16.40; Wed, 01 Sep 2021 13:17:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QPeXShP9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245541AbhIAQwL (ORCPT + 99 others); Wed, 1 Sep 2021 12:52:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:38824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245504AbhIAQwK (ORCPT ); Wed, 1 Sep 2021 12:52:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84A0660525; Wed, 1 Sep 2021 16:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630515072; bh=A9wkNg9aBJrglsUZ5b/buH7xJaIQnLA+gD3vgVvDd7s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QPeXShP9yKHzHlMdGL7qlLOd2lcOPNGRl8kL0qYwIlxJPbLzdlLogxSB0S1nBPiOc Pm7JdoOZozq1ou1DXfeRSbjYD9TWSXqmORrEypMmDIJhPT07uUNT9aINUF9qNv51ar +IKAIzlaYNjJIU9AZQJC+5QNVoX4ufAex0OeNuGw= Date: Wed, 1 Sep 2021 18:51:09 +0200 From: Greg KH To: Krish Jain Cc: Bryan Brattlof , "Fabio M. De Francesco" , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Declare the file_operations struct as const Message-ID: References: <20210829144531.c2syu4vv4s22dlg7@h510> <20210831133533.6aayzjghdakrhy56@h510> <13366651.n50aozgL3V@localhost.localdomain> <20210831230014.cp46vho2hnndacjp@h510> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 01, 2021 at 05:34:36PM +0200, Krish Jain wrote: > Oh ok, thanks Greg. I only attempted to use "make CCFLAGS=-Werror W=1 > M=drivers/staging/android/" as that's the command Bryan used earlier > and it worked. > > "As for your patch, I built the driver using: > > $ make CCFLAGS=-Werror W=1 M=drivers/staging/android" > > > Can you tell me why this is the case? Again, it depends on your kernel configuration file as to what will, or will not, be built. If you have some things set as modules, they can be built as a module, but the ashmem code can not be built as a module, so you would never build it if you did the above line. Here, look at this sequence, starting with a tree that does nothing if I do a simple 'make' in it, as the whole kernel is already built, and ashmem is enabled in the kernel configuration $ grep ASHMEM .config CONFIG_ASHMEM=y $ make $ So, let's change the time stamp on the ashmem.c file and see what gets built if you use the M= option: $ touch drivers/staging/android/ashmem.c $ make M=drivers/staging/android MODPOST drivers/staging/android/Module.symvers $ Nothing gets built as ashmem is NOT a module, and M= only builds any modules in the directory you specified. But, if you tell make to just build the whole subdirectory, no matter what the setting is, it will be built: $ make drivers/staging/android/ CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool CC drivers/staging/android/ashmem.o AR drivers/staging/android/built-in.a $ So that's the difference, "M=" builds modules in that directory, but if you tell it to build the subdir, everything in there that needs to be built, will be built. Be careful about your kernel configuration, that is the key for what will, and will not, be built. Perhaps you should look at the book, "Linux Kernel in a Nutshell" that is free online. It talks all about building and configuring a kernel. Parts of it are out of date, but the general ideas are good. hope this helps, greg k-h