From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754645AbcFPUpB (ORCPT ); Thu, 16 Jun 2016 16:45:01 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:60294 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754135AbcFPUo7 (ORCPT ); Thu, 16 Jun 2016 16:44:59 -0400 Date: Thu, 16 Jun 2016 14:44:55 -0600 From: Jason Gunthorpe To: Tomas Winkler Cc: Jarkko Sakkinen , linux-security-module@vger.kernel.org, "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [tpmdd-devel] [PATCH 3/3] tpm, tpm_crb: runtime power management Message-ID: <20160616204455.GA2744@obsidianresearch.com> References: <1465340522-1112-1-git-send-email-jarkko.sakkinen@linux.intel.com> <1465340522-1112-4-git-send-email-jarkko.sakkinen@linux.intel.com> <20160616195735.GA30378@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.160 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 16, 2016 at 11:26:48PM +0300, Tomas Winkler wrote: > > It is compiled out if it is unused. Why would you want to trash the code > > with #ifdef cages if they are not necessary? I can add /* CONFIG_PM */ > > before the function if that makes it cleaner. > > I'm not sure about that, I believe it just suppresses warnings. > You will need something --gc-sessions int the linker, I'm not sure > this is used by kernel. No, it is fine. The compiler drops unused static functions, that is what the attribute is for. It always does this, so supressing the warning is the desire behavior. The kernel preference is to avoid ifdefs and always compile all the code to avoid problems with config option combinations. --gc-sections isn't useful unless -ffunction-section is used, which the kernel doesn't do. Fortunately the dead code is removed by the compiler, not the linker. Jason