mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}
  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
		
	
			
		
			
				
	
	
		
			73 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0-only
 | 
						|
/*
 | 
						|
 * This file defines data structures and functions used in Machine
 | 
						|
 * Driver for Intel platforms with Nuvoton Codecs.
 | 
						|
 *
 | 
						|
 * Copyright 2023 Intel Corporation.
 | 
						|
 */
 | 
						|
#include <linux/module.h>
 | 
						|
#include <sound/sof.h>
 | 
						|
#include "sof_nuvoton_common.h"
 | 
						|
 | 
						|
/*
 | 
						|
 * Nuvoton NAU8318
 | 
						|
 */
 | 
						|
static const struct snd_kcontrol_new nau8318_kcontrols[] = {
 | 
						|
	SOC_DAPM_PIN_SWITCH("Spk"),
 | 
						|
};
 | 
						|
 | 
						|
static const struct snd_soc_dapm_widget nau8318_widgets[] = {
 | 
						|
	SND_SOC_DAPM_SPK("Spk", NULL),
 | 
						|
};
 | 
						|
 | 
						|
static const struct snd_soc_dapm_route nau8318_routes[] = {
 | 
						|
	{ "Spk", NULL, "Speaker" },
 | 
						|
};
 | 
						|
 | 
						|
static struct snd_soc_dai_link_component nau8318_components[] = {
 | 
						|
	{
 | 
						|
		.name = NAU8318_DEV0_NAME,
 | 
						|
		.dai_name = NAU8318_CODEC_DAI,
 | 
						|
	}
 | 
						|
};
 | 
						|
 | 
						|
static int nau8318_init(struct snd_soc_pcm_runtime *rtd)
 | 
						|
{
 | 
						|
	struct snd_soc_card *card = rtd->card;
 | 
						|
	int ret;
 | 
						|
 | 
						|
	ret = snd_soc_dapm_new_controls(&card->dapm, nau8318_widgets,
 | 
						|
					ARRAY_SIZE(nau8318_widgets));
 | 
						|
	if (ret) {
 | 
						|
		dev_err(rtd->dev, "fail to add nau8318 widgets, ret %d\n", ret);
 | 
						|
		return ret;
 | 
						|
	}
 | 
						|
 | 
						|
	ret = snd_soc_add_card_controls(card, nau8318_kcontrols,
 | 
						|
					ARRAY_SIZE(nau8318_kcontrols));
 | 
						|
	if (ret) {
 | 
						|
		dev_err(rtd->dev, "fail to add nau8318 kcontrols, ret %d\n", ret);
 | 
						|
		return ret;
 | 
						|
	}
 | 
						|
 | 
						|
	ret = snd_soc_dapm_add_routes(&card->dapm, nau8318_routes,
 | 
						|
				      ARRAY_SIZE(nau8318_routes));
 | 
						|
 | 
						|
	if (ret) {
 | 
						|
		dev_err(rtd->dev, "fail to add nau8318 routes, ret %d\n", ret);
 | 
						|
		return ret;
 | 
						|
	}
 | 
						|
 | 
						|
	return ret;
 | 
						|
}
 | 
						|
 | 
						|
void nau8318_set_dai_link(struct snd_soc_dai_link *link)
 | 
						|
{
 | 
						|
	link->codecs = nau8318_components;
 | 
						|
	link->num_codecs = ARRAY_SIZE(nau8318_components);
 | 
						|
	link->init = nau8318_init;
 | 
						|
}
 | 
						|
EXPORT_SYMBOL_NS(nau8318_set_dai_link, "SND_SOC_INTEL_SOF_NUVOTON_COMMON");
 | 
						|
 | 
						|
MODULE_DESCRIPTION("ASoC Intel SOF Nuvoton helpers");
 | 
						|
MODULE_LICENSE("GPL");
 |