All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] compat: Make use of the vga_switcheroo_register_client
@ 2012-07-02 14:22 Ozan Çağlayan
  2012-07-02 14:22 ` [PATCH 2/5] compat: Backport shmem_read_mapping_page() Ozan Çağlayan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ozan Çağlayan @ 2012-07-02 14:22 UTC (permalink / raw)
  To: mcgrof; +Cc: linux-wireless, Ozan Çağlayan

If kernel version is older than 3.5, call vga_switcheroo_register_client
with the old parameters using a compat_ wrapper.

.reprobe was added in 2.6.38 so before that do not pass it to the
underlying vga_switcheroo_register_client() function.

Trying kernel  3.4.0-030400-generic [OK]
Trying kernel  3.3.7-030307-generic [OK]
Trying kernel  3.2.2-030202-generic [OK]
Trying kernel  3.1.10-030110-generic [OK]
Trying kernel  3.0.18-030018-generic [OK]
Trying kernel  2.6.39-02063904-generic [OK]
Trying kernel  2.6.38-02063808-generic [OK]
Trying kernel  2.6.37-02063706-generic [OK]
Trying kernel  2.6.36-02063604-generic [OK]
Trying kernel  2.6.35-02063512-generic [OK]
Trying kernel  2.6.34-02063410-generic [OK]
Trying kernel  2.6.33-02063305-generic [OK]
Trying kernel  2.6.32-02063255-generic [OK]
Trying kernel  2.6.31-02063113-generic [OK]
Trying kernel  2.6.30-02063010-generic [OK]
Trying kernel  2.6.29-02062906-generic [OK]
Trying kernel  2.6.28-02062810-generic [OK]
Trying kernel  2.6.27-020627-generic [OK]
Trying kernel  2.6.26-020626-generic [OK]
Trying kernel  2.6.25-020625-generic [OK]
Trying kernel  2.6.24-020624-generic [OK]

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
---
 include/linux/compat-3.5.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/linux/compat-3.5.h b/include/linux/compat-3.5.h
index 74c8176..7855ac9 100644
--- a/include/linux/compat-3.5.h
+++ b/include/linux/compat-3.5.h
@@ -93,6 +93,24 @@ struct vga_switcheroo_client_ops {
     void (*reprobe)(struct pci_dev *dev);
     bool (*can_switch)(struct pci_dev *dev);
 };
+
+/* Wrap around the old code and redefine vga_switcheroo_register_client()
+ * for older kernels < 3.5.0.
+ */
+static inline int compat_vga_switcheroo_register_client(struct pci_dev *dev,
+		const struct vga_switcheroo_client_ops *ops) {
+
+	return vga_switcheroo_register_client(dev,
+					      ops->set_gpu_state,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+					      ops->reprobe,
+#endif
+					      ops->can_switch);
+}
+
+#define vga_switcheroo_register_client(_dev, _ops) \
+	compat_vga_switcheroo_register_client(_dev, _ops)
+
 #endif
 
 /*
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-03  0:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-02 14:22 [PATCH 1/5] compat: Make use of the vga_switcheroo_register_client Ozan Çağlayan
2012-07-02 14:22 ` [PATCH 2/5] compat: Backport shmem_read_mapping_page() Ozan Çağlayan
2012-07-02 14:22 ` [PATCH 3/5] compat: Define I2C_FUNC_NOSTART Ozan Çağlayan
2012-07-02 14:22 ` [PATCH 4/5] compat: Backport i2c_bit_algo structure Ozan Çağlayan
2012-07-02 14:22 ` [PATCH 5/5] compat: Backport DIV_ROUND_UP_DLL macro Ozan Çağlayan
2012-07-03  0:18   ` Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.