2023-02-07 22:18:11 +05:30
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* 8250 PCI library.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Russell King, All Rights Reserved.
|
|
|
|
*/
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include "8250.h"
|
|
|
|
#include "8250_pcilib.h"
|
|
|
|
|
2024-10-24 19:54:43 +02:00
|
|
|
int serial_8250_warn_need_ioport(struct pci_dev *dev)
|
|
|
|
{
|
|
|
|
dev_warn(&dev->dev,
|
|
|
|
"Serial port not supported because of missing I/O resource\n");
|
|
|
|
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("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>
2024-12-02 15:59:47 +01:00
|
|
|
EXPORT_SYMBOL_NS_GPL(serial_8250_warn_need_ioport, "SERIAL_8250_PCI");
|
2024-10-24 19:54:43 +02:00
|
|
|
|
2023-02-07 22:18:11 +05:30
|
|
|
int serial8250_pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port,
|
|
|
|
u8 bar, unsigned int offset, int regshift)
|
|
|
|
{
|
|
|
|
if (bar >= PCI_STD_NUM_BARS)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
|
|
|
|
if (!pcim_iomap(dev, bar, 0) && !pcim_iomap_table(dev))
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
port->port.iotype = UPIO_MEM;
|
|
|
|
port->port.iobase = 0;
|
|
|
|
port->port.mapbase = pci_resource_start(dev, bar) + offset;
|
|
|
|
port->port.membase = pcim_iomap_table(dev)[bar] + offset;
|
|
|
|
port->port.regshift = regshift;
|
2024-10-24 19:54:43 +02:00
|
|
|
} else if (IS_ENABLED(CONFIG_HAS_IOPORT)) {
|
2023-02-07 22:18:11 +05:30
|
|
|
port->port.iotype = UPIO_PORT;
|
|
|
|
port->port.iobase = pci_resource_start(dev, bar) + offset;
|
|
|
|
port->port.mapbase = 0;
|
|
|
|
port->port.membase = NULL;
|
|
|
|
port->port.regshift = 0;
|
2024-10-24 19:54:43 +02:00
|
|
|
} else {
|
|
|
|
return serial_8250_warn_need_ioport(dev);
|
2023-02-07 22:18:11 +05:30
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("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>
2024-12-02 15:59:47 +01:00
|
|
|
EXPORT_SYMBOL_NS_GPL(serial8250_pci_setup_port, "SERIAL_8250_PCI");
|
2024-06-07 16:10:20 -07:00
|
|
|
MODULE_DESCRIPTION("8250 PCI library");
|
2023-02-07 22:18:11 +05:30
|
|
|
MODULE_LICENSE("GPL");
|