;~sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}(hhparenthuba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget:/translations/zh_CN/watchdog/convert_drivers_to_kernel_apimodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}(hhhh2ubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/zh_TW/watchdog/convert_drivers_to_kernel_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}(hhhhFubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/it_IT/watchdog/convert_drivers_to_kernel_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}(hhhhZubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/ja_JP/watchdog/convert_drivers_to_kernel_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}(hhhhnubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/ko_KR/watchdog/convert_drivers_to_kernel_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}(hhhhubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/sp_SP/watchdog/convert_drivers_to_kernel_apimodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(h9Converting old watchdog drivers to the watchdog frameworkh]h9Converting old watchdog drivers to the watchdog framework}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhT/var/lib/git/docbuild/linux/Documentation/watchdog/convert_drivers_to_kernel_api.rsthKubh paragraph)}(h by Wolfram Sang h](hby Wolfram Sang <}(hby Wolfram Sang }(h>hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXSBefore the watchdog framework came into the kernel, every driver had to implement the API on its own. Now, as the framework factored out the common components, those drivers can be lightened making it a user of the framework. This document shall guide you for this task. The necessary steps are described as well as things to look out for.h]hXSBefore the watchdog framework came into the kernel, every driver had to implement the API on its own. Now, as the framework factored out the common components, those drivers can be lightened making it a user of the framework. This document shall guide you for this task. The necessary steps are described as well as things to look out for.}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h!Remove the file_operations structh]h!Remove the file_operations struct}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hXzOld drivers define their own file_operations for actions like open(), write(), etc... These are now handled by the framework and just call the driver when needed. So, in general, the 'file_operations' struct and assorted functions can go. Only very few driver-specific details have to be moved to other functions. Here is a overview of the functions and probably needed actions:h]hX~Old drivers define their own file_operations for actions like open(), write(), etc... These are now handled by the framework and just call the driver when needed. So, in general, the ‘file_operations’ struct and assorted functions can go. Only very few driver-specific details have to be moved to other functions. Here is a overview of the functions and probably needed actions:}(hjhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh bullet_list)}(hhh](h list_item)}(hXopen: Everything dealing with resource management (file-open checks, magic close preparations) can simply go. Device specific stuff needs to go to the driver specific start-function. Note that for some drivers, the start-function also serves as the ping-function. If that is the case and you need start/stop to be balanced (clocks!), you are better off refactoring a separate start-function. h]h)}(hXopen: Everything dealing with resource management (file-open checks, magic close preparations) can simply go. Device specific stuff needs to go to the driver specific start-function. Note that for some drivers, the start-function also serves as the ping-function. If that is the case and you need start/stop to be balanced (clocks!), you are better off refactoring a separate start-function.h]hXopen: Everything dealing with resource management (file-open checks, magic close preparations) can simply go. Device specific stuff needs to go to the driver specific start-function. Note that for some drivers, the start-function also serves as the ping-function. If that is the case and you need start/stop to be balanced (clocks!), you are better off refactoring a separate start-function.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h%close: Same hints as for open apply. h]h)}(h$close: Same hints as for open apply.h]h$close: Same hints as for open apply.}(hj1hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj+ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hwrite: Can simply go, all defined behaviour is taken care of by the framework, i.e. ping on write and magic char ('V') handling. h]h)}(hwrite: Can simply go, all defined behaviour is taken care of by the framework, i.e. ping on write and magic char ('V') handling.h]hwrite: Can simply go, all defined behaviour is taken care of by the framework, i.e. ping on write and magic char (‘V’) handling.}(hjIhjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjCubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hXioctl: While the driver is allowed to have extensions to the IOCTL interface, the most common ones are handled by the framework, supported by some assistance from the driver: WDIOC_GETSUPPORT: Returns the mandatory watchdog_info struct from the driver WDIOC_GETSTATUS: Needs the status-callback defined, otherwise returns 0 WDIOC_GETBOOTSTATUS: Needs the bootstatus member properly set. Make sure it is 0 if you don't have further support! WDIOC_SETOPTIONS: No preparations needed WDIOC_KEEPALIVE: If wanted, options in watchdog_info need to have WDIOF_KEEPALIVEPING set WDIOC_SETTIMEOUT: Options in watchdog_info need to have WDIOF_SETTIMEOUT set and a set_timeout-callback has to be defined. The core will also do limit-checking, if min_timeout and max_timeout in the watchdog device are set. All is optional. WDIOC_GETTIMEOUT: No preparations needed WDIOC_GETTIMELEFT: It needs get_timeleft() callback to be defined. Otherwise it will return EOPNOTSUPP Other IOCTLs can be served using the ioctl-callback. Note that this is mainly intended for porting old drivers; new drivers should not invent private IOCTLs. Private IOCTLs are processed first. When the callback returns with -ENOIOCTLCMD, the IOCTLs of the framework will be tried, too. Any other error is directly given to the user. h](h)}(hioctl: While the driver is allowed to have extensions to the IOCTL interface, the most common ones are handled by the framework, supported by some assistance from the driver:h]hioctl: While the driver is allowed to have extensions to the IOCTL interface, the most common ones are handled by the framework, supported by some assistance from the driver:}(hjahj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hj[ubh block_quote)}(hhh]hdefinition_list)}(hhh](hdefinition_list_item)}(hMWDIOC_GETSUPPORT: Returns the mandatory watchdog_info struct from the driver h](hterm)}(hWDIOC_GETSUPPORT:h]hWDIOC_GETSUPPORT:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhK'hjyubh definition)}(hhh]h)}(h:Returns the mandatory watchdog_info struct from the driverh]h:Returns the mandatory watchdog_info struct from the driver}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjubah}(h]h ]h"]h$]h&]uh1jhjyubeh}(h]h ]h"]h$]h&]uh1jwhhhK'hjtubjx)}(hHWDIOC_GETSTATUS: Needs the status-callback defined, otherwise returns 0 h](j~)}(hWDIOC_GETSTATUS:h]hWDIOC_GETSTATUS:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhK*hjubj)}(hhh]h)}(h6Needs the status-callback defined, otherwise returns 0h]h6Needs the status-callback defined, otherwise returns 0}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jwhhhK*hjtubjx)}(htWDIOC_GETBOOTSTATUS: Needs the bootstatus member properly set. Make sure it is 0 if you don't have further support! h](j~)}(hWDIOC_GETBOOTSTATUS:h]hWDIOC_GETBOOTSTATUS:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhK.hjubj)}(hhh]h)}(h^Needs the bootstatus member properly set. Make sure it is 0 if you don't have further support!h]h`Needs the bootstatus member properly set. Make sure it is 0 if you don’t have further support!}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jwhhhK.hjtubjx)}(h)WDIOC_SETOPTIONS: No preparations needed h](j~)}(hWDIOC_SETOPTIONS:h]hWDIOC_SETOPTIONS:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhK1hj ubj)}(hhh]h)}(hNo preparations neededh]hNo preparations needed}(hj!hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jwhhhK1hjtubjx)}(hZWDIOC_KEEPALIVE: If wanted, options in watchdog_info need to have WDIOF_KEEPALIVEPING set h](j~)}(hWDIOC_KEEPALIVE:h]hWDIOC_KEEPALIVE:}(hj?hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhK5hj9ubj)}(hhh]h)}(hHIf wanted, options in watchdog_info need to have WDIOF_KEEPALIVEPING seth]hHIf wanted, options in watchdog_info need to have WDIOF_KEEPALIVEPING set}(hjPhjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hjKubah}(h]h ]h"]h$]h&]uh1jhj9ubeh}(h]h ]h"]h$]h&]uh1jwhhhK5hjtubjx)}(hWDIOC_SETTIMEOUT: Options in watchdog_info need to have WDIOF_SETTIMEOUT set and a set_timeout-callback has to be defined. The core will also do limit-checking, if min_timeout and max_timeout in the watchdog device are set. All is optional. h](j~)}(hWDIOC_SETTIMEOUT:h]hWDIOC_SETTIMEOUT:}(hjnhjlhhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhK;hjhubj)}(hhh]h)}(hOptions in watchdog_info need to have WDIOF_SETTIMEOUT set and a set_timeout-callback has to be defined. The core will also do limit-checking, if min_timeout and max_timeout in the watchdog device are set. All is optional.h]hOptions in watchdog_info need to have WDIOF_SETTIMEOUT set and a set_timeout-callback has to be defined. The core will also do limit-checking, if min_timeout and max_timeout in the watchdog device are set. All is optional.}(hjhj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjzubah}(h]h ]h"]h$]h&]uh1jhjhubeh}(h]h ]h"]h$]h&]uh1jwhhhK;hjtubjx)}(h)WDIOC_GETTIMEOUT: No preparations needed h](j~)}(hWDIOC_GETTIMEOUT:h]hWDIOC_GETTIMEOUT:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhK>hjubj)}(hhh]h)}(hNo preparations neededh]hNo preparations needed}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK>hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jwhhhK>hjtubjx)}(hgWDIOC_GETTIMELEFT: It needs get_timeleft() callback to be defined. Otherwise it will return EOPNOTSUPP h](j~)}(hWDIOC_GETTIMELEFT:h]hWDIOC_GETTIMELEFT:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1j}hhhKBhjubj)}(hhh]h)}(hSIt needs get_timeleft() callback to be defined. Otherwise it will return EOPNOTSUPPh]hSIt needs get_timeleft() callback to be defined. Otherwise it will return EOPNOTSUPP}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jwhhhKBhjtubeh}(h]h ]h"]h$]h&]uh1jrhjoubah}(h]h ]h"]h$]h&]uh1jmhj[ubh)}(hXMOther IOCTLs can be served using the ioctl-callback. Note that this is mainly intended for porting old drivers; new drivers should not invent private IOCTLs. Private IOCTLs are processed first. When the callback returns with -ENOIOCTLCMD, the IOCTLs of the framework will be tried, too. Any other error is directly given to the user.h]hXMOther IOCTLs can be served using the ioctl-callback. Note that this is mainly intended for porting old drivers; new drivers should not invent private IOCTLs. Private IOCTLs are processed first. When the callback returns with -ENOIOCTLCMD, the IOCTLs of the framework will be tried, too. Any other error is directly given to the user.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhj[ubeh}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1j hhhKhhhhubh)}(hExample conversion::h]hExample conversion:}(hExample conversion:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhhhhubh literal_block)}(hX9-static const struct file_operations s3c2410wdt_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .write = s3c2410wdt_write, - .unlocked_ioctl = s3c2410wdt_ioctl, - .open = s3c2410wdt_open, - .release = s3c2410wdt_release, -};h]hX9-static const struct file_operations s3c2410wdt_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .write = s3c2410wdt_write, - .unlocked_ioctl = s3c2410wdt_ioctl, - .open = s3c2410wdt_open, - .release = s3c2410wdt_release, -};}(hhhj.ubah}(h]h ]h"]h$]h&] xml:spacepreserveuh1j,hhhKLhhhhubh)}(haCheck the functions for device-specific stuff and keep it for later refactoring. The rest can go.h]haCheck the functions for device-specific stuff and keep it for later refactoring. The rest can go.}(hj@hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKUhhhhubeh}(h]!remove-the-file-operations-structah ]h"]!remove the file_operations structah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hRemove the miscdeviceh]hRemove the miscdevice}(hjYhjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjThhhhhKZubh)}(hSince the file_operations are gone now, you can also remove the 'struct miscdevice'. The framework will create it on watchdog_dev_register() called by watchdog_register_device()::h]hSince the file_operations are gone now, you can also remove the ‘struct miscdevice’. The framework will create it on watchdog_dev_register() called by watchdog_register_device():}(hSince the file_operations are gone now, you can also remove the 'struct miscdevice'. The framework will create it on watchdog_dev_register() called by watchdog_register_device():hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjThhubj-)}(h-static struct miscdevice s3c2410wdt_miscdev = { - .minor = WATCHDOG_MINOR, - .name = "watchdog", - .fops = &s3c2410wdt_fops, -};h]h-static struct miscdevice s3c2410wdt_miscdev = { - .minor = WATCHDOG_MINOR, - .name = "watchdog", - .fops = &s3c2410wdt_fops, -};}(hhhjtubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhK`hjThhubeh}(h]remove-the-miscdeviceah ]h"]remove the miscdeviceah$]h&]uh1hhhhhhhhKZubh)}(hhh](h)}(h$Remove obsolete includes and definesh]h$Remove obsolete includes and defines}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKhubh)}(hBecause of the simplifications, a few defines are probably unused now. Remove them. Includes can be removed, too. For example::h]h~Because of the simplifications, a few defines are probably unused now. Remove them. Includes can be removed, too. For example:}(h~Because of the simplifications, a few defines are probably unused now. Remove them. Includes can be removed, too. For example:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKjhjhhubj-)}(h- #include - #include (if MODULE_ALIAS_MISCDEV is not used) - #include (if no custom IOCTLs are used)h]h- #include - #include (if MODULE_ALIAS_MISCDEV is not used) - #include (if no custom IOCTLs are used)}(hhhjubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhKmhjhhubeh}(h]$remove-obsolete-includes-and-definesah ]h"]$remove obsolete includes and definesah$]h&]uh1hhhhhhhhKhubh)}(hhh](h)}(hAdd the watchdog operationsh]hAdd the watchdog operations}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKsubh)}(hX[All possible callbacks are defined in 'struct watchdog_ops'. You can find it explained in 'watchdog-kernel-api.txt' in this directory. start() and owner must be set, the rest are optional. You will easily find corresponding functions in the old driver. Note that you will now get a pointer to the watchdog_device as a parameter to these functions, so you probably have to change the function header. Other changes are most likely not needed, because here simply happens the direct hardware access. If you have device-specific code left from the above steps, it should be refactored into these callbacks.h]hXcAll possible callbacks are defined in ‘struct watchdog_ops’. You can find it explained in ‘watchdog-kernel-api.txt’ in this directory. start() and owner must be set, the rest are optional. You will easily find corresponding functions in the old driver. Note that you will now get a pointer to the watchdog_device as a parameter to these functions, so you probably have to change the function header. Other changes are most likely not needed, because here simply happens the direct hardware access. If you have device-specific code left from the above steps, it should be refactored into these callbacks.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKuhjhhubh)}(hHere is a simple example::h]hHere is a simple example:}(hHere is a simple example:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK~hjhhubj-)}(h+static struct watchdog_ops s3c2410wdt_ops = { + .owner = THIS_MODULE, + .start = s3c2410wdt_start, + .stop = s3c2410wdt_stop, + .ping = s3c2410wdt_keepalive, + .set_timeout = s3c2410wdt_set_heartbeat, +};h]h+static struct watchdog_ops s3c2410wdt_ops = { + .owner = THIS_MODULE, + .start = s3c2410wdt_start, + .stop = s3c2410wdt_stop, + .ping = s3c2410wdt_keepalive, + .set_timeout = s3c2410wdt_set_heartbeat, +};}(hhhjubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhKhjhhubh)}(h-A typical function-header change looks like::h]h,A typical function-header change looks like:}(h,A typical function-header change looks like:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(h-static void s3c2410wdt_keepalive(void) +static int s3c2410wdt_keepalive(struct watchdog_device *wdd) { ... + + return 0; } ... - s3c2410wdt_keepalive(); + s3c2410wdt_keepalive(&s3c2410_wdd);h]h-static void s3c2410wdt_keepalive(void) +static int s3c2410wdt_keepalive(struct watchdog_device *wdd) { ... + + return 0; } ... - s3c2410wdt_keepalive(); + s3c2410wdt_keepalive(&s3c2410_wdd);}(hhhj ubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhKhjhhubeh}(h]add-the-watchdog-operationsah ]h"]add the watchdog operationsah$]h&]uh1hhhhhhhhKsubh)}(hhh](h)}(hAdd the watchdog deviceh]hAdd the watchdog device}(hj&hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj!hhhhhKubh)}(hX;Now we need to create a 'struct watchdog_device' and populate it with the necessary information for the framework. The struct is also explained in detail in 'watchdog-kernel-api.txt' in this directory. We pass it the mandatory watchdog_info struct and the newly created watchdog_ops. Often, old drivers have their own record-keeping for things like bootstatus and timeout using static variables. Those have to be converted to use the members in watchdog_device. Note that the timeout values are unsigned int. Some drivers use signed int, so this has to be converted, too.h]hXCNow we need to create a ‘struct watchdog_device’ and populate it with the necessary information for the framework. The struct is also explained in detail in ‘watchdog-kernel-api.txt’ in this directory. We pass it the mandatory watchdog_info struct and the newly created watchdog_ops. Often, old drivers have their own record-keeping for things like bootstatus and timeout using static variables. Those have to be converted to use the members in watchdog_device. Note that the timeout values are unsigned int. Some drivers use signed int, so this has to be converted, too.}(hj4hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj!hhubh)}(h0Here is a simple example for a watchdog device::h]h/Here is a simple example for a watchdog device:}(h/Here is a simple example for a watchdog device:hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj!hhubj-)}(hv+static struct watchdog_device s3c2410_wdd = { + .info = &s3c2410_wdt_ident, + .ops = &s3c2410wdt_ops, +};h]hv+static struct watchdog_device s3c2410_wdd = { + .info = &s3c2410_wdt_ident, + .ops = &s3c2410wdt_ops, +};}(hhhjOubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhKhj!hhubeh}(h]add-the-watchdog-deviceah ]h"]add the watchdog deviceah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hHandle the 'nowayout' featureh]h!Handle the ‘nowayout’ feature}(hjjhjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjehhhhhKubh)}(hXA few drivers use nowayout statically, i.e. there is no module parameter for it and only CONFIG_WATCHDOG_NOWAYOUT determines if the feature is going to be used. This needs to be converted by initializing the status variable of the watchdog_device like this::h]hXA few drivers use nowayout statically, i.e. there is no module parameter for it and only CONFIG_WATCHDOG_NOWAYOUT determines if the feature is going to be used. This needs to be converted by initializing the status variable of the watchdog_device like this:}(hXA few drivers use nowayout statically, i.e. there is no module parameter for it and only CONFIG_WATCHDOG_NOWAYOUT determines if the feature is going to be used. This needs to be converted by initializing the status variable of the watchdog_device like this:hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjehhubj-)}(h(.status = WATCHDOG_NOWAYOUT_INIT_STATUS,h]h(.status = WATCHDOG_NOWAYOUT_INIT_STATUS,}(hhhjubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhKhjehhubh)}(hMost drivers, however, also allow runtime configuration of nowayout, usually by adding a module parameter. The conversion for this would be something like::h]hMost drivers, however, also allow runtime configuration of nowayout, usually by adding a module parameter. The conversion for this would be something like:}(hMost drivers, however, also allow runtime configuration of nowayout, usually by adding a module parameter. The conversion for this would be something like:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjehhubj-)}(h.watchdog_set_nowayout(&s3c2410_wdd, nowayout);h]h.watchdog_set_nowayout(&s3c2410_wdd, nowayout);}(hhhjubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhKhjehhubh)}(hThe module parameter itself needs to stay, everything else related to nowayout can go, though. This will likely be some code in open(), close() or write().h]hThe module parameter itself needs to stay, everything else related to nowayout can go, though. This will likely be some code in open(), close() or write().}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjehhubeh}(h]handle-the-nowayout-featureah ]h"]handle the 'nowayout' featureah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hRegister the watchdog deviceh]hRegister the watchdog device}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hReplace misc_register(&miscdev) with watchdog_register_device(&watchdog_dev). Make sure the return value gets checked and the error message, if present, still fits. Also convert the unregister case::h]hReplace misc_register(&miscdev) with watchdog_register_device(&watchdog_dev). Make sure the return value gets checked and the error message, if present, still fits. Also convert the unregister case:}(hReplace misc_register(&miscdev) with watchdog_register_device(&watchdog_dev). Make sure the return value gets checked and the error message, if present, still fits. Also convert the unregister case:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj-)}(h- ret = misc_register(&s3c2410wdt_miscdev); + ret = watchdog_register_device(&s3c2410_wdd); ... - misc_deregister(&s3c2410wdt_miscdev); + watchdog_unregister_device(&s3c2410_wdd);h]h- ret = misc_register(&s3c2410wdt_miscdev); + ret = watchdog_register_device(&s3c2410_wdd); ... - misc_deregister(&s3c2410wdt_miscdev); + watchdog_unregister_device(&s3c2410_wdd);}(hhhjubah}(h]h ]h"]h$]h&]j<j=uh1j,hhhKhjhhubeh}(h]register-the-watchdog-deviceah ]h"]register the watchdog deviceah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hUpdate the Kconfig-entryh]hUpdate the Kconfig-entry}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h;The entry for the driver now needs to select WATCHDOG_CORE:h]h;The entry for the driver now needs to select WATCHDOG_CORE:}(hjhj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubjn)}(hhh]j )}(hhh]j)}(hselect WATCHDOG_CORE h]h)}(hselect WATCHDOG_COREh]hselect WATCHDOG_CORE}(hj'hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj!ubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]j+uh1j hhhKhjubah}(h]h ]h"]h$]h&]uh1jmhjhhhNhNubeh}(h]update-the-kconfig-entryah ]h"]update the kconfig-entryah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h&Create a patch and send it to upstreamh]h&Create a patch and send it to upstream}(hjShjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjNhhhhhKubh)}(hMake sure you understood Documentation/process/submitting-patches.rst and send your patch to linux-watchdog@vger.kernel.org. We are looking forward to it :)h](h]Make sure you understood Documentation/process/submitting-patches.rst and send your patch to }(h]Make sure you understood Documentation/process/submitting-patches.rst and send your patch to hj_hhhNhNubh)}(hlinux-watchdog@vger.kernel.orgh]hlinux-watchdog@vger.kernel.org}(hhhjhhhhNhNubah}(h]h ]h"]h$]h&]refuri%mailto:linux-watchdog@vger.kernel.orguh1hhj_ubh!. We are looking forward to it :)}(h!. We are looking forward to it :)hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjNhhubeh}(h]&create-a-patch-and-send-it-to-upstreamah ]h"]&create a patch and send it to upstreamah$]h&]uh1hhhhhhhhKubeh}(h]9converting-old-watchdog-drivers-to-the-watchdog-frameworkah ]h"]9converting old watchdog drivers to the watchdog frameworkah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingUTF-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confapep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacefile_insertion_enabled raw_enabledKline_length_limitM'syntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_link embed_imagesenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjQjNjjjjjjjbj_jjjjjKjHjju nametypes}(jNjQNjNjNjNjbNjNjNjKNjNuh}(jhjNhjjTjjjjj_j!jjejjjHjjjNu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.