Compare commits

..

10 Commits

Author SHA1 Message Date
Cole Deck e0313a70c3 try again! 4 years ago
Cole Deck fd987219fc try again 4 years ago
Cole Deck 219c34f5a9 Update bbswitch.c 4 years ago
Cole Deck 8ff86a7eff try another idea 4 years ago
Cole Deck c38a3e084d Initial changes 4 years ago
Peter Wu ddbd243638 Add missing proc_fs.h header
Required for 'struct proc_ops' since v5.7-rc1 with commit df23e2be3d24
("acpi: Remove header dependency").
5 years ago
Peter Wu 07b110df46
Merge pull request #196 from mateuszmandera/kernel_560
Fix the build with Linux 5.6.0
5 years ago
Mateusz Mandera b0fdcfd847 Use proc_ops structure for kernel version >= 5.6.0
Since 5.6.0, proc_create requires a `struct proc_ops *` argument instead
of `struct file_operations *`.
Commit with the migration in the kernel source can be found at
d56c0d45f0
5 years ago
Peter Wu 9dd227019a Merge pull request #158 from karolherbst/fix_4.12
fix building against 4.12

Should work with older kernels too, it was first introduced with torvalds/linux@c22ce14 which includes asm/uaccess.h
7 years ago
Karol Herbst 322c9625c2 fix building against 4.12 7 years ago

@ -31,10 +31,12 @@
#include <linux/pci.h>
#include <linux/acpi.h>
#include <linux/module.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <linux/pm_runtime.h>
#include <linux/proc_fs.h>
#include <linux/version.h>
#define BBSWITCH_VERSION "0.8"
@ -285,7 +287,7 @@ static void bbswitch_on(void) {
return;
pr_info("enabling discrete graphics\n");
//pci_bridge_secondary_bus_reset(dis_dev);
if (bbswitch_acpi_on())
pr_warn("The discrete card could not be enabled by a _DSM call\n");
@ -375,6 +377,15 @@ static int bbswitch_pm_handler(struct notifier_block *nbp,
return 0;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static struct proc_ops bbswitch_fops = {
.proc_open = bbswitch_proc_open,
.proc_read = seq_read,
.proc_write = bbswitch_proc_write,
.proc_lseek = seq_lseek,
.proc_release= single_release
};
#else
static struct file_operations bbswitch_fops = {
.open = bbswitch_proc_open,
.read = seq_read,
@ -382,6 +393,7 @@ static struct file_operations bbswitch_fops = {
.llseek = seq_lseek,
.release= single_release
};
#endif
static struct notifier_block nb = {
.notifier_call = &bbswitch_pm_handler
@ -418,12 +430,13 @@ static int __init bbswitch_init(void) {
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
if (pdev->vendor == PCI_VENDOR_ID_ATI) {
igd_handle = handle;
pr_info("Found integrated VGA device %s: %s\n",
dev_name(&pdev->dev), (char *)buf.pointer);
} else {
dis_dev = pdev;
pci_d3cold_enable(pdev);
dis_handle = handle;
pr_info("Found discrete VGA device %s: %s\n",
dev_name(&pdev->dev), (char *)buf.pointer);

Loading…
Cancel
Save